Skip to content

refactor(workflow): no test seam defaults to a live GitHubProvider — one required provider on the issue context, set once where the context is built #1591

Open

Description

@admarble

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.ts constructs no GitHubProvider inline. 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 (today 6)
  • AC-2: The postComment and readFirstProvider seams 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 (today 2), and npx 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 runIssueWithLogging call 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-error line 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 run on the ad-motion #285 testbed ("(run 7)") shows the verdict comment on the issue and gh 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

Activity

  1. added
    refactor
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions