Repository navigation
Description
Findings from the nightly survey on 2026-05-10 — small drift items, none urgent.
1. Stale "edit cli.rs to update" banner in auto-generated docs
src/help.rs:125 emits <\!-- ⚠️ AUTO-GENERATED from \wt {subcommand} --help-page` — edit cli.rs to update -->into every command page and skill reference. The actual source issrc/cli/mod.rs(nocli.rsexists at the crate root). Banner appears indocs/content/{config,hook,list,merge,remove,step,switch}.mdand the matchingskills/worktrunk/reference/*.md` files.
Fix: change cli.rs to src/cli/mod.rs in src/help.rs:125, then cargo test --test integration test_docs_are_in_sync to propagate.
2. wt step eval --dry-run example shows ... instead of ---
src/cli/step.rs:430-438 documents the dry-run output as:
$ wt step eval --dry-run '{{ branch }}'
branch=feature/auth-oauth2
worktree_path=/home/user/projects/myapp-feature-auth-oauth2
...
Result: feature/auth-oauth2
But src/commands/eval.rs:44 actually emits a --- separator (eprintln\!("---")) before Result: …. Update the doc to match. Requires cargo insta test --accept -- --test integration "test_help" to refresh tests__help__help_step_long.snap.
3. codename_index 32-bit truncation
src/config/expansion.rs:485-499 claims the hash is "identical across 32-bit and 64-bit builds," but the final expression is:
(u64::from_le_bytes(bytes) as usize) % lenOn 32-bit, the as usize cast truncates the upper 32 bits before the modulo, producing different word indices than on 64-bit. Worktrunk doesn't ship 32-bit binaries today, so the practical impact is zero, but the comment is misleading.
Fix: (u64::from_le_bytes(bytes) % len as u64) as usize. No test changes required (identical on 64-bit).
4. Switch tests use invalid post-starts = config key
tests/integration_tests/switch.rs:791 and :847 write project config:
post-starts = ["echo 'marker' > marker.txt"]The valid key is post-start (singular, matched in src/config/hooks.rs:42). Both tests assert that --no-hooks skips the post-start hook, but with this typo the hook is never registered — the snapshot would match even without --no-hooks. The tests pass for the wrong reason.
Fix:
- Change
post-starts = [...]topost-start = "..."in both tests. - Add a marker-file assertion (e.g.,
assert\!(\!repo.root_path().join("marker.txt").exists())) so the test actually verifies the skip. - Re-run
cargo insta test --accept -- --test integration switch_no_hooks_skips_post_start switch_no_hooks_with_yesto refresh snapshots if any unknown-field warning fires.
5. Other low-priority drift (skip unless you want a sweep)
src/copy.rs:213-218usesanyhow::ensure\!(e.kind() == ErrorKind::NotFound, e)to bail —if e.kind() \!= ErrorKind::NotFound { return Err(e.into()); }reads cleaner.src/output/shell_integration.rs:215-228and:264-267returnanyhow::Result<()>despite never erroring — drop theResult.src/git/repository/working_tree.rs:331-345:is_dirty()anddirty_files()both shell out togit status --porcelain.is_dirty()could beOk(\!self.dirty_files()?.is_empty()).src/styling/mod.rs:34:#[cfg(all(test, feature = "syntax-highlighting"))] pub(crate) use ...is test-only library code — move to test module per CLAUDE.md "No Test Code in Library Code."tests/integration_tests/custom.rs:122-139: hand-rolledstrip_ansiduplicatesansi_str::AnsiStr::ansi_strip()(already a transitive dep viasrc/styling/mod.rs).tests/integration_tests/custom.rs:170-201:custom_subcommand_respects_global_dash_c_flagadmits the assertion is "indirect" — would pass even if-Cwere silently dropped. Strengthen or delete.
Activity
worktrunk-bot commentedon May 10, 2026
Took item 4 (the
post-starts =test typo) since it was the only finding with a real correctness consequence — the snapshot was passing even though the post-start hook never registered. Fix is in #2664: corrected the TOML key, added a marker-file assertion in the new worktree, and confirmed the assertion is meaningful by removing--no-hooksand watching the snapshot diverge.Items 1 (stale
edit cli.rsbanner insrc/help.rs:125), 2 (...vs---in thewt step eval --dry-runexample), and 3 (codename_index32-bit truncation comment) are independent and well-scoped — left for separate PRs to keep them atomic.max-sixty commentedon May 10, 2026
fix any others that would make the code better
worktrunk-bot commentedon May 10, 2026
Six follow-up PRs, one concern each, against the items above:
edit src/cli/mod.rs(no more nonexistentcli.rs).wt step eval --dry-runexample uses---, matchingsrc/commands/eval.rs:44.codename_indextakes the modulo in u64 before narrowing, so the comment's "identical across 32-bit and 64-bit" claim becomes true. No-op on 64-bit; existingtest_codename_outputs_are_stablesnapshots unchanged.pub(crate) usemoved intomod tests, removing the CLAUDE.md-flagged "test code in library code" surface.strip_ansireplaced byansi_str::AnsiStr::ansi_strip(), the same call already used by switch/remove/ci_status/column_alignment tests.print_skipped_shells/print_shell_install_resultlose their unusedResult<()>(no?in either body); the only?at the call site goes with them.Skipped from item 5:
src/copy.rs:213-218(anyhow::ensure!shape) — purely stylistic; current code is correct, refactor adds no value.src/git/repository/working_tree.rs:331-345(is_dirty()callingdirty_files()) — would allocate aVec<String>on every clean check just for a boolean. Performance regression, not a cleanup.tests/integration_tests/custom.rs:170-201(weak-Cassertion) — making it actually verify cwd needs the mock-stub binary to grow a "report cwd" feature; it's scope creep for an annotation that's already honest about the limitation.Happy to revisit any of those three if you'd rather have them.