Repository navigation
docs: alias template-expansion timing; fix narrow help-test env redaction - #3006
Merged
Merged
Conversation
…nv redaction
Document the two-pass `{% raw %}` deferral for nested `wt` commands in aliases
(`for-each` / `--execute`), distinguish repo-level from per-worktree template
variables, and cross-link `{{ default_branch }}` vs the shell command. Refresh
the worktrunk skill (7 → 10 hook types, aliases/multi-worktree task section,
stale anchors) and correct the `integration_reason` values to their hyphenated
JSON form (`trees-match`, etc.).
Also fix `test_help_list_narrow_terminal`, which built its own `insta::Settings`
without `add_standard_env_redactions` — so its snapshot env block leaked
host-specific paths (`LLVM_PROFILE_FILE`, `WORKTRUNK_*`) that churn per machine.
Adding the call mirrors `snapshot_help` and makes the snapshot reproducible.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
worktrunk-bot
left a comment
Collaborator
There was a problem hiding this comment.
The accuracy pass checks out — verified the integration_reason hyphenation, wt hook show --expanded, the for-each "template error aborts / command failure tolerated" split, the -x tmux -- attach arg form, and the 10 hook types against source. The help_list_narrow_80 redaction fix is a real determinism win.
One omission in the new repo-vs-active variable note: the active list leaves out worktree_name, which the table just above it classifies as active and which varies per worktree. Suggestion on the source of truth below.
The active-vs-repo variable note omitted worktree_name, which the table directly above classifies as active (varies per worktree). Addresses tend review feedback on #3006. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
worktrunk-bot
approved these changes
Jun 7, 2026
max-sixty
added a commit
that referenced
this pull request
Jun 9, 2026
) ## Consolidate help-snapshot insta settings Follow-up to #3006, which fixed one instance of this in `test_help_list_narrow_terminal`. ### The bug Insta's `info:` / `env:` block is metadata — written to the `.snap` file but **not** part of insta's pass/fail comparison (only `stdout`/`stderr`/`exit` are compared). Several help tests in `tests/integration_tests/help.rs` constructed their own `insta::Settings` inline and skipped `add_standard_env_redactions`, so host-specific env baked into their committed snapshots and passed forever on the machine that generated them. Three snapshots (`help_md_root`, `help_md_merge`, `nested_subcommand_hook_pre_start`) carried a developer's literal `LLVM_PROFILE_FILE` temp path (`/var/folders/…/wt-test-profraw/…`); it only diffs when the snapshot is regenerated elsewhere. ### The fix One private `help_settings() -> Settings` builder (snapshot path + `add_standard_env_redactions`); every help/version/usage snapshot test now routes through it, so the redaction can't be forgotten. The seven affected snapshots are force-regenerated — env blocks now uniformly redacted, command-output bodies byte-identical. This is latent-correctness hygiene: because the env block isn't part of the comparison, it never fails CI; the payoff is that the next regeneration on any machine won't reintroduce host churn. > _This was written by Claude Code on behalf of max_ Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Docs: alias template-expansion timing
The main addition documents a gotcha that's easy to hit and hard to diagnose: an alias body renders its
{{ … }}once at dispatch, in the invoking worktree, so a per-worktree variable like{{ branch }}is baked to a single value before a nestedwt step for-each/wt switch --executeiterates — printing the same value in every worktree. The fix is{% raw %}…{% endraw %}deferral (plus a quotedsh -c '…'forfor-each, since the deferred{{ branch }}contains spaces).extending.md— rewrote "Deferring expansion to a nestedwtcommand" around thefor-eachsymptom; improved theuprebase recipe.faq.md,troubleshooting.md— symptom-first entries withwt config alias dry-runas the diagnostic.hook.md/config.md/step.md— distinguish repo-level (constant) vs per-worktree (active) variables; note{{ default_branch }}needs no deferral; cross-link the{{ default_branch }}variable vs thewt config state default-branchshell command.Factual corrections
integration_reasonJSON values are hyphenated (trees-match,no-added-changes,merge-adds-nothing) — the docs had underscores. Verified againstsrc/commands/list/model/state.rs.SKILL.md: 7 → 10 hook types (5 events × pre/post), added an aliases/multi-worktree task section, fixed stale anchor links.Test fix: narrow help-test env redaction
test_help_list_narrow_terminalbuilt its owninsta::Settingsbut skippedadd_standard_env_redactions(every other help snapshot routes throughsnapshot_help, which calls it). Its snapshot env block therefore leaked host-specific paths (LLVM_PROFILE_FILE= the machine's temp dir, plus theWORKTRUNK_*paths), which churn whenever the snapshot is regenerated on a different machine. Adding the one call mirrorssnapshot_helpand makes the snapshot reproducible.Worth noting (and a candidate follow-up): this gap was masked under
cargo test(libtest) because therepofixture'smem::forget'dbind_to_scope()guard leaks redaction settings across the shared process's reused threads. Under nextest (process-per-test, what the pre-merge hook uses) there's no leak, so a test missing its own redactions is exposed. A few other help tests (test_help_md,test_version,test_nested_subcommand_suggestion) have the same gap and could be consolidated through one settings helper — left out of this PR to keep it focused.