Skip to content

v0.1.12 — gh-auth host scoping, hook section grading, clean --all-roots

Choose a tag to compare

@eharriett0 eharriett0 released this 25 Aug 03:40
· 72 commits to main since this release
c1b8290

Closes every open issue: #98, #100, #101, #102, #104.

The one that was silently breaking things — #100 / #102 / #104

ghx.Authed() ran bare gh auth status and read the aggregate exit code, which is non-zero if any configured host fails. One unreachable extra host — an enterprise instance behind a VPN, a stale entry — made wt believe gh was unusable on a machine whose github.com login was perfectly fine.

It was reported twice as a cosmetic doctor warning. It was not cosmetic. Every gh-backed path opens with if !Present() || !Authed() { return nil }, so the false negative fans out silently:

  • merge-pr hard-refused merges (#104). PRClosingIssueNumbers returned nil before issuing its GraphQL query, so the close-keyword guard compared against an empty set, decided every commit-body closure was undeclared, and blocked. The API said the issue was registered; wt had simply never asked.
  • PRForBranch degrades the same way, and it feeds liveness classification — so stale-branch verdicts can change on such a machine.

Now scoped to the host derived from origin, which also fixes the mirror-image false negative: an enterprise-hosted repo used to pass because github.com happened to be authed, while the host it actually needs was not. When the scoped check passes and some other host is failing, wt stays silent — that host is not wt's business.

#98 — the hooks were not applying the structured-doc section grade

structured_doc exists to catch one thing: two windows editing the same lane of a hand-merged doc. The hooks stopped at the blanket shared-doc advisory, so that case blocked in wt check and sailed through the pre-push guard — breaking the invariant that the hook block predicate must equal wt check.

Two windows, same section, disjoint lines (so only a section grade can block):

wt check pre-push hook
v0.1.11 💥 HIGH, exit 3 📝 advisory — not blocking
v0.1.12 💥 HIGH, exit 3 💥 blocks, exit 1

Disjoint sections stay advisory in both, so this does not simply widen blocking. Grading is single-sourced in collide.SharedSectionsAcross.

#101 — wt clean --all-roots

The collision engine scans every worktree git knows about; clean managed only those under worktree_root. The difference is a set of worktrees authoritative enough to hard-block a push and out of scope for the command whose job is removing worktrees that no longer matter — and they never age out, because dormant suppression is gated on max_age, unset without a .wt.conf. A repo whose worktree_root ever changed accumulates them permanently.

--all-roots opts into managing them; the default refusal now names the path and says what to run. Every data-loss guard still applies. Suppressing them in the engine instead would have been the wrong direction — an out-of-root worktree is still a live window, and a false negative there is worse than the noise.

⚠ A data-loss footgun found while smoke-testing that fix

Running --all-roots against a repo with 18 legacy worktrees surfaced one checked out on the base branch. Because "patch-equivalent on base" is trivially true for the base itself, clean graded it shipped and printed:

git worktree remove …/<worktree> && git branch -D main

It was latent only because such worktrees sat outside worktree_root and were never evaluated — the old narrowness was hiding it by accident, not by design, and --all-roots would have armed it. Guarded by ReapableBranch, with a defense-in-depth refusal in remove() so wt release --clean is covered too.

If you are on v0.1.11 or earlier, do not hand-run a git branch -D that wt clean prints for you.

The general lesson is now an invariant in CLAUDE.md: widening a blast radius means re-deriving which guards were load-bearing by luck.

Testing

Table tests for every new pure decision — hostFromRemoteURL, authStatusArgs, ManagedByClean, ReapableBranch, and the structured-doc grade. Each was verified to fail against pre-fix code, not merely to pass: the cases asserting new behaviour fail on the previous commit while the cases asserting preserved behaviour pass on both, which is what makes them discriminating rather than decorative.

Two e2e smokes against real binaries: the doctor line flipping ⚠→✓ on a genuine two-host machine, and a scratch two-worktree repo showing check and pre-push agreeing in both directions where v0.1.11 has them contradicting each other. The merge of #103 was itself the dogfood — v0.1.11 refused it, the new build merged it.

Upgrade: brew update && brew upgrade wt (tap: eharriett0/homebrew-tap)