Commit 4aeda1d
Two corrections to `git-hazards.md`, both earned in a session that
recovered an auto-closed PR (laurigates/claude-plugins#2049).
## Hazard #1 — the "immune to drift" claim was wrong
It claimed `git merge-tree --write-tree` containment is *"immune to
squash + drift"*. The squash half is right; **the drift half is not.**
Once `main` moves on over the same files, merging an already-merged
branch back would re-introduce its older versions, so the trees differ
and merge-tree reports **not contained** for work that fully landed. It
misreported three merged branches as unmerged during the audit.
Fixed by reordering the checks by real authority and adding `git
cherry`:
| Check | Strength |
|---|---|
| `gh pr list --state all --head <branch>` | **Authoritative** — a
MERGED PR settles it |
| `git cherry main <branch>` | Marks `-` on patch-equivalent commits —
survives squash **and** cherry-pick, ignores drift |
| `git merge-tree` containment | A match proves containment; **a
non-match proves nothing** |
## Hazard #3 — the auto-close is silent, and only a sweep finds it
No failed check, no notification; the PR list just looks one shorter.
#2049 sat stranded for a day, and the sweep afterwards found **26 dead
branches** — two carrying work that never had a PR opened *at all*.
An event handler on `pull_request: closed` cannot cover this: by the
time it fires the base ref is deleted (the reopen window is gone), and
it is structurally blind to never-PR'd branches. A scheduled sweep is
the only thing that works — `claude-plugins
scripts/check-stranded-work.sh` (laurigates/claude-plugins#2056).
Also records the **accident-vs-decision discriminator**: a
closed-unmerged PR whose base ref **404s** was auto-closed; one whose
base ref is **alive** was closed by a human. 11 of the 26 were
deliberate closes and must not be resurrected.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Ap1qbGLEkvv1gaG5hSasps
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 01753cc commit 4aeda1d
1 file changed
Lines changed: 28 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
19 | 31 | | |
20 | 32 | | |
21 | 33 | | |
| |||
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
48 | 73 | | |
49 | 74 | | |
50 | 75 | | |
| |||
0 commit comments