Skip to content

fix(retention): unblock sealed generation retirement on busy stores - #4955

Merged
ScriptedAlchemy merged 10 commits into
masterfrom
triage/sealed-retention
Nov 25, 2026
Merged

ScriptedAlchemy merged 10 commits into
masterfrom
triage/sealed-retention

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Problem

Refs #4616. Superseded sealed graphs could accumulate because one relivened text artifact aborted the whole retention transaction, repeated generation-store contention never progressed beyond short probes, and a headless projection skipped durable retirement tombstones. These paths left reclaimable generations behind during ordinary publication and recovery.

Changes

  • Restore or remove each quarantined text artifact according to its current durable references, preserve unrelated unsafe candidates, and settle interrupted restores without stranding the transaction journal.
  • Preserve busy-deferral counts by registered data root and, after three deferrals, carry the existing bounded maintenance deadline through both the scope generation lock and the shared project segment lock. Cancellation remains observable at either lock; no deadline was increased.
  • Finalize preexisting retirement tombstones even when a projection has lost its verified head. A missing head does not authorize retiring new replay records.
  • Add a mounted reader journey across five publications. Only the old reader retains its snapshot while scheduled maintenance succeeds; releasing that reader permits physical reclamation while the latest generation survives. Strengthen the separate daemon collection assertion to require one or two remaining generations, never zero.
  • Merge current master fc80c47 so existing writer-admission, Doctor, and bounded-report fixes are included.

Issue acceptance coverage

#4616 requirement Production behavior and regression evidence
More than three generations converge to live plus at most one previous sealed_generation_retention_test::superseded_sealed_generations_collect_to_live_plus_one publishes five generations and checks physical reclamation and the 1–2 bound. mounted_retention_preserves_a_reader_then_reclaims_its_sealed_generation protects a real previous reader through successful maintenance, then checks reclamation after release.
One unsafe or unresolvable text artifact does not block independent collection Unsafe-orphan/staging tests preserve and report invalid candidates while collecting unrelated generations. Relivened-artifact and interrupted-restore regressions exercise durable descriptor protection and journal recovery.
Retention makes progress under write pressure Daemon/store-runtime tests retain fair same-store admission while unrelated writers continue and reclaim an independent store's superseded generations while another store remains busy. This PR's registered-store tests cover bounded deferral at both generation and shared segment locks, collection after publisher release, counter persistence, and shutdown cancellation.
Doctor names a supported reclaim command Current master registered_project_reclaim_hint emits tracedecay --dry-run projects forget <id> and explicitly confirmed tracedecay --yes projects forget <id> for over-bound registered stores, with destructive-operation wording. This requirement is already met.
Incident-scale storage reporting completes or reports bounded partial coverage The existing 70-generation plus 15 GiB sparse-store report regression exercises complete size coverage and a typed unavailable malformed pointer. Bounded receipt/pointer reads and bounded inode accounting refuse untrustworthy complete totals; this is not a measured production peak-RSS result.

The discussion's headless tombstone blocker (comment 69) is fixed here. Current master also includes projection-qualified sealed liveness and exact replay-dependency accounting, with sealed_journal_liveness_and_retirement_preserve_projection_identity covering the distinct later discussion findings.

Validation

Current head: 03d2331211ef2f79441718ec538c8d30eea7e0af.

  • Hosted CI run 45533002070 passed repository gates, feature gates, dashboard, benchmark harness self-tests, and blocking Clippy.
  • Linux passed all 181 Bazel test targets (109 executed, the others cached). The tracedecay unit target, daemon suite, retention unit target, maintenance unit target, and graph-db unit target ran uncached. These include the new reader-held maintenance journey and both lock-admission regressions.
  • The downstream Windows workspace build passed. The full workflow completed successfully at the head above.
  • Pinned formatting and git diff --check passed locally. The test-only projector-revision constructor caught by an earlier Clippy run was corrected to the canonical production constructor before this successful native run.

Remaining evidence and separate filesystem scope

Multi-day observation on the reported busy monorepo and a production peak-RSS measurement remain unperformed. Controlled contention and sparse logical-size fixtures establish narrower behavior and must not be presented as those observations.

Historical discussion also raised namespace substitution before the first directory capability is acquired and platform path-consumer races. Current cleanup binds receipt verification and removal to the same opened child, but this PR does not eliminate the documented directory-creation/open window, ambient ancestor acquisition, or macOS/Windows handle-to-path substitution window. Those require a separate store-owner/capability change and native filesystem regressions; they are not counted as resolved by the collection tests. This PR therefore retains Refs #4616.


Devin Review

ScriptedAlchemy and others added 4 commits November 24, 2026 12:54
Superseded retirement returned early when a projection had no verified
head, before it paged the projection's retired cleanup. A replay
tombstoned just before its head went away therefore never had its
native rows or sealed artifact removed: the maintenance sweep visits
the projection (tombstones keep it in the projection page) but skipped
the only finalizer.

The headless path now finishes only the tombstones that already exist;
it never retires an untombstoned replay record.

Refs #4616

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`invalid_worktree_metadata_refuses_the_entire_inventory` compared the
linked worktree path built under the raw temp dir with the resolved
roots the inventory reports. On macOS the temp dir sits behind the
`/var` -> `/private/var` symlink, so the recovered inventory never
"contained" the linked worktree and the test failed deterministically.
Canonicalize the base like the sibling liveness test does.

Refs #4616

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 03d2331

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

@ScriptedAlchemy
ScriptedAlchemy enabled auto-merge (squash) November 24, 2026 21:49
devin-ai-integration[bot]

This comment was marked as resolved.

ScriptedAlchemy and others added 6 commits November 24, 2026 14:24
Busy-store deferrals are keyed by the code-index store root under a
project data root, but they were pruned with the per-tick mounted
checkout set. The keys never matched, so every tick reset the count and
the bounded wait after three `GenerationStoreBusy` outcomes was never
reached in the daemon. Prune them with the registered data roots, like
the text-artifact scan cursors, instead.

Refs #4616

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Committed text-artifact cleanup restores a relivened artifact with its
own durable rename but clears the journal only after every candidate.
If it was interrupted in between and the descriptor was later dropped,
the rerun called `remove_committed`, which refuses any file back in its
source, so the journal stayed and blocked every later retention pass.

Text cleanup now leaves an entry that is in its source and absent from
the stage in place (it is the earlier restore) and lets an ordinary pass
re-plan it. Entries in both places are still refused.

Refs #4616

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ScriptedAlchemy
ScriptedAlchemy merged commit 6e68c35 into master Nov 25, 2026
16 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