Repository navigation
docs+test(hooks): tighten "(else the primary)" wording; cover the no-config approval path - #2727
Merged
Merged
Conversation
…approval/execution parity Two small consolidations on top of #2717 (which dropped the fallback in `collect_remove_hook_commands`): - **Spec**: the `commands::hooks` table row for `post-merge` / `post-remove` / `post-switch` after a removal said "the destination — for `wt merge`, the target branch's worktree (else the primary)". With fallbacks gone, "(else the primary)" can be misread as a config fallback. Re-phrased as the path choice for the destination — the merge target's worktree if one exists, otherwise the primary — explicitly noting "not a config fallback". - **Test**: a regression test for the bug #2717 fixed — `test_remove_no_fallback_to_primary_pre_remove` exercises a worktree with no `.config/wt.toml` while the primary has a `pre-remove`. Before #2717, `wt remove` without `--yes` aborted with "needs approval" because the helper surfaced the primary's hook and tests have no TTY; after #2717 (and with the test in place) the prompt is empty and removal succeeds without prompting. #2717 noted that the existing malformed-config tests cover the helper end-to-end, but no test covered the no-config (empty-prompt) path specifically. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
worktrunk-bot
approved these changes
May 11, 2026
Merged
max-sixty
added a commit
that referenced
this pull request
May 13, 2026
Release v0.50.0. Highlights: - Experimental Azure DevOps support (#1256, thanks @mikeyroush; fixes #1144 from @dlecan) — `wt switch pr:<N>`, `wt list --full`, and `wt config show --full` recognize Azure DevOps via the `az` CLI. - Experimental Gitea CI-status detection (#2702) on top of the Gitea `pr:` shortcut (#1320, thanks @SjB). - Hooks now resolve `.config/wt.toml` from the worktree they act on — the primary-worktree fallback is gone, and `post-remove` reads the removed worktree's config (snapshotted before removal). Approval prompts collect hook commands from the same worktree. Breaking change for setups that relied on the primary-worktree fallback; the changelog entry has the recovery action. (#2690, #2703, #2714, #2717, #2701, #2708, #2727, #2736, #2748) - The `wt switch` picker's `alt-r` removal no longer runs unapproved project hooks (#2746) — the picker's removal path is now routed through `handle_remove_output` and consults the existing approval state read-only. - `wt config alias show` with no name lists every alias's full definition (#2684, #2691); `wt --help` switches to a compact aliases pointer (#2688). - `wt list --branches` warm-run perf: SHA-keyed cache for `main↕` and `Remote⇅` ahead/behind counts; shared push-remote URL and local-branch scan (#2704, #2718, #2673). - Claude Code plugin ships the `wt-switch-create` skill (#2737, thanks @onetom for #2631). See `CHANGELOG.md` for the full list (8 Improved, 5 Fixed, 5 Internal). semver-checks reports breaking library-API changes (new enum variants without `#[non_exhaustive]`, removed `Branch::github_push_url`, new trait method on `RemoteRefProvider`), which mandates at minimum a minor bump pre-1.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small consolidations on top of #2717 (which dropped the residual fallback in the shared
collect_remove_hook_commandsapproval helper, finishing what #2714 started):Spec tightening. The
commands::hooks"Which.config/wt.tomla hook reads" table row forpost-merge/post-remove/post-switchafter a removal previously read "the destination — forwt merge, the target branch's worktree (else the primary)". Once the fallback rule was gone, "(else the primary)" could be misread as a config fallback. Re-phrased it as the path choice for the destination — the merge target's worktree if one exists, otherwise the primary — explicitly noted "not a config fallback".Regression test. Added
test_remove_no_fallback_to_primary_pre_remove: a worktree with no.config/wt.tomlplus apre-removein the primary. Before #2717,wt removewithout--yesaborted with "needs approval" because the helper surfaced the primary's hook and tests have no TTY; after #2717 the prompt is empty and removal succeeds. #2717's commit message argued the malformed-config tests covered the helper end-to-end, but no test covered the no-config (empty-prompt) path specifically — this fills that gap, so a future re-introduction of the fallback would surface immediately.Verified twice: stashed
project_config.rsto its pre-#2717 state → test fails with exactly the symptom (pre-remove: echo ran > ...shown in the prompt,Cannot prompt for approval in non-interactive environment). Restored → test passes.cargo run -- hook pre-merge --yesis green.