LeVCS/crates/levcs-store/tests
Levi Neuwirth b4e4c7ebc7 Make a staged projection adoptable, reclaimable, and recoverable
B3 deliverables 6, 7 and 8. Each was an explicit NotImplemented stub whose
recorded blocker had lapsed; together they take a sealed session from a pin
nobody could hold to one recovery can resolve after the process that held it
is gone.

Finalize takes an adoption pin, and the state machine the deliverable
described could not be built as written. The pin is taken from Sealed rather
than Open, because the sealed manifest is what an adopter revalidates against.
A definitive pre-append failure returns the session to Sealed rather than
Open, because reconstruction reads that manifest's presence as the seal's own
commit point and would hand back Sealed on the next restart regardless -
returning a session to a state no restart can reproduce is the defect the
private busy/state split exists to prevent. Adopted is durable and is a state
the wording had no name for: adopted artifacts stay in staging/ with a
committed root pointing into them, so dropping the session record would make
the next reconstruction read the directory as an abandoned materialization and
reclaim committed content. The pin is made durable before it is issued; a
handle backed by an in-memory flag is an adoption capability with nothing
behind it.

Cleanup proves absence of reference, and absence is not enough on its own. A
sealed session a client is still finalizing and a pinned one whose frame may
be mid-append are both referenced by nothing, so the candidate set is the
adopted sessions alone. The unit of removal is the session directory rather
than the artifact: a manifest names every chunk and reconstruction refuses a
sealed session missing any ordinal, so removing the unreferenced half of a
directory trades a bounded leak for a root that fails to open. The supplied
root must have reached the adoption - a root captured earlier references none
of these artifacts because it predates them, and acting on that deletes a
directory the current root points into.

Recovery resolves a committed descriptor against the bytes on disk, not
against staging's cached idea of them. Every declared ordinal is read back and
its digest bound to the sealed record, the manifest's ordered list, and the
frame's own artifact-set digest, so a valid replacement chunk of identical
shape is refused rather than indexed. It resolves whole or not at all. A
location names the whole certified record, so every object in a chunk shares
that chunk's location and a reader validates the artifact before extracting
from its decoded vector.

Three frozen seams move, each recorded as a contract review:
ProjectionAdoptionOutcome::Adopted and resolve_committed both gain the
adoption's committed shard sequence, from whichever side made the frame
authoritative; and checkpoint-style proof-bounded replacement earns a third
caller for sys::rename_replace.

Contract reviews 2026-07-31-A through -D. Scope 6.5 and plan 8 are amended
where they specified behaviour that could not be built.

Deliverables 6-8 are implemented and not yet operated: no production path
calls begin, finalize, or adopt_projection, and expire still has no scheduler.
Both carry-forwards stand.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XKzM69CHmBuDcA3qN1jFdh
2026-07-31 18:18:55 -04:00
..
fixtures Initialize an absent root through the production entry point 2026-07-29 17:26:05 -04:00
support Initialize an absent root through the production entry point 2026-07-29 17:26:05 -04:00
crash_matrix.rs Initialize an absent root through the production entry point 2026-07-29 17:26:05 -04:00
d0_contract.rs Accept only the braced test-item shapes this crate uses 2026-07-29 20:30:41 -04:00
frame_golden.rs Freeze Wave A: Phase 1 storage spine 2026-07-26 19:47:03 -04:00
recovery_checkpoint.rs Implement D0-B storage publication interfaces 2026-07-27 22:31:32 -04:00
recovery_checkpoint_faults.rs Implement D0-B storage publication interfaces 2026-07-27 22:31:32 -04:00
recovery_eio.rs Freeze Wave A: Phase 1 storage spine 2026-07-26 19:47:03 -04:00
recovery_identity.rs Freeze Wave A: Phase 1 storage spine 2026-07-26 19:47:03 -04:00
recovery_manifest.rs Implement D0-B storage publication interfaces 2026-07-27 22:31:32 -04:00
recovery_production_codec.rs Freeze Wave A: Phase 1 storage spine 2026-07-26 19:47:03 -04:00
recovery_receipts.rs Implement D0-B storage publication interfaces 2026-07-27 22:31:32 -04:00
recovery_reference_frame.rs Freeze Wave A: Phase 1 storage spine 2026-07-26 19:47:03 -04:00
recovery_seal.rs Freeze Wave A: Phase 1 storage spine 2026-07-26 19:47:03 -04:00
recovery_sequences.rs Freeze Wave A: Phase 1 storage spine 2026-07-26 19:47:03 -04:00
recovery_step8.rs Implement D0-B storage publication interfaces 2026-07-27 22:31:32 -04:00
recovery_tail.rs Freeze Wave A: Phase 1 storage spine 2026-07-26 19:47:03 -04:00
staging_sessions.rs Make a staged projection adoptable, reclaimable, and recoverable 2026-07-31 18:18:55 -04:00