Repository navigation
Description
Follow-up of #1520 (PR #1587); from the independent code review. Not a #1520 defect: the new readFirstProvider seam copies the pattern the existing postComment seam set.
Problem
runIssueWithLogging reaches GitHub through optional test seams on IssueExecutionContext (src/lib/workflow/types.ts:985 postComment?, :990 readFirstProvider?). When a caller leaves one unset, batch-executor.ts constructs a live GitHubProvider on the spot: grep -c 'new GitHubProvider()' src/lib/workflow/batch-executor.ts → 6 today (lines 333 and 388 as parameter defaults, 979, 1067, 1071 and 3074 inline). Every runIssueWithLogging test with a qa phase now passes through postReadFirstForPR (:3066); the only thing between a test that forgets the seam and a real gh issue view / gh pr comment against the developer's authenticated gh is the existsSync(worktreePath) check. Today's real-repo integration tests mock runIssueWithLogging, so the exposure is latent. #1506 moved every gh call behind PlatformProvider; this is the remaining way a test can still reach gh by omission.
A harness guard (refuse to post when VITEST is set) is not the fix: it would be a workaround for a construction problem, and the owner's standing rule reads a harness workaround as a bug pointer.
Acceptance Criteria
- AC-1:
batch-executor.tsconstructs noGitHubProviderinline. The provider is one required field of the context (or the services record), set once where the context is built (run-orchestrator.ts/ the CLI entry) and passed down. Evidence:grep -c 'new GitHubProvider()' src/lib/workflow/batch-executor.ts→0(today6) - AC-2: The
postCommentandreadFirstProviderseams are gone or derive from that one provider, and every existing test that set them still passes. Evidence:grep -cE 'postComment\?:|readFirstProvider\?:' src/lib/workflow/types.ts→0(today2), andnpx vitest run src/lib/workflow/batch-executor.test.ts src/lib/workflow/batch-executor.model-ladder.test.ts src/lib/workflow/batch-executor.suppressed.integration.test.ts src/lib/workflow/review-residue.post.test.ts→0 failed - AC-3: A
runIssueWithLoggingcall with no provider is a type error, not a live call. Evidence:npx tsc --noEmit -p tsconfig.json→ exit 0 after the change, and a// @ts-expect-errorline in a test that omits the provider compiles (shows the omission is rejected) - AC-4: Behaviour on a real run is unchanged: the QA verdict comment and the Read-first comment still post. Evidence: one
sequant runon the ad-motion #285 testbed ("(run 7)") shows the verdict comment on the issue andgh pr view "$PR" --json comments --jq '[.comments[].body | select(startswith("## Read first"))] | length'→1
May touch
src/lib/workflow/types.ts, batch-executor.ts, run-orchestrator.ts, the tests that build an IssueExecutionContext, CHANGELOG.
Non-Goals
- Any env-based guard in production code.
- Changing
PlatformProvider's interface (refactor(platform): every gh call goes through PlatformProvider; FakeGitHubProvider replays captured gh output so no test fakes gh through child_process #1506 owns it). - No edits under
plugin/,.claude/skills/,templates/skills/(plugin freeze).
Activity