Skip to content

make-pr: stack on top, or overwrite the branch, decided from the diff - #457

Merged
mergify[bot] merged 1 commit into
mainfrom
plan/make-pr-stack-or-overwrite
Sep 12, 2026
Merged

make-pr: stack on top, or overwrite the branch, decided from the diff#457
mergify[bot] merged 1 commit into
mainfrom
plan/make-pr-stack-or-overwrite

Conversation

@EdbertChan

@EdbertChan EdbertChan commented Sep 12, 2026

Copy link
Copy Markdown
Owner

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-pr gains 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

  • No new gate: deciding whether a diff still matches a claim needs judgment, so no script enforces this.
  • No change to preflight.py or the PR-body checker.
  • No change to the review-unit table or the stacking rule above it.

Test Plan

Test Plan
  • python3 -m unittest discover -s engine/skills/make-pr/tests: Ran 27 tests ... OK
  • check_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 0
  • check_skill_trigger_policy.py: fails with docs/skill-triggers.md: generated block is stale. It fails the same way on main at 329c844, on a clean checkout of main with no changes of mine, so it is not from this PR. plan/skill-triggers-regenerate fixes it; preflight passes once that lands.

Revert Plan

Revert Plan
  • Safe to revert? Yes. Prose and a test.
  • Revert command: git revert <merge-sha>
  • Post-revert steps: None.
  • Data migration? No

🤖 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.

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
@cursor

cursor Bot commented Sep 12, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@mergify

mergify Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@EdbertChan

Copy link
Copy Markdown
Owner Author

@Mergifyio queue

@mergify

mergify Bot commented Sep 12, 2026

Copy link
Copy Markdown
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
  • check-success = lint
  • check-success = test

@mergify mergify Bot added the queued label Sep 12, 2026
@mergify
mergify Bot merged commit 10884a3 into main Sep 12, 2026
4 checks passed
@mergify mergify Bot removed the queued label Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant