Skip to content

fix(maintenance): stop the shared git dir keeping dead stores alive - #4120

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
refactor/storage-worktree-liveness
Oct 16, 2026
Merged

ScriptedAlchemy merged 1 commit into
masterfrom
refactor/storage-worktree-liveness

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Step 3 of the storage redesign (docs/plans/storage/README.md in #4118), first growth source from #4099.

Orphan-store classification counted the repository's git common directory as a liveness root. A linked worktree shares that directory with the primary checkout, so the store of a deleted worktree stayed Live for as long as the repository existed and was never collected; the test that pinned this (live_git_common_dir_keeps_a_linked_worktree_store_live) encoded the leak. Liveness now comes from the registered checkout roots only: the canonical and display roots and every path alias, which includes each enrolled checkout. The git-common-dir: alias is skipped because it names the shared git directory, not a checkout. A store with any live enrolled checkout stays Live (live_registered_alias_keeps_the_store_out_of_every_collectable_bucket still holds), and the durable-memory guard and retention window are unchanged.

Test plan

  • bazel test --config=clippy //crates/tracedecay-maintenance:unit_test (107 passed). sweep_plans_a_deleted_worktrees_store_while_its_repository_lives seeds a registry project whose checkout is gone and whose recorded git dir exists, and asserts the sweep plans its store for collection. Feeding the git dir back into the liveness roots makes it fail (left [], right ["store_worktree"]).
  • rustfmt_check_2024 for the touched crate
  • //crates/tracedecay:daemon_suite, :mcp_suite, :session_suite, :unit_test in CI

Refs #4099


Devin Review

Orphan-store classification counted the repository's git common
directory as a liveness root. A linked worktree shares that directory
with the primary checkout, so the store of a deleted worktree stayed
Live for as long as the repository existed and was never collected.

Liveness now comes from the registered checkout roots only: the
canonical and display roots and every path alias, which includes each
enrolled checkout. The git-common-dir alias is skipped because it names
the shared git directory, not a checkout. A registry-backed test plans
a deleted worktree's store for collection while its git dir lives.
@changeset-bot

changeset-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ad604cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@ScriptedAlchemy
ScriptedAlchemy merged commit c3a0d36 into master Oct 16, 2026
14 of 20 checks passed
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.

1 participant