make-pr: stack on top, or overwrite the branch, decided from the diff - #457
Merged
Conversation
A PR that already exists gets one of two treatments, read off its current diff: stack another commit when its claim still holds and the addition is small, or overwrite the branch when the diff stopped matching the claim -- it carries work already on the base, it mixes review units, or it ships a second claim. The record that gets read later is the final diff and body, so such a branch is rewritten rather than explained in Slice Rationale. Overwriting requires a backup branch and --force-with-lease; a lease failure means another session moved the branch, so re-read it instead of forcing. The choice is mechanical and is not a question for the user. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC Change-Id: I3839f20ff1f27f9375ec7cf84816e23747986b0a
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_e7cb0f94-a767-49ab-8aae-c02d24120787) |
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
Owner
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 6 minutes 47 seconds in the queue, including 5 minutes 38 seconds running CI. Required conditions to merge
|
5 tasks
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
When a PR's diff stops matching its title, the branch gets rewritten rather than explained.
When the title still holds and the addition is small, another commit goes on top instead.
The choice is read off the diff, so nobody has to be asked which they would prefer.
Review Claim
make-prgains a "Stack on top, or overwrite the branch" section that decides from the PR's current diff, with a colocated test pinning both treatments, the three triggers for overwriting, the lease, and the backup branch.Review Lane
behavior
Review Unit
engine-runtime
Safety Invariant
Skill prose and its test only. No script, gate, or hook changes, so nothing that runs today behaves differently; the rule is read by whoever writes the next PR.
Slice Rationale
One rule and its test, on their own. The stale generated docs block this work uncovered ships as its own PR (
plan/skill-triggers-regenerate), because it is a different claim and a different unit.Non-goals
preflight.pyor the PR-body checker.Test Plan
Test Plan
python3 -m unittest discover -s engine/skills/make-pr/tests:Ran 27 tests ... OKcheck_skill_test_coverage.py --base origin/main --head HEAD,check_skills_three_harnesses.py,check_skill_trigger_mechanism.py,check_ecosystem_boundaries.py,check_skill_file_refs.py,check_no_new_comments.py --base origin/main,check_no_dated_provenance.py --base origin/main: all exit 0check_skill_trigger_policy.py: fails withdocs/skill-triggers.md: generated block is stale. It fails the same way on main at329c844, on a clean checkout of main with no changes of mine, so it is not from this PR.plan/skill-triggers-regeneratefixes it; preflight passes once that lands.Revert Plan
Revert Plan
git revert <merge-sha>🤖 Generated with Claude Code
https://claude.ai/code/session_01Gnua5cuAAF1ey1b7zRqJCC
Note
Low Risk
Documentation and a prose-pinning test only; no hooks, scripts, or runtime behavior change.
Overview
The make-pr skill now documents how to handle an existing PR branch when more work is needed: stack on top if the PR claim still matches the diff and the addition is small, or overwrite the branch when the diff no longer matches (duplicate base work, mixed review units, or a second claim). Overwrites require a
backup/pr<number>-<short-sha>ref,--force-with-lease, and a rewritten title/body—not Slice Rationale excuses—and a failed lease means re-read and decide again rather than forcing.A colocated unittest (
test_stack_or_overwrite.py) locks in the section heading, both treatments, the three overwrite triggers, lease/backup requirements, and that the choice is never delegated to the user.Reviewed by Cursor Bugbot for commit a56c15e. Bugbot is set up for automated code reviews on this repo. Configure here.