Skip to content

chore: small drift cleanups from nightly survey - #2549

Merged
max-sixty merged 1 commit into
mainfrom
chore/nightly-survey-cleanup
May 3, 2026
Merged

max-sixty merged 1 commit into
mainfrom
chore/nightly-survey-cleanup

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Three small drift fixes surfaced by the nightly survey. Each is a doc/DRY cleanup, not a behavior change.

Changes

  • src/cli/hook.rs — wt hook show's value_parser was hand-rolled with the same ten hook-type strings declared just above as HOOK_TYPE_NAMES. The HOOK_TYPE_NAMES docstring even says the constant is "Shared by … the wt hook show value parser so drift is caught by tests rather than at runtime" — the show parser wasn't actually using it. Replaced with PossibleValuesParser::new(HOOK_TYPE_NAMES).

  • src/git/repository/working_tree.rs — the WorkingTreeGitInfo docstring still said prewarm_info "primes RepoCache," but perf(prewarm): fold cold-path rev-parses into one fork #2541 (fd78f60e) and refactor(git): close remaining cache-staleness vectors after RefSnapshot cutover #2530 (ee242f30) moved the per-worktree maps (WORKTREE_ROOTS, GIT_DIRS, CURRENT_BRANCHES) out of RepoCache into process-wide LazyLock<DashMap> statics. Updated the doc to point at the actual statics; dropped the now-orphan intra-doc link to RepoCache.

  • src/commands/mod.rs — format_command_label's docstring example and its test were pinned on "post-create", which is a hidden deprecated alias for pre-start per src/cli/hook.rs:50. Replaced with "post-start" so newcomers don't read the example as a current canonical hook name.

Test plan

  • cargo build --bins
  • cargo clippy --bins --tests
  • cargo test --lib --bins format_command_label
  • cargo test --test integration hook_show (15 tests pass — value_parser change preserves accept/reject behavior)
  • cargo test --test integration help_ (17 tests, including help snapshots — PossibleValuesParser::new(HOOK_TYPE_NAMES) produces identical help output to the inline literal)
  • cargo test --test integration test_docs_are_in_sync
  • cargo fmt --check

🤖 Generated with Claude Code

- src/cli/hook.rs: replace inline hook-type literal in `wt hook show`
  with `PossibleValuesParser::new(HOOK_TYPE_NAMES)`. The HOOK_TYPE_NAMES
  docstring claims the constant is shared with the show value parser
  "so drift is caught by tests rather than at runtime"; it wasn't.
- src/git/repository/working_tree.rs: WorkingTreeGitInfo doc said
  prewarm_info "still primes RepoCache" but ee242f3 moved those maps
  to process-wide statics (WORKTREE_ROOTS / GIT_DIRS / CURRENT_BRANCHES).
- src/commands/mod.rs: update format_command_label doc example and its
  test from the deprecated `post-create` to the canonical `post-start`
  (post-create is a hidden alias for pre-start, see hook.rs:50).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@max-sixty
max-sixty merged commit f2a7089 into main May 3, 2026
26 checks passed
@max-sixty
max-sixty deleted the chore/nightly-survey-cleanup branch May 3, 2026 15:09
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.

2 participants