You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(review-residue): unit tests for the two runner paths — the PR-body SEQUANT_MUTATION merge and resolveReadFirstPR's state-record fallback with its open-PR guard #1588
Follow-up of #1520 (PR #1587); QA 3's two fix_now items.
Problem
Two runner-written paths in the Read-first post have no unit test. Both were exercised only by the testbed runs (ad-motion #290, #291) and by fake-provider cases that never reach them:
deliverReadFirstComment (src/lib/workflow/review-residue.post.ts:190) reads the PR body through provider.fetchIssue(String(prNumber)) and merges its SEQUANT_MUTATION records with this run's exec output (mergeMarkers, :151). No fake PR body in review-residue.post.test.ts carries a marker, so a regression that drops the PR-body source would render mutation record: none on every qa-only re-run and no test would notice.
resolveReadFirstPR (src/lib/workflow/batch-executor.ts:3037) falls back to the state record's PR and posts only when provider.getPRStatus says it is open. The post tests pass services.stateManager: null and a fake whose getPRStatus always answers open, so neither the fallback nor the guard runs under test.
Acceptance Criteria
AC-1: A qa-only run whose fake PR body carries a SEQUANT_MUTATION record renders mutation record: AC-N for the named test file in the posted comment, with no exec output in the run. Evidence: npx vitest run src/lib/workflow/review-residue.post.test.ts -t "PR body" → ≥ 1 passed, 0 failed (new case; today the filter matches 0 of 6 tests)
AC-1 is classified as a gate test by isGateTestEvidence; the PR body carries its SEQUANT_MUTATION record (remove the PR-body source from mergeMarkers's inputs → the new case fails; restore).
AC-2: With no post-QA PR and no early PR, a run whose state record names an open PR posts on it, and a run whose state record names a closed or merged PR posts nothing. The case constructs a real StateManager on a temp dir (or an in-memory one) with a pr record and a fake whose getPRStatus answers each state. Evidence: npx vitest run src/lib/workflow/review-residue.post.test.ts -t "state record" → ≥ 2 passed, 0 failed (new cases; today the filter matches 0 of 6 tests)
AC-2 is classified as a gate test by isGateTestEvidence; the PR body carries its SEQUANT_MUTATION record (remove the status.state === "open" check in resolveReadFirstPR → the closed-PR case fails; restore).
AC-3: The existing six cases still pass and no new test mocks child_process. Evidence: npx vitest run src/lib/workflow/review-residue.post.test.ts → ≥ 9 passed, 0 failed and npm run lint:health → no metric rose above the baseline
May touch
src/lib/workflow/review-residue.post.test.ts (and a small fixture if the PR body is long). No production change is expected; if one is needed to make a seam testable, it stays in review-residue.post.ts or batch-executor.ts's resolveReadFirstPR.
Non-Goals
Changing what the comment renders or where it posts (ADR-0021).
No edits under plugin/, .claude/skills/, templates/skills/ (plugin freeze).
Activity
docs(#1523): HANDOFF.md for graph-2026-10-review-surface — W0 and #1520…