land-stack: check a PR is not superseded before rebasing it - #455
Merged
EdbertChan merged 2 commits intoSep 12, 2026
Conversation
…y landed A branch behind its base still lists differing files, and that list does not say which side is newer. scripts/check_branch_not_superseded.py reads the direction and prints LIVE (exit 0), SUPERSEDED (exit 3) or UNCHECKED (exit 2). It only reads git state. Carved out of #375 onto current main. The exemplars move from GATE_EXEMPLARS/gate_check to the PROMISED_CATCH/PROMISED_ALLOW/ flags_exemplar contract that main's docstring meta-gate now requires. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC Change-Id: Id11ddf24d24facf8805295adfbe28d5687becdf5
Step 2 now runs scripts/check_branch_not_superseded.py before any rebase or conflict fix. LIVE goes on; SUPERSEDED closes the PR instead of rebasing it over newer work; UNCHECKED is fixed and rerun, never read as LIVE. The check sits inside step 2 rather than as a new step 3, so the step numbers the playbook-router fixture and tests/test_install.py pin stay put and this slice touches only product/skills/land-stack. Carved out of #375 and stacked on the gate it runs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC Change-Id: I91527ae753cc84fe92c8b03088b2cc06740f5ccf
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_236131cd-5e4c-47bb-a2c8-41cfa4dcdccf) |
EdbertChan
changed the base branch from
plan/gate-a-pr-that-is-net-behind-its-base-is-superseded-not-salvageable
to
main
September 12, 2026 06:14
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
Before land-stack rebases a PR or fixes its conflicts, it now runs a check that says whether the PR's work already landed.
If it did, the PR is closed instead of rebased, so newer work is not undone.
Review Claim
land-stack step 2 runs
scripts/check_branch_not_superseded.pybefore any rebase or conflict fix: LIVE goes on, SUPERSEDED closes the PR, UNCHECKED is fixed and rerun.Review Lane
behavior
Review Unit
product-skill
Safety Invariant
Only the skill's instructions and their test change. The step runs a check that only reads git state, and the step numbers stay 1 to 4.
Slice Rationale
This PR reads the check added by the PR below it, so it stacks on that one.
The check sits inside step 2 instead of a new step 3. A new step would renumber the later steps, and a router test fixture under
engine/pins those numbers, which would mix two review units in one PR.Non-goals
tests/test_install.pyare untouched.Test Plan
Test Plan
python3 -m unittest discover -s product/skills/land-stack/tests:Ran 21 tests ... OKpython3 -m unittest discover -s engine/hooks/playbook-router/tests:Ran 29 tests ... OKpython3 -m unittest tests.test_install.TestSkillSymlinks.test_playbook_router_linked_and_prompt_hook_wired_for_claude:OKpython3 engine/skills/make-pr/scripts/preflight.py --base <the check's branch>:declare Review Unit: product-skill,ok preflight passedRevert Plan
Revert Plan
git revert <merge-sha>🤖 Generated with Claude Code
https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC
Note
Low Risk
Only land-stack skill instructions and documentation tests change; the new step invokes an existing read-only git gate and does not alter merge/queue behavior.
Overview
land-stack step 2 now requires running
scripts/check_branch_not_superseded.pyon each PR afterverify_stack.pyand before any rebase or conflict resolution, still without adding a new numbered step.The skill documents
git fetch, the path via the skill symlink into catstack, and how to interpret exits: LIVE (0) continues, SUPERSEDED (3) means close the PR with a comment instead of rebasing, UNCHECKED (2+) must be fixed and rerun and must not be treated as LIVE.A new unittest module locks that prose to the repo: gate script location, ordering between verify and land-bottom-up,
EXIT_CODESparity with the gate module, close-not-rebase for superseded, and the fail-closed rule for unchecked.Reviewed by Cursor Bugbot for commit b013159. Bugbot is set up for automated code reviews on this repo. Configure here.