Refinement note: WAL durability lifecycle to production
This page is part of the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at Refinement.md, and llms.txt lists every page.This note maps WalDurability.tla - the leaf-side WAL
durability lifecycle with crash-anywhere recovery - to the Orleans.Lattice code
that plays each role, so the model and the runtime artefact are traceably the same
protocol and any divergence is visible. The shard-move half of the WAL lives in
WalMove.tla and has its own note,
MoveRefinement.md.
What the model guarantees, in plain terms: an acknowledged write is never lost or skipped by the leaf that owns it, outside a purge, which deletes a marked leaf's writes by contract. It survives a crash of its owner; the GC never trims it before the owner's durable snapshot holds it; no reader is shown an offset above one still in flight; a recovering leaf never falls off the log and never resumes past a write it does not hold; and, under the spec's fairness, every acknowledged write is eventually applied and the log eventually reclaimed. The property mapping below states each guarantee and names the production tests that detect its loss.
It is a documented mapping, not a machine-checked refinement proof. Three gates
keep it honest about what it names: the staleness gate resolves every backticked
Type.Member against src/; the detector gate resolves every test the Detector
column names against test/ and requires every row whose Detector reports a gap
(None or Partial) to cite an issue; and
the coverage gates require a row for every action in Next and every property the
cfg checks. None of them checks that a row's claim is TRUE. That was done by reading
production and, for every Detector, by perturbing production and watching the named
test go red (the log is in the pull request that introduced this note).
Contents
- Model scope in one paragraph: One WAL partition of three offsets is shared by two leaves.
- Polling dispatch refinements:
WalLogSubscriber.DrainAsyncmay omit the page read for a partition whose readable-head probe is at or below its next-needed offset. - Variable mapping
- Action mapping
- Property mapping
- Excluded properties
- Property classification (issue #2321): Every property above is made to fire by a mutation.
- Redundancy checks: The #5799 extension keeps two guards that each protect
AckedOccupieson their own, the #5810 fence makes theTAILvalue it writes redundant, and the fence and the. - Detectors: The Detector column names tests over production code, never a TLA+ mutation: a mutation perturbs the spec, so it cannot notice production regressing.
- Defect mutations whose fixes have landed: These mutations reproduced open defects until their fixes landed, and are now ordinary regression mutations.
- Retention TTL: An operator-configured
WalRetentionis a retention event, not a defect: the GC's TTL arm admits an entry older than the window however the consumer clauses read (WalGcTrimCore.ClassifyEntrykeeps it independent of the cursor... - Deliberate abstraction gaps: These are modelled abstractly or not at all.
- Excluded candidates from the issue
Model scope in one paragraph
One WAL partition of three offsets is shared by two leaves. Every write belongs to
l1; l2 owns nothing in the partition, which is the common production case
(keys hash across every partition) and the reason a checkpoint must be a read
position. A budget of one fault - a shard crash, an abandoned flush, a leaf stop, a
failed persist or a failed capture - bounds the environment; the three fault-free intended-design stutters
(ActivateLoadFail, ActivateRowless, ReplayFaultRearm) cost nothing. The base model
checks 420,229 distinct states to depth 35 with every safety and liveness property.
The TwoFaults variant (WalDurability.TwoFaults.cfg) checks every safety invariant
and all four action properties with a budget of two faults: 3,237,411 distinct states to depth 42. The SnapshotLoss
variant lets the environment destroy a leaf's snapshot or its row, and the operator
purge a tree, at two faults: 5,070,839 distinct states to depth 42. The WarmLeaf variant has no
faults: 17,041 distinct states to depth 28, with every property checked.
Polling dispatch refinements
WalLogSubscriber.DrainAsync may omit the page read for a partition whose
readable-head probe is at or below its next-needed offset. This is a stuttering
step: no read position, HLC or durable checkpoint advances for that partition.
The decision lives only within the drain; the next drain probes again, so a late
flush or a concurrent append is deferred, not lost. Backlogged partitions retain
both the pre-read tail probe and the post-jump fall-off probe. Existing cursor and
per-partition offset pins are still reported even on an entirely idle drain.
WalCommitLogReader.GetTailOffsetAsync delegates to the combined WAL-grain tail
read. Its watermark capability check, provider-read ordering, overflow clamp and
conservative no-watermark fallback are unchanged. No append, flush, trim or pin
protocol transition is elided. The trim-watermark and read-side fall-off detectors
below still exercise the production path. Idle dispatch and next-drain recovery
are covered by the WalLogSubscriberTests idle-read-elision cases.
The pre-read head probes for distinct partitions are issued as one bounded, overlapped wave rather than serially. Each probe is a pure read of an independent partition's readable head and no decision is taken until all have returned, so the observed heads are those a serial interleaving could have returned. The drain reports those heads, and a view maintainer whose drain read and applied nothing folds its lag from them instead of probing each head again. That reuse is a stuttering step: no offset advanced between the probe and the fold, and lag is a reported gauge, never an input to a checkpoint. A drain that applied entries still re-probes, so arrivals during the apply are counted.
Excluded properties
| Spec property | Reason |
|---|---|
TypeOK |
Constrains the model's variables to their declared domains; there is no production counterpart or behavioural detector to map. |
Redundancy checks
The #5799 extension keeps two guards that each protect AckedOccupies on their own,
the #5810 fence makes the TAIL value it writes redundant, and the fence and the
#5825 recovery re-stamp each protect RecoverNeverInsideCommitted on their own
(RecoverNeverInsideCommittedUnfencedBlindTailUnstamped removes both and is red).
Each was run locally with the other kept; neither is a mutation, since each stays
clean, so neither is in the mutation directory. AckedOccupiesRewindWithoutCreateOnly
removes both together and is red.
| Check | Here | Result |
|---|---|---|
| Re-seed alone | Kept: the store's create-only refusal in LateLand (and in FlushAck). Resync re-seeds to RecoveredNext, ignoring the calls in motion. |
Clean against AckedOccupies in the base (AllocatorAboveOrphansResyncRewindsToStoreTail is red on AllocatorAboveOrphans): the reissued write and the late call cannot both occupy the offset, so whichever lands first keeps it and the other is refused, unacknowledged. This is #5799's run. The FlushAck refusal alone is unreachable under the re-seed, which never reissues an occupied offset. |
| Create-only alone | Kept: the re-seed past every visible call in motion, and the TAIL commit fence. LateLand lands over an occupant, the predecessor's call included. |
Clean against AckedOccupies in the base, and in CrossSilo at the variant's full 1,954,533 states: a predecessor's call can commit only while no other writer has moved TAIL since it last read it, so it never reaches an offset the successor has written. |
Fence alone, blind TAIL |
Kept: the TAIL commit fence. Each commit writes TAIL from its own instance's highest commit, as the provider's UpsertReplace did before #5811, rather than Max(ct, o). |
Clean against TailMonotone and RecoverNeverInsideCommitted in CrossSilo at the same 1,954,533 states: an instance whose view of TAIL is current is the last writer of TAIL, so its own highest commit is TAIL and the blind write cannot regress it. TailMonotoneStaleWriterBlindUpsert drops the fence as well and is red. |
| Re-stamp alone | Kept: the recovery re-stamp, with the predecessor's commit still conditional on its view of TAIL, which is how the re-stamp refuses it. The successor's own commit takes no fence and writes TAIL blind from its own highest commit. |
Clean against RecoverNeverInsideCommitted in CrossSilo at 1,954,533 states, the same as with the fence: once the successor has recovered, no predecessor commit lands, so the successor's own blind write is the highest commit and cannot regress TAIL. |
| Fence alone | Kept: the TAIL commit fence and its monotone write. Recovery reads TAIL but does not re-stamp it. |
Clean against RecoverNeverInsideCommitted in CrossSilo at 2,690,971 states: a predecessor's late commit can land after the successor recovered, but it raises TAIL monotonically and moves the successor's view out of date, so the successor's next commit is refused and its re-seed reads the raised TAIL. LogPrefixAppliedRecoveryLeavesTailUnstamped shows the re-stamp is still load-bearing for readers. RecoverNeverInsideCommittedUnfencedBlindTailUnstamped removes both layers and is red. |
Detectors
The Detector column names tests over production code, never a TLA+ mutation: a
mutation perturbs the spec, so it cannot notice production regressing. Every
Yes and Partial detector was shown to go red by perturbing the production code
it names and restored afterwards; the log is in the pull request.
Defect mutations whose fixes have landed
These mutations reproduced open defects until their fixes landed, and are now ordinary regression mutations. Each fix's detectors were proven red with production perturbed back to the old behaviour, and green on the fix:
| Mutation | Behaviour it reproduced | Issue | Detectors |
|---|---|---|---|
ReclamationEventuallyAdvancesWarmLeafNeedsCheckpoint |
A leaf born before identity seeding has no timer until a first checkpoint; foreground-only traffic earns neither checkpoint nor coverage. | #3314 | the ScheduleReplay row's |
ReadPositionHonestLoadFailureColdReplays |
A failed snapshot load cold-replays a WAL trimmed under that snapshot. | #4450 | the ActivateLoadFail row's |
TrimCoveredBySnapshotColdCaptureOverclaims |
A capture mid cold rebuild claims the persisted checkpoint over a partial projection. | #4451 | the Capture row's |
ReadPositionHonestFaultedColdReplayResumesWarm |
A faulted cold rebuild re-arms warm from the persisted checkpoint. | #4467 | the ReplayFaultRearm row's |
RecoveryNeverFallsOffLogNeverWrittenReleaseUnbounded |
A never-written leaf releases its persisted checkpoint above its snapshot's coverage. | #4456 | the PublishPin row's |
ReleaseBackedBySnapshotNoSnapshotReleasesCheckpoint |
A never-written leaf with no snapshot releases its block at its persisted checkpoint, with no durable coverage behind it. | #4523 | the ReleaseBackedBySnapshot row's |
RecoveryNeverFallsOffLogNoSnapshotReleaseTwoFaults |
The same release, composed over two faults into a stale latch; the mutation raises the fault budget to two. | #4523 | the RecoveryNeverFallsOffLog row's |
LogPrefixAppliedWatermarkIgnoresAbandoned |
An abandoned append leaves the watermark, a reader passes it, and the call then lands below the reader. | #4621 | the Abandon and LogPrefixApplied rows' |
ReadPositionHonestLostRowReadsAsFresh |
A lost leaf row reads back as a fresh one, so the leaf starts cold over a WAL trimmed under its lost snapshot. | #4654 | the LeafRowVanish and ActivateRowless rows' |
ReadPositionHonestRowlessActivationStartsCold |
A rowless leaf activates with no create intent at all. | #4654 | the ActivateRowless row's |
ShippingNeverSkipsTrailingHoleExposed |
A trailing hole is exposed; after a crash the recovered allocator reissues it below the reader that passed it. Two faults. | #4621 | the ReadStep row's head-bound detector |
Excluded candidates from the issue
| Candidate | Why it is not a checked property |
|---|---|
ReplayIdempotent |
Faithfully inexpressible in this abstraction: projections are sets, so re-applying an entry cannot change one. Idempotence of a real apply is a property of the LWW and CRDT cores (LwwValue<T> merge), outside this model. |
CheckpointMonotonicDurable |
False of production by design (see the gaps above); replaced by SnapshotCoverageMonotonic and the pin store's monotone merge, which are the monotone durable quantities. |