Skip to content

docs(repository): list the worktree-registry lock among the process-level singletons - #3961

Merged
max-sixty merged 1 commit into
mainfrom
nightly/clean-33297203764
Aug 30, 2026
Merged

max-sixty merged 1 commit into
mainfrom
nightly/clean-33297203764

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

The # Caching spec in src/git/repository/mod.rs enumerates every process-global singleton the module reasons about, split into two lists: caches under "Two layers, two scopes", and non-cache OnceLock/LazyLock singletons under "Other process-level singletons". WORKTREE_REGISTRY_LOCKS, added in #3954, is in neither — it lives in this file but holds locks rather than git data, so it fell between the cache list (which only covers in-file caches) and the singleton list (whose examples are all in other modules). This adds it to the singleton list, naming what it is keyed by and pointing at the static's own doc comment for the ordering rules.

Docs only — no behavior change, so no regression test. cargo check --lib passes; the diff is five //! lines.

Why it belongs in the singleton list rather than the cache list

The singleton list is prefaced "process-global singletons that are lazy initialization, not caches — the container is initialized once and never replaced, with no underlying external state that could go stale". WORKTREE_REGISTRY_LOCKS fits exactly: the DashMap is created once, each entry is an Arc<RwLock<()>> handed to every Repository resolving to that canonical common dir (mod.rs), and nothing it stores can go stale because it stores no git state.

@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Aug 30, 2026
@max-sixty
max-sixty merged commit b4622ed into main Aug 30, 2026
36 of 46 checks passed
@max-sixty
max-sixty deleted the nightly/clean-33297203764 branch August 30, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants