Skip to content

fix(#920): phase-restricted runs without an implementing phase must skip PR creation - #924

Merged
admarble merged 2 commits into
mainfrom
feature/920-fix-run-phase-restricted-runs-without-an-imple
Aug 9, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/920-fix-run-phase-restricted-runs-without-an-imple

Conversation

@admarble

@admarble admarble commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Pre-PR AC Verification

AC Description Status Evidence
AC-1 Zero-commit run skips PR, reports success ✅ Implemented batch-executor.ts PR gate; batch-executor.test.ts "AC-1/AC-5"
AC-2 Skip is visible, not silent ✅ Implemented log() line in batch-executor.ts; IssueSummary.prSkippedReason rendered in run-renderer.ts; tests in batch-executor.test.ts, run-display.test.ts, run-renderer.test.ts
AC-3 Exec zero-commit regression unchanged ✅ Implemented (untouched) phase-executor.ts exec guard not modified; existing tests at phase-executor.test.ts:2225 still pass
AC-4 qa-only/resume with commits still creates PR ✅ Implemented batch-executor.test.ts "AC-4"
AC-5 CI sequant:spec-only label inherits gate ✅ Implemented Same gate, no CI-specific code needed since triggers.ts never sets noPr; batch-executor.test.ts "AC-1/AC-5"
AC-6 Failed PR creation yields concrete failureCategory ✅ Implemented New pr_creation category; batch-executor.test.ts "AC-6"
AC-7 --no-pr semantics unchanged ✅ Implemented batch-executor.test.ts "AC-7"
AC-8 Custom base branches respected ✅ Implemented hasExecChanges internally uses resolveBaseRef (#537-aware); batch-executor.test.ts "AC-8"

Test plan

  • npm run build passes
  • npm run lint passes (0 warnings)
  • Full test suite: 5275 tests, 1 pre-existing failure fixed (hardcoded ERROR_CATEGORIES length in __tests__/error-capture.test.ts), rest pass
  • Mutation-verified: reverting the batch-executor gate fails exactly AC-1/AC-5/AC-2/AC-8 tests; reverting the renderer's skip-note extras fails exactly the "shows the skip note" test (both restored after verification)

Closes #920

🤖 Generated with Claude Code

…R creation instead of failing

The worktree and branch are provisioned unconditionally of which phases
run, so a clean spec-only pass (`--phases spec`, or the CI `sequant:spec-only`
label) satisfied every conjunct of the PR-creation gate with zero commits —
`gh pr create` then failed with GitHub's correct-but-unhelpful "No commits
between main and …", and #879 folds that into a run failure for work that
landed exactly where it was supposed to (the plan comment).

Gate on evidence instead of the phase list: reuse `hasExecChanges` (the
#537-aware, fail-open commits-ahead check `classifyExecChanges` already
uses for the exec zero-diff guard) before attempting a PR. Zero commits
skips PR creation with a stated reason, both logged and carried into the
run summary; a branch that does have commits — including a qa-only
resume — is unaffected. Also closes the #879 metrics residual: a PR
creation failure now yields the new `pr_creation` failureCategory instead
of an empty one.

Mutation-verified: reverting the batch-executor gate fails exactly the
AC-1/AC-5/AC-2/AC-8 tests (others unaffected); reverting the renderer's
skip-note extras fails exactly the "shows the skip note" test.
Two gaps noted in QA review, both pre-existing before this PR touched
the category enums:

- run-log-schema.ts's ErrorContextSchema.category was never tested at
  all (not just for pr_creation) — add round-trip coverage for every
  ERROR_CATEGORIES value plus an invalid-value rejection.
- error-classifier.ts has no dedicated test file; its pr_creation
  addition was only asserted as array membership. Add the missing
  invariant: classifyError/errorTypeToCategory must never themselves
  produce pr_creation, since it's assigned only at the batch-executor
  call site where a failed PR creation has no failing phase's stderr
  to classify.

Mutation-verified both: removing pr_creation from the schema enum
throws on parse (also breaks the TS build via batch-executor.ts's
existing type coupling to the enum); making errorTypeToCategory's
default case return pr_creation fails exactly the new invariant test.
@admarble
admarble merged commit 767dc61 into main Aug 9, 2026
5 checks passed
@admarble
admarble deleted the feature/920-fix-run-phase-restricted-runs-without-an-imple branch August 9, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(run): phase-restricted runs without an implementing phase must skip PR creation — spec-only batches always report failed

1 participant