Skip to content

Accept an identical squash tree as merge proof for pruning - #182

Closed
BunsDev wants to merge 1 commit into
mainfrom
squash-tree-proof
Closed

BunsDev wants to merge 1 commit into
mainfrom
squash-tree-proof

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Why

proof() refused any branch with a merge commit between its base and tip. A branch that merged main in before landing could never be proven merged, even when its tip was exactly the snapshot GitHub committed. The 2026-10-12 audit found 9 such branches, each with a tip tree identical to its squash commit. One is worktree-hygiene (#171), the only released worktree, stuck at not-proven-merged.

What

  • scripts/lib/worktree-maintenance.mjs: after the existing checks (closed and merged PR; same repository, branch and exact tip; default base; squash commit still on the default branch; single parent), the proof also accepts a squash commit whose tree equals the tip's tree. That covers every path, mode, blob and gitlink. It returns { kind: 'squash-tree', pull, mergeCommit, tree, defaultHead }, which the recovery manifest records. A different tree falls through to the binary-diff rule, which is unchanged. The final check before ref deletion calls the same proof().
  • docs/worktree-hygiene.md and docs/status.md describe the rule.

Verification

  • New tests: a branch carrying a merge commit, squash-merged at its tip, is eligible, removed, and archived with proof squash-tree. The same shape is kept when the PR head is wrong, the base is wrong, or the landed tree differs. The acceptance test failed (not-proven-merged) before the change.
  • node --test scripts/test/*.test.mjs on Node 24.18.0: 79 of 79 pass.
  • Read-only scripts/worktree.sh audit against the real repository, run from this branch: worktree-hygiene moves from not-proven-merged to eligible with squash-tree Enforce recoverable local worktree and branch pruning #171 (42223e2). No other row changed because of the rule. Nothing was pruned.
  • Not run locally: npm run build && npm test. The disk had about 600 MB free, so I didn't install workspace dependencies. No workspace package changed; the required macOS job runs both.

Notes

  • The installed daily job runs a checksum-pinned copy of the tool. It keeps the old proof until scripts/worktree.sh schedule install is rerun from merged code.
  • Locally, the test default external observers use the pinned executable paths fails when node lives under a path with a space (Cave's toolchain under Application Support). The shebang can't hold the space, so spawn reports ENOENT. Unchanged main behaves the same; CI is unaffected.

✨ Co-authored by Cody, a Coven familiar for Val

Pruning refused any branch with a merge commit between its base and tip,
so a branch that merged main in before landing could never be proven
merged, even when its tip was exactly the snapshot that landed. The
2026-10-12 audit found 9 such branches, including worktree-hygiene (#171).

proof() now also accepts a merged PR with the same repository, branch,
tip and default base whose single-parent squash commit is still on the
default branch and has the same tree as the tip: every path, mode, blob
and gitlink. All existing identity checks run first, and a different tree
falls through to the unchanged binary-diff rule.

Tests: a branch with a merge commit whose tip tree matches the squash is
eligible, removed and archived with proof kind squash-tree. The same shape
with a wrong head, wrong base or different landed tree is preserved. All
79 worktree tests pass on Node 24. Against the real repository the
read-only audit now marks worktree-hygiene eligible (squash-tree, #171).

Co-Authored-By: Cody <[email protected]>
Coven-Familiar: cody
Coven-Harness: claude-code / claude-opus-5-5
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 12, 2026 7:10am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 9dc44b49 Deployed Oct 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant