Skip to content

chore: add live-credential smoke test across github/gitlab/gitea before merging push/pull/delete changes #57

Description

@ClaudiaFang

Context

Recent batch-push work (GitHub's pushBatch/deleteBatch switched to GraphQL createCommitOnBranch) was validated with mocked requestUrl only until manual live verification against a real repository. Real provider testing caught issues that mocks cannot detect:

  • actual API request/response shape;
  • HTTP status and provider-specific error behavior;
  • GraphQL mutation failures returned as HTTP 200 with errors[];
  • real commit/tree history behavior.

This repository supports three providers (GitHubService, GitLabService, GiteaService) with different API implementations. The goal is to create a reliable real-provider contract test process without over-coupling to provider internals.

Goal

Create a repeatable real-provider E2E harness that verifies production service code against real GitHub, GitLab, and Gitea environments.

The first PR should focus on provider contract verification, not a full CI testing platform.

Scope (v1)

E2E test foundation

  • Add isolated e2e/vitest.e2e.config.ts
    • must not load existing mocked obsidian setup;
    • must import production service implementations directly.
  • Add lightweight obsidian shim for E2E only
    • requestUrl backed by real fetch;
    • compatible response contract for BaseGitService.safeRequest();
    • token redaction before logging failures.
  • Add provider runner script
    • do not pass custom flags directly to Vitest;
    • wrapper handles --provider, credential loading, and test filtering.
  • Credentials must come from local files or secure CI secrets.
    • never commit tokens;
    • never print tokens.

Provider smoke scenarios

Shared scenarios (GitHub / GitLab / Gitea)

  • testConnection
  • pushFile create
  • getFile
  • pushFile update
  • pushBatch
  • deleteFile
  • deleteBatch
  • listFilesDetailed
  • getBlob
  • root path handling
  • temporary branch/repository cleanup

GitHub additional scenarios

  • GraphQL batch commit verification
  • GraphQL errors[] handling verification
  • symlink push (mode 120000)

Move / rename verification

  • Verify commitBatch behavior
  • Confirm new path exists
  • Confirm old path is removed
  • Validate provider-specific rename semantics

Independent verification

Tests must not only call the service under test to prove success.

Add provider-level verification helpers to check:

  • branch head changes;
  • commit history;
  • file tree state;
  • blob content;
  • symlink mode where applicable.

SyncManager integration (limited v1)

Do not include full Obsidian UI automation in the first PR.

Before adding SyncManager E2E:

  • Introduce or mock only the interaction boundary for confirmation/conflict dialogs.
  • Keep provider services real.

Initial SyncManager coverage:

  • push new file
  • pull remote update

Defer:

  • conflict resolution UI;
  • full pushAll/pullAll flows;
  • rename UI flows;
  • symlink UI flows.

Environment strategy

Local/manual

  • GitHub: disposable sandbox repository + fine-grained token.
  • GitLab: disposable project + project access token.
  • Gitea: pinned Docker image with runtime provisioning.

CI (future / limited)

Initial PR should avoid making GitHub/GitLab secrets required for every PR.

Recommended progression:

  1. local/manual execution;
  2. workflow_dispatch with protected secrets;
  3. optional required checks after stability is proven.

Gitea provisioning

  • Pin Gitea version.
  • Start container.
  • Wait for readiness endpoint.
  • Create admin/test user.
  • Generate access token.
  • Create initialized repository.
  • Execute E2E suite.
  • Destroy environment.

Deferred follow-ups

  • full CI release gating;
  • scheduled API drift checks;
  • large batch stress tests;
  • binary file matrix;
  • provider outage simulation;
  • complete SyncManager E2E coverage.

Non-goals

  • Not retroactively re-testing old changes.
  • Not storing provider credentials in repository secrets for the first implementation.
  • Not replacing existing mocked unit tests.

Implementation plan

Single branch / single PR:

branch: test/real-provider-e2e

Suggested order:

  1. E2E infrastructure + credential handling
  2. GitHub smoke suite (highest risk due GraphQL path)
  3. GitLab smoke suite
  4. Gitea container suite
  5. Independent verification helpers
  6. Minimal SyncManager integration (only if interaction boundary is ready)
  7. Documentation

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions