Skip to content

Rerun a Spec: continue where the last Spec run stopped - #197

Merged
JacobStephens2 merged 4 commits into
mainfrom
issue-149
Sep 30, 2026
Merged

JacobStephens2 merged 4 commits into
mainfrom
issue-149

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

Running a Spec again picks up where the last Spec run stopped. Most of this already worked because of earlier Spec-run work and ADR-0002. This PR adds the one missing stop and tests for every rerun case.

 run(issue)
   preflight::check
   tickets = github::tickets(issue)
   selection = branch::select(issue)
+  if selection is Fresh and every Ticket is closed
+    fail "every Ticket is closed and there is no Spec branch; nothing to do"   # exit 1, touches nothing
   check_base_branch / launch.pull / worktree …
   spec_run::run(…)

Help and the README "Spec runs" section now describe rerunning.

Evidence

New tests in tests/spec_run.rs:

  • rerunning_a_failed_spec_run_continues_the_spec_branch_and_the_failed_tickets_issue_branch
  • with_every_ticket_closed_and_a_spec_branch_the_spec_run_goes_straight_to_the_spec_review_of_its_spec_pr
    • The only session is the Spec review, and the existing Spec PR is reused and marked ready.
  • with_every_ticket_closed_and_no_spec_branch_there_is_nothing_to_do
    • Before: it created issue-20, opened a Spec PR and exited 0.
    • After: it prints the "nothing to do" message and exits 1, with no branch, no PR, no session and the Spec left open.

cargo test passes in full (all 24 test binaries).

Merge Danger

Door: two-way

Blast Radius: narrow

The new stop only applies to an issue with sub-issues, all closed, whose Issue branch selection is Fresh. Ordinary Runs and Spec runs with open Tickets are unchanged.

Unaddressed findings

Standards

  • Guard lives in run::run rather than spec_run (possible Feature Envy). It needs the branch Selection and has to run before any work, next to the existing parallel check that does the same. A single spec-run pre-work check can come later if more of these appear.
  • The nothing-to-do message doesn't name the issue, unlike the nearby parallel rejection. Issue Rerunning a Spec #149 fixes the exact wording.
  • Hard-coded Spec PR URL and positional calls[2] in the rerun test. The file's other tests already rely on the fake's PR numbering and session order.

Spec

  • A Spec branch whose earlier Spec PR was closed or merged counts as "no Spec branch". Per ADR-0002, a merged or closed PR means that branch is finished and is not continued. With every Ticket closed, stopping is the right outcome: the Spec was done, or its Spec PR was rejected, and ADR-0006 says a rejection means reopening Tickets by hand.
  • The Run notification is still sent for the nothing-to-do stop when asked for. This matches every other rejection before any work (e.g. parallel on a non-Spec). "Touching nothing" refers to the repository and GitHub.
  • A failed Ticket's Continuation keeps its old PR's base if the Spec moved to a numbered Spec branch. This predates this change, and the case needs the same closed or merged Spec PR as above.

Closes #149

🤖 Generated with Claude Code

JacobStephens2 and others added 4 commits September 30, 2026 18:43
A Spec whose Tickets are all closed and has no Spec branch stops with
nothing to do, touching nothing. Tests cover a rerun after a Failed spec
run, and going straight to the Spec review with every Ticket closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit cc47944 into main Sep 30, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-149 branch September 30, 2026 19:01
@JacobStephens2 JacobStephens2 mentioned this pull request Sep 30, 2026
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.

Rerunning a Spec

1 participant