From 1d2d9a924acea524884faa4c8471ff41faa5d010 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 9 Mar 2026 09:32:35 +0100 Subject: [PATCH 1/4] docs: Add collection branch safety warnings to PR workflow Add explicit warnings to pr.mdc and create-java-pr skill that the collection branch must never be manually merged or fast-forwarded. Updating it causes GitHub to auto-merge all stack PRs and delete their branches, destroying the entire stack. Co-Authored-By: Claude --- .claude/skills/create-java-pr/SKILL.md | 2 ++ .cursor/rules/pr.mdc | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index b0fc12a5d2..9a0bf71eec 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -35,6 +35,8 @@ Derive the branch name from the changes being made. Use `feat/`, `fix/`, `ref/`, **For stacked PRs:** For the first PR in a new stack, first create and push the collection branch (see `.cursor/rules/pr.mdc` § "Creating the Collection Branch"), then branch the PR off it. For subsequent PRs, branch off the previous stack branch. Use the naming conventions from `.cursor/rules/pr.mdc` § "Branch Naming". +**CRITICAL: Never merge, fast-forward, or push commits into the collection branch.** It stays at its initial position until the user merges stack PRs through GitHub. Updating it will auto-merge and destroy the entire PR stack. + ## Step 2: Format Code and Regenerate API Files ```bash diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index 3b8f73194b..d1926a640f 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -185,6 +185,8 @@ git push -u origin HEAD gh pr create --base main --draft --title "(): " --body "Collection PR for the stack. Squash-merge this once all stack PRs are merged." ``` +**CRITICAL: Do NOT manually update the collection branch.** Never merge, fast-forward, or push stack branch commits into the collection branch. The collection branch stays at its initial position (the empty commit on `main`) until the user merges individual stack PRs into it one by one through GitHub. If you fast-forward the collection branch to include stack commits, GitHub will auto-merge and delete all stack PR branches, destroying the entire stack. + ### Creating a New Stacked PR 1. Start from the tip of the previous stack branch (or the collection branch for the first PR). @@ -237,12 +239,12 @@ Once all stack PRs are merged into the collection branch, the collection PR is * ### Syncing the Stack -When a base PR changes (e.g. after addressing review feedback on PR 1), merge the changes forward through the stack: +When a base PR changes (e.g. after addressing review feedback on PR 1), merge the changes forward through the stack **between adjacent stack PR branches only**: ```bash # On the branch for PR 2 git checkout feat/scope-attributes-logger -git merge feat/scope-attributes +git merge feat/scope-attributes-api git push # On the branch for PR 3 @@ -251,4 +253,6 @@ git merge feat/scope-attributes-logger git push ``` +**Never merge into the collection branch.** Syncing only happens between stack PR branches. The collection branch is untouched until the user merges PRs through GitHub. + Prefer merge over rebase — it preserves commit history, doesn't invalidate existing review comments, and avoids the need for force-pushing. Only rebase if explicitly requested. From 51e19abb852629506000bfb070be58fdfdf3cedb Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 9 Mar 2026 12:32:41 +0100 Subject: [PATCH 2/4] docs: Include collection branch PR in stack list updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stack list update instructions only mentioned "all PRs in the stack" which was ambiguous — it could be read as excluding the collection branch PR. Now both pr.mdc and the create-java-pr skill explicitly call out that the collection branch PR must also be updated with the stack list. Co-Authored-By: Claude --- .claude/skills/create-java-pr/SKILL.md | 2 +- .cursor/rules/pr.mdc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index 9a0bf71eec..fc5a990a9d 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -120,7 +120,7 @@ Then continue to Step 5.5 (stacked PRs only) or Step 6. Skip this step for standalone PRs. -After creating the PR, update the PR description on **every other PR in the stack** so all PRs have the same up-to-date stack list. Follow the format and commands in `.cursor/rules/pr.mdc` § "Stack List in PR Description". +After creating the PR, update the PR description on **every other PR in the stack — including the collection branch PR** — so all PRs have the same up-to-date stack list. Follow the format and commands in `.cursor/rules/pr.mdc` § "Stack List in PR Description". ## Step 6: Update Changelog diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index d1926a640f..26024affb5 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -199,7 +199,7 @@ gh pr create --base main --draft --title "(): " --body "Coll ### Stack List in PR Description -Every PR in the stack must have a stack list **at the top of its description** (before the `## :scroll: Description` section). When a new PR is added, update the description on **all** PRs in the stack. +Every PR in the stack — **including the collection branch PR** — must have a stack list **at the top of its description** (before the `## :scroll: Description` section). When a new PR is added, update the description on **all** PRs in the stack and on the collection branch PR. Format: From c47d502f2f4b6f51a5efcae0e6a72957c09c0ae6 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 9 Mar 2026 12:39:53 +0100 Subject: [PATCH 3/4] docs: Add merge commit reminder to stack PR descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stack PRs must be merged with merge commits, not squash. Add a reminder to the PR description so reviewers/mergers pick the right method. This only applies to stack PRs — not standalone PRs or the collection branch PR. Co-Authored-By: Claude --- .claude/skills/create-java-pr/SKILL.md | 1 + .cursor/rules/pr.mdc | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index fc5a990a9d..cb2618e647 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -113,6 +113,7 @@ Fill in each section based on the changes being PR'd. Check any checklist items - Pass `--base ` so the PR targets the previous branch (first PR in a stack targets the collection branch). - Use the stacked PR title format: `(): [ ] ` (see `.cursor/rules/pr.mdc` § "PR Title Naming"). - Include the stack list at the top of the PR body, before the `## :scroll: Description` section (see `.cursor/rules/pr.mdc` § "Stack List in PR Description" for the format). +- Add a merge method reminder at the very end of the PR body (see `.cursor/rules/pr.mdc` § "Stack List in PR Description" for the exact text). This only applies to stack PRs, not the collection branch PR. Then continue to Step 5.5 (stacked PRs only) or Step 6. diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index 26024affb5..df35ee3b94 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -215,6 +215,14 @@ Format: No status column — GitHub already shows that. The `---` separates the stack list from the rest of the PR description. +**Merge method reminder:** On stack PRs (not the collection branch PR), add the following line at the very end of the PR description: + +```markdown +> ⚠️ **Merge this PR using a merge commit** (not squash). Only the collection branch is squash-merged into main. +``` + +This does not apply to standalone PRs or the collection branch PR. + To update the PR description, use `--body-file` to avoid shell quoting issues with special characters in the body: ```bash From b9a823e3585bc5008413075f105a3f225e4e5425 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 9 Mar 2026 15:26:50 +0100 Subject: [PATCH 4/4] ci: Trigger CI checks