Repository navigation
Stop a Spec run whose Spec PR closes under it (#1471) - #1492
Merged
Merged
Conversation
Before each Ticket starts, and whenever the Tickets checklist is written, Ticket accounting reobserves the captured Spec PR. One that is closed, merged or retargeted away from the Base branch chosen at pickup is now SpecPrChanged: no further Ticket starts, the cause names the Spec PR, and the Recovery leaves out the command that would resume its Spec branch.
A Ticket the Spec run starts after capturing its Spec PR is given that PR's number and the Spec run's Base branch. Its Self-merge into the Spec branch reobserves the Spec PR first, so a Ticket already running when the Spec PR is closed, merged or retargeted fails instead of merging. A Spec PR change found after another error is now the Spec run's cause, so its Recovery still leaves out the command.
A Ticket's Delivery hands the Spec PR it checks on to the Base fix it starts into the Spec branch, so that merge is held too. The Spec PR's ownership check is shared with PR capture, and the Spec run takes a started Ticket's Spec PR from its own Spec PR owner.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A Spec PR closed, merged or retargeted while its Spec run is working through Tickets now stops the Ticket loop. The Spec run used to log a warning and keep going.
Cause line:
the Spec PR <url> was closed under this Spec run(ormerged, orretargeted from <base> to <other>).Confirmed cause.
PullRequest::show_checklistrouted every checklist failure throughwarn_checklist, including the identity gate'sPR … is closed, not open. So after the Day shift closed the Spec PR,run_ready_ticketskept starting the Tickets that became startable. Their child Runs Self-merged into the abandoned Spec branch, because nothing in a child Run looked at the Spec PR. The Spec run failed only when the next landing's gate rejected the PR. Its Recovery then printed the command that continues the Spec branch (ADR-0002).GLOSSARY (Spec PR, Recovery),
docs/guide.md(Failed spec run section) and the regeneratedsite/docs/,site/how-it-works/anddocs/code-navigation.mddescribe the new behaviour.Evidence
Reproduction:
cargo test --test spec_run issue_1471. Spec #20 has Tickets #21, then #22 and #23, both blocked by #21, run withparallel 1. #21 lands and opens the Spec PR; #22's session closes the Spec PR and fails.Before (at f842c85): Headless sessions leave smoke-test files in /tmp #23 was started anyway, Self-merged and closed. The Spec run then failed with the generic gate error and printed
Recovery: thirdshift https://github.com/acme/widgets/issues/20 --no-merge parallel 1 ….After:
issue_1471_a_spec_pr_closed_mid_run_starts_no_further_ticket ... ok. Only Numbered Issue branches after a merged or closed PR #21 and CI watching, CI-fix Repair and the Repair cap #22 have sessions, Headless sessions leave smoke-test files in /tmp #23 has no PR and stays open, and stderr endsthe Spec PR https://github.com/acme/widgets/pull/2 was closed under this Spec runwith nothirdshift: Recovery:line.Before (with the child wiring removed): a Ticket already running when its session closes the Spec PR Self-merged anyway.
After: it passes. CI watching, CI-fix Repair and the Repair cap #22's PR is not merged, issue CI watching, CI-fix Repair and the Repair cap #22 stays open, and both CI watching, CI-fix Repair and the Repair cap #22 and the Spec run say the Spec PR
was closed under this Spec run.Before (with the Base fix wiring removed):
issue_1471_a_base_fix_into_the_spec_branch_is_not_self_merged_once_the_spec_pr_closesFAILED, because the Base fix Headless sessions leave smoke-test files in /tmp #23 intoissue-20wasMERGED. After: it passes.Before:
spec_run::tests::a_spec_pr_closed_after_an_earlier_error_is_still_the_causepanicked withcould not wait for #21. After: it passes. Further unit tests:pull_request::tests::a_spec_pr_changed_under_accounting_fails_the_checklist_and_the_ticket_start_checkpull_request::tests::a_tickets_self_merge_waits_on_its_spec_pr_still_open_into_the_spec_runs_baserecovery::tests::a_spec_pr_changed_under_the_spec_run_leaves_out_every_command_linechild_runhidden-argument round trip, now with--spec-prFull run:
cargo test --no-fail-fast -- --skip sandbox::tests: 3092 passed and 21 failed. All 21 are intests/trial.rs(15),tests/scoring.rs(3),tests/bug_origins.rs(2) andtests/experiments.rs(1), and the same tests fail at the base commit f842c85 on this host. Most reportsandbox failed to start: socat is not on PATH; there were no failures unique to this branch.npm test --prefix site: 51 passed.cargo clippy --all-targets: clean.scripts/affected-tests mainran the same suite. Its only failures were the 22sandbox::tests, which needsocat, and this host doesn't have it (sandbox failed to start: socat is not on PATH). None of them touches this change.Merge Danger
Door: two-way
Revert restores the old warn-and-continue behaviour. No stored data or GitHub state changes shape. The new
--spec-prhidden argument passes only between a parent and a child of the same binary.Blast Radius: Spec runs
A Spec run now fails sooner, without a Recovery command, when its Spec PR is closed, merged or retargeted. A transient failure to read the Spec PR before a Ticket starts only warns. A Ticket's Self-merge, by contrast, is held by any failure to read its Spec PR, and that Ticket ends as a Failed ticket run with its PR drafted. Two checklist-test expectations changed to the new cause wording, and
successful_ticket_completion_with_an_invalid_spec_pr_starts_no_reviewnow expects #22 to fail rather than land.Unaddressed findings
Standards
ready-for-human), and an ADR should follow that decision.validate(the part that still stands). Declined.validate's Delivery messages andAlreadyMergedare Delivery's contract, whichspec_delivery_rejects_late_retargeting_and_keeps_the_original_identityasserts (PR targets develop, not main). Accounting and the Self-merge check share one classifier,SpecPrChange::of, so the duplication left is between two scopes with different outcomes.SpecPrlives insrc/child_run.rs. Declined. It is the payload ofKind::Ticket/Kind::BaseFixand of their hidden--spec-prargument, whichsrc/child_run.rsalone writes and reads.pull_request.rsconsumes it as it consumesChoice. The code-navigation half of this finding is fixed.a_spec_pr_closed_after_an_earlier_error_is_still_the_causeclose the Spec PR after an earlier error, a placement that counting starts cannot express. Each use comments the call order.a_spec_pr_closed_after_an_earlier_error_is_still_the_causecloses it after a wait error, failed before the fix (could not wait for #21) and passes after.Spec
A Ticket started before the first landing opened the Spec PR still Self-merges after the PR closes. Declined: the Day shift must decide, and the open issue Stop a Spec run when its Spec PR is closed or retargeted mid-Run #1469 covers it. I ran the reviewer's test (
issue_1471_a_ticket_started_before_the_spec_pr_opened_is_not_self_merged_after_it_closes, Tickets Numbered Issue branches after a merged or closed PR #21 and CI watching, CI-fix Repair and the Repair cap #22 withparallel 2): it fails, because CI watching, CI-fix Repair and the Repair cap #22's PR isMERGED. Such a Ticket has no Spec PR to check, and it cannot learn of one after it starts. Fixing that needs one of three decisions:resume_specdeliberately lets a rerun replace) from one closed during it.Stop a Spec run when its Spec PR is closed or retargeted mid-Run #1469 lists "Whether a Ticket run that is already in flight finishes or gets abandoned" as a policy call for the Day shift. The guide states the limit: "A Ticket started before the first landing opened the Spec PR has nothing to check and Self-merges as before."
Security review outcome
No unaddressed introduced findings.
Review coverage
Both review axes read every file in their changed-file lists.
site/docs/index.htmlis generated output, intentionally not read: it was regenerated fromdocs/guide.md,node generate-docs.mjs --checkexits 0, and both reviewers inspected its one-paragraph diff. Two files changed after the review's follow-up pass and no reviewer read them:src/delivery.rs(the Base fix wiring line) anddocs/code-navigation.md(the Spec PR row). Later hunks in already-reviewed files (src/base_fix.rs,src/child_run.rs,src/pull_request.rs,src/run.rs,src/spec_run.rs,tests/spec_run.rs,GLOSSARY.md,docs/guide.md) were not re-reviewed either.Closes #1471
Built with claude 2.1.312 · claude-opus-5-5 · high