Skip to content

[local-test-e2e-cli-standalone-address-review-a-2] test(e2e): cli — standalone address-review and resolve-conflicts against an offline GitHub PR fake - #854

Merged
danii1 merged 1 commit into
mainfrom
feature/local-test-e2e-cli-standalone-address-review-a-2
Dec 4, 2026
Merged

danii1 merged 1 commit into
mainfrom
feature/local-test-e2e-cli-standalone-address-review-a-2

Conversation

@danii1

@danii1 danii1 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Why

Task local-test-e2e-cli-standalone-address-review-a-2: test(e2e): cli — standalone address-review and resolve-conflicts against an offline GitHub PR fake

The GitHub paths of standalone address-review and resolve-conflicts were covered only by unit tests. cli.md said GitHub "cannot be faked offline", which is outdated: the fetch preload plus a Git insteadOf rule already do it. The GitLab runs already had offline CLI tests, so GitHub now has matching ones.

What changed

  • providers/fake-github-worker-pulls.ts: new servePull(head, base). It serves a PR that already exists on the bare remote, instead of waiting for a worker's POST /pulls. No second fake was built.
  • helpers/github-standalone-scenario.ts (new): GitHubStandaloneScenario seeds the GitLab fixture repo, sets origin to https://github.com/e2e-org/fixture.git and maps it to the bare remote. It starts the fake and sets up the preload and the deterministic agent. run() runs the built CLI, output() redacts the token, and dispose() releases the fake and the temp dir, each step independently.
  • helpers/gitlab-webhook-scenario.ts: seedRepository and gitRewriteEnv are now exported for reuse.
  • tests/local/cli-address-review-github.test.ts (new): --no-push, a stale --expected-head (exit 5, no agent run or push), a current --expected-head (fast-forward push), and --no-reply.
  • tests/local/cli-resolve-conflicts-github.test.ts (new): a stale --expected-head or --expected-base defers with exit 2 and no agent run or push. --no-push leaves the remote unchanged. Current guards push a merge commit with parents [old head, base tip].
  • docs/coverage/cli.md: updated both rows (evidence, missing, Last reviewed: 2026-12-04), struck through the GitHub half of Backlog Priority 9, and added a Test notes section for the new tests.

Scope

Included: both gaps, GitHub standalone options, with assertions on the fake's request log (writes and unexpected routes), the remote's Git state, and token redaction. Excluded: GitHub --ci-feedback (left in Missing; the GitLab test covers it), the scheduled/disabled worker mode of resolve-conflicts, and any product code change.

Tradeoffs

The GitLab helper's seeding and git rewrite are exported and reused, so the GitHub fixture reuses the GitLab-named module. I accepted that coupling over duplicating about 60 lines.

Observed (assert current behavior, unconfirmed intent):

  • On GitHub, address-review acknowledges an addressed review comment with a hooray reaction (POST /pulls/comments/:id/reactions), not a reply. That reaction is the only write on success. The task text expected a reply, so the tests assert the reaction.
  • A stale --expected-head is asserted by exit code 5 and no agent run or push. The refusal message text is not asserted for GitHub.

Blast Radius

Test-only changes plus two export keywords. servePull is additive, so the worker offline suites that use FakeGitHubWorkerPulls are unaffected: the full suite ran 506 pass, 1 fail, and the one failure (below) is unrelated. The new tests skip if the CLI build is missing, like the other CLI tests. Each takes about 9–13 s.

Verification

  • bun run --filter @getdevintern/code build: not re-run. packages/code/dist/index.js already existed and the tests ran against it.
  • bun run --filter @devintern/e2e test: exit 1. The first full run reported 2 failures; I did not capture their names. A rerun gave 506 pass, 1 fail: worker-doctor.test.ts "offers try-first-task on a ready workspace" (expected service, received run-foreground). It fails the same way when run alone. It looks caused by this sandbox having no service manager, and my changes don't touch the doctor code. I did not re-run it on the base commit, so "pre-existing" is unconfirmed. Both new test files pass.
  • bun run --filter @devintern/e2e typecheck: pass.
  • bun run --filter @devintern/e2e lint: 0 warnings and errors.
  • bun run --filter @devintern/e2e format:check: pass.
  • Repo-wide bun run lint (knip and ratchet): exit 0.

🤖 Opened by DevIntern from local-test-e2e-cli-standalone-address-review-a-2

…st(e2e): cli — standalone address-review and resolve-conflicts against an offline GitHub PR fake
@danii1 danii1 added the devintern-authored Pull request written by DevIntern working its own backlog label Dec 4, 2026
@danii1

danii1 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Artifacts & verification

Run: 1729 · Commit: 5dc0a487319e90c06040d740355d5f7eb10770c0

Verification report

Produced by __verify-1, execution 1 at 5dc0a487319e90c06040d740355d5f7eb10770c0.

Show artifact
{
  "summary": "The implementation meets the task's functional requirements. I ran the two new GitHub test files: 3 tests passed with 60 assertions. e2e typecheck, lint and format:check were clean, and the repo-wide `bun run lint` (knip and the lint ratchet) printed no errors in its tail. The new tests check the fast-forward push, `--no-push`, `--no-reply`, stale and current `--expected-head`, and the resolve-conflicts merge on top of the old head (parents [old head, base tip], so no force push). They also check that the stale head/base defer with exit 2 and no agent run, that the fake saw no unexpected request, and that the token never appears in output. I did not run the full e2e suite or the CLI build; I used the existing `dist/index.js`. The change reuses the existing GitHub fake with a small `servePull` addition and exports two existing helpers from the GitLab scenario. cli.md is updated: stale claims corrected, the Priority 9 GitHub half struck through, and test notes added. Blast radius: the changes outside the new files are two `export` keywords plus one additive `servePull` method, so existing callers are unaffected. GitHub replies are not covered because the product acknowledges comments with a reaction, and `--ci-feedback` on GitHub is not covered and is documented as missing.",
  "items": [
    {
      "priority": "low",
      "confidence": "medium",
      "category": "testing",
      "file": "packages/e2e/tests/local/cli-address-review-github.test.ts",
      "line": "1",
      "issue": "The task asked for a reply on the fake; the test asserts a `hooray` reaction and no reply instead. This matches the product's current behavior and the task allows asserting it, but the fake's reply route is not exercised.",
      "evidence": "The tests assert `reactions` equal `[{kind:'pulls',commentId,content:'hooray'}]` and `workerReplies()` equal `[]`. The 3 tests passed when I ran them.",
      "suggestion": "Optionally mark this in cli.md as 'Observed (unconfirmed intent): GitHub reacts instead of replying'."
    },
    {
      "priority": "low",
      "confidence": "medium",
      "category": "testing",
      "file": "packages/e2e/tests/local/cli-address-review-github.test.ts",
      "line": "1",
      "issue": "GitHub `--ci-feedback` is not covered. The task made it optional, and cli.md lists it under Missing.",
      "evidence": "cli.md Missing line for `address-review`.",
      "suggestion": "Add a test later if the GitHub CI path becomes cheap to fake."
    }
  ],
  "approved": true
}

Auto-review summary

Produced by auto-review, execution 1 at 5dc0a487319e90c06040d740355d5f7eb10770c0.

Show artifact
{
  "iterations": 0,
  "success": true,
  "finalFeedback": {
    "summary": "Test-only PR. It adds two offline GitHub standalone e2e tests, a scenario helper, a small `servePull` method on the fake, and two newly exported helpers from the GitLab scenario. The change is safe because nothing in production code changes. The only changed shared symbols are `gitRewriteEnv` and `seedRepository`, and they only gain an `export` keyword. I confirmed that the preload file `github-api-redirect-preload.cjs` exists and that `prUrl` and `number` are defined on the fake (pointed, not run). I did not run the tests, because they need the built CLI and skip without it.",
    "items": [
      {
        "priority": "low",
        "confidence": "low",
        "category": "testing",
        "file": "packages/e2e/tests/local/cli-resolve-conflicts-github.test.ts",
        "line": "44-100",
        "issue": "The whole scenario (stale guards, --no-push, current guards) is one large test. A failure in an early step hides the later ones. The 300s timeout is also a long wait when it fails. The same applies to the first address-review test. Both tests also chain state, since the --no-push local commit carries into the later runs.",
        "evidence": "unproven (read from the diff only)",
        "suggestion": "Split the steps into separate tests with their own scenarios if the runtime cost is acceptable. Otherwise keep as is, because it mirrors the GitLab tests."
      },
      {
        "priority": "info",
        "confidence": "low",
        "category": "code-quality",
        "file": "packages/e2e/providers/fake-github-worker-pulls.ts",
        "line": "165-171",
        "issue": "`servePull` sets `created` with a hardcoded title and an empty body. The `created` field is presumably what makes the worker-oriented fake start serving the PR, so this is an implicit coupling. If worker logic that keys off `created` later changes, standalone tests could break silently.",
        "evidence": "unproven; I did not read how `created` is consumed beyond the diff",
        "suggestion": "Add a short comment saying `created` gates the PR routes, or add a unit test for `servePull`."
      }
    ],
    "approved": true
  },
  "unresolved": [],
  "stopReason": "approved",
  "commitSha": "5dc0a487319e90c06040d740355d5f7eb10770c0",
  "history": [
    {
      "iteration": 1,
      "feedback": {
        "summary": "Test-only PR. It adds two offline GitHub standalone e2e tests, a scenario helper, a small `servePull` method on the fake, and two newly exported helpers from the GitLab scenario. The change is safe because nothing in production code changes. The only changed shared symbols are `gitRewriteEnv` and `seedRepository`, and they only gain an `export` keyword. I confirmed that the preload file `github-api-redirect-preload.cjs` exists and that `prUrl` and `number` are defined on the fake (pointed, not run). I did not run the tests, because they need the built CLI and skip without it.",
        "items": [
          {
            "priority": "low",
            "confidence": "low",
            "category": "testing",
            "file": "packages/e2e/tests/local/cli-resolve-conflicts-github.test.ts",
            "line": "44-100",
            "issue": "The whole scenario (stale guards, --no-push, current guards) is one large test. A failure in an early step hides the later ones. The 300s timeout is also a long wait when it fails. The same applies to the first address-review test. Both tests also chain state, since the --no-push local commit carries into the later runs.",
            "evidence": "unproven (read from the diff only)",
            "suggestion": "Split the steps into separate tests with their own scenarios if the runtime cost is acceptable. Otherwise keep as is, because it mirrors the GitLab tests."
          },
          {
            "priority": "info",
            "confidence": "low",
            "category": "code-quality",
            "file": "packages/e2e/providers/fake-github-worker-pulls.ts",
            "line": "165-171",
            "issue": "`servePull` sets `created` with a hardcoded title and an empty body. The `created` field is presumably what makes the worker-oriented fake start serving the PR, so this is an implicit coupling. If worker logic that keys off `created` later changes, standalone tests could break silently.",
            "evidence": "unproven; I did not read how `created` is consumed beyond the diff",
            "suggestion": "Add a short comment saying `created` gates the PR routes, or add a unit test for `servePull`."
          }
        ],
        "approved": true
      },
      "addressed": [],
      "commitSha": "5dc0a487319e90c06040d740355d5f7eb10770c0"
    }
  ]
}

@danii1
danii1 merged commit 30feb46 into main Dec 4, 2026
1 check passed
@danii1
danii1 deleted the feature/local-test-e2e-cli-standalone-address-review-a-2 branch December 4, 2026 14:41
@danii1

danii1 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Auto-merge: merged (squash) at 5dc0a48.

Every changed file is inside the workspace's safe paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merged devintern-authored Pull request written by DevIntern working its own backlog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant