Skip to content

docs(picker): drop stale dedupe git calls TODO - #2657

Merged
max-sixty merged 1 commit into
mainfrom
picker-num-items-dedup
May 9, 2026
Merged

max-sixty merged 1 commit into
mainfrom
picker-num-items-dedup

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

The TODO in src/commands/picker/mod.rs asking to "dedupe list_worktrees calls between num_items_estimate and collect::collect" has already been resolved.

Repository::list_worktrees has been cached on RepoCache since 2114fda (#2375), and the picker shares that cache across its main thread and the bg picker-collect thread via Arc<RepoCache> — repo.clone() shares the OnceCell<Vec<WorktreeInfo>>, so the second call is a memory hit.

The RepoCache::worktrees docstring already states the contract: "The picker warms this on the main thread (for its preview-window sizing estimate) so the background collect::collect pass hits memory instead of respawning the subprocess on the critical path to skeleton."

The TODO was originally added in #2250 and partially walked back in #2368 (the parenthetical noting the branch-inventory cache), but the body was never updated when #2375 closed the worktree half.

Verification

RUST_LOG=worktrunk=debug WORKTRUNK_PICKER_DRY_RUN=1 wt -C <picker-test> switch against the wt-perf setup picker-test repo shows exactly one git worktree list --porcelain subprocess per invocation (1 wt-trace record, 1 spawn debug line).

No behavior change — pure doc-comment deletion (9 lines).

Test plan

  • pre-commit run --files src/commands/picker/mod.rs — passes
  • cargo check — passes
  • Empirical: 1 git worktree list --porcelain subprocess per wt switch

This was written by Claude Code on behalf of Maximilian Roos

`Repository::list_worktrees` has been cached on `RepoCache` since
2114fda (#2375), and the picker shares the cache across its main
thread and the bg `picker-collect` thread via `Arc<RepoCache>` —
exactly the dedup the TODO asked for. A `RUST_LOG=worktrunk=debug`
trace of `wt switch` against the `picker-test` synthetic repo shows
one `git worktree list --porcelain` subprocess per invocation; the
pre-skeleton `RepoCache::worktrees` docstring already documents the
contract.

The TODO was originally added in #2250 and partially walked back in
#2368 (the parenthetical that calls out the branch-inventory cache),
but the body was never updated when #2375 closed the worktree half.
No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@max-sixty
max-sixty merged commit 1b44e8d into main May 9, 2026
34 checks passed
@max-sixty
max-sixty deleted the picker-num-items-dedup branch May 9, 2026 22:55
@worktrunk-bot worktrunk-bot mentioned this pull request May 10, 2026
3 tasks done
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