---
title: "Refinement note: cross-cluster TLA+ spec to code"
url: "https://nsta1.github.io/Orleans.Lattice/spec/atomic-commit/RefinementCrossCluster.html"
source: "https://github.com/NSTA1/Orleans.Lattice/blob/release/10.5/spec/atomic-commit/RefinementCrossCluster.md"
documents: "Orleans.Lattice 10.5.0 (release line 10.5)"
built: "2026-12-05"
all-pages: "https://nsta1.github.io/Orleans.Lattice/llms.txt"
---
# Refinement note: cross-cluster TLA+ spec to code

Part of [TLA+ specification of the Orleans.Lattice atomic-commit protocol](README.md).

This note maps [`AtomicCommitCrossCluster.tla`](https://github.com/NSTA1/Orleans.Lattice/blob/release/10.5/spec/atomic-commit/AtomicCommitCrossCluster.tla)
to the Orleans.Lattice code that replicates an atomic-write saga to a peer
cluster and keeps it all-or-nothing visible there, so the abstract model and the
runtime artefact are traceably the same protocol. Like
[`Refinement.md`](Refinement.md), the single-cluster note it complements, it is
a **documented mapping, not a machine-checked refinement proof**.

Its scope is the **receiver**. The origin's saga is
[`AtomicCommit.tla`](https://github.com/NSTA1/Orleans.Lattice/blob/release/10.5/spec/atomic-commit/AtomicCommit.tla)'s, instanced unchanged, and its own
properties are checked and mapped there. Nothing below re-maps the origin's
protocol steps; the origin rows map only what each origin step writes for
replication. Coverage of one half must not be read as coverage of the other
(issue #2324).

## Fused barrier observations

`LatticeReplicationPeerDecommissioner.AbandonOriginBarriersAsync` reads the
live/tombstone union through `ICrossTreeBarrierIndexGrain.GetAllAsync` only for
`ReaddFresh`; `Decommission` still reads live entries alone. The returned keys
are detached and deduplicated, and discovery still completes before abandonment.
Each receiver's non-interleaved `AbandonForOriginAsync` checks its own origin and
durable-decision flag, then awaits the unchanged `AbandonAsync` protocol. An
unpersisted decision remains undecided, exactly as `GetStatusAsync` reports it.
A decision completed before the mutating call is admitted is retained on
decommission; re-add explicitly includes it. No status is cached across calls.

These remove dispatch boundaries, not protocol steps: withdrawal from every
index, tombstone removal, retention unregister and clear are unchanged and
awaited. No per-tree bucket clearing moves before the whole-barrier abandon
phase; the decommission mark and import-fence latch remain before it, and re-add
clears the mark only afterwards. `Decommission`, `DecomWalk`, `ReaddFresh` and
`FenceLift` retain their mappings below. The conditional receiver tests,
`BarrierAbandonCallReductionTests`, `DecommissionPeerIntegrationTests` and
`CrossTreeImportBarrierIntegrationTests` cover the implementation seam; this
note does not turn the model into a machine-checked code refinement.

The peer marker now returns its previous presence from the same serialized call
that awaits its durable mark. The marker still completes before tree discovery,
import holds or barrier abandonment. Decommission verdict reads group captured
pending ids by their stamped registry owner (including legacy ids), in windows
of at most 128, through delegation-aware, retention-masked `GetStatusManyAsync`.
Every window completes and supplies every requested id before bucket clearing;
a fault or omitted id aborts the pass. Nonterminal handling, the fresh clear
walk and decision-before-terminal ordering are unchanged. The call-count and
failure tests in `DecommissionCallReductionTests` cover these boundaries.

## Variable mapping

| Spec variable | Protocol role | Code counterpart |
|---------------|---------------|------------------|
| `phase`, `vote`, `decision`, `terminal`, `pend`, `orphanDone`, `forgotten`, `masked`, `revision` | The origin saga and its registry | `AtomicCommit.tla`'s variables, mapped in [`Refinement.md`](Refinement.md). Only saga `t1` moves here; `t2` stays in `init`. |
| `xtree` | Shape of the replicated saga | Whether the saga's terminals carry `WalRecord.CrossTreeOperationId` (a `LatticeCrossTreeTxGrain` sub-saga) or not (a single-tree `AtomicWriteGrain` saga). Fixed per behaviour. |
| `oext[tr]` | Authoring-side delegation | The origin tree's `TxRegistryState.ExternalAuthorities` row for the saga, written by `TxRegistryGrain.RegisterExternalDecisionAuthorityAsync` and dropped when the sub-saga's finalize records the decision locally. |
| `orcv[tr]` | Receiving-side delegation on the origin | The origin tree's `TxRegistryState.ReceiverDecisionAuthorities` row. Only the public apply seam handed the origin's own terminal could write one, and the registry refuses it. |
| `outbox` | Unacknowledged replication records | The origin's WAL records past the shipper's durable per-partition cursor for this peer (`ReplicationShipperGrain`): every record is re-shipped until the receiver acknowledges it. While the peer is off the log the shipper withholds its saga records, which stay here. |
| `dlv` | Delivery history | The prepares the receiver has applied at least once. Modelling device for stating the ordering assumption; no production counterpart. |
| `rconn` | Receiver attached to the stream | A receiver in live incremental replication, as opposed to one that will join through a snapshot bootstrap. |
| `rpend[k]` | Receiver leaf's prepared bucket | The receiver leaf's pending-tx bucket for the saga, installed by `IReplicationApplyGrain.ApplyPreparedSetAsync`. |
| `rterm[k]` | Receiver leaf's applied terminal | The receiver leaf's recently-terminal memory (`BPlusLeafGrain.ApplyTxCommit` records it even with no bucket); the late-prepare refusal's and the orphan guard's input. |
| `rproj[k]` | Receiver leaf's materialised projection | Whether the receiver leaf's committed rows hold the saga's write. |
| `rarr[tr]`, `rexp[tr]` | Receiver tally | `TxRegistryState.TerminalArrivals` and `TxRegistryState.ExpectedTerminals` on the receiver tree's registry. `rexp = 0` stands for "no entry". |
| `rdec[tr]` | Receiver registry's local decision | `TxRegistryState.Decisions` on the receiver tree's registry. |
| `rout[tr]`, `rstage[tr]` | Cross-tree hand-off progress | The outcome and position of `LatticeGrain.ApplyTxTerminalAsync`'s barrier hand-off after the tree's tally completes: register the delegation, then notify the barrier. |
| `rdeleg[tr]` | Receiver delegation to the barrier | The receiver tree's `TxRegistryState.ReceiverDecisionAuthorities` row, written by `TxRegistryGrain.RegisterReceiverDecisionAuthorityAsync`. |
| `rdial[tr]` | Barrier unreachable | A failing grain call from `TxRegistryGrain.ResolveReceiverDelegatedAsync` to the barrier. |
| `carr[tr]`, `cdec` | Barrier state | `CrossTreeReceiverState.Arrived`, and `CrossTreeReceiverState.Decided` with `CrossTreeReceiverState.Committed`, published by `LatticeCrossTreeReceiverGrain.GetDecisionAsync` once durable. |
| `rfin`, `rtodo` | Owed receiver work | Trees the barrier's decided notify told to finalize, and leaves owed the terminal by a finalized registry. Production carries both inside the apply call and re-drives them through redelivery; the model keeps them as durable obligations. |
| `gone` | The record a shipper gap lost | A record a `WalRetention` trim passed before the shipper read it (issue #4534), or a batch the shipper could not encode, quarantined in `ReplicationShipperState.EncodeQuarantineFrom` and `ReplicationShipperState.EncodeQuarantineThrough` (#4651). Neither is ever shipped to the peer again. |
| `purged` | The origin's decision row is gone | The forgotten saga's decision purged from the origin tree's registry: the second of the two absences the replay filter reads. |
| `ptrim` | The origin WAL holds no prepare of the saga | `LatticeWalGc` has trimmed past every prepare of the saga, which is what `TxRegistryGrain.IsWalPurgeCleared` waits for. |
| `rs` | The peer's re-seed | `none`: on the log. `marked`: off the log, with `ReplicationShipperState.ReseedRequiredEpoch` set, saga records withheld, `ReplicationShipperState.ReseedRetainFrom` capping the published read positions and the replay hold taken. `drained`: the receiver has drained an export opened after the marker while every silo honoured the hold, and the shipper has not yet rewound. |
| `detached` | The peer's shipper is off the topology | `ReplicationShipperState.DetachedFromLog`. |
| `rpoison` | The receiver poisoned the saga | The saga's txid in the receiver tree's `IReceiverSagaPoisonGrain` set, with the re-seed it owes. |
| `losses` | Loss budget | Modelling bound: at most one loss path per behaviour. No production counterpart. |
| `preguard` | A silo predates the purge hold | `PurgeHoldSupport.AllSilosHonour` is false: some active silo hosts no `IWalPurgeHoldGrain`, so its registry predates #4553's guard and the hold, and purges on retention alone. |
| `filt`, `verdict` | The replay filter | `ReplicationShipperState.ReplayFilterHorizon` set by a bootstrap or a re-seed rewind, and the verdict the shipper took for the saga at first sight and keeps for the rest of the replay. |
| `afence`, `bfence` | An imported tree's read fence | The drain's durable read fence on the receiver tree (#4594), which a cross-tree import holds past the drain (`BootstrapCoordinatorState`, #4706, the fix for issue #4683) until no barrier indexed under the tree is undecided and every sibling tree has passed its boundary (#4716 and #4721, the fix for issue #4684). |
| `uimp[tr]` | A bare import's uniform-arrival mark | Issue #4684's R2 (#4716): the drained import's export epoch per receiver tree and origin, and the operations its rows name, recorded in the tree's barrier index; a barrier takes the tree's arrival with its siblings' verdict when that epoch is past the operation's decision stamp for the tree (`ReplicationCrossTreeDecisionStamper.StampAsync`) and the import named nothing of it. |
| `ubnd`, `abnd`, `acaught`, `bcaught` | R1's boundary | Issue #4684's R1 (#4721): each sibling tree's log and per-partition tails, captured at the end of the tree's export (`CrossTreeExportGate.CaptureSiblingBoundariesAsync`, `CrossTreeSiblingBoundary`), and passed once the sibling's shipper vouches acknowledged positions on that log at or past them (`ReplicationAckedPositions`), or once the sibling has been drained here from an export opened after the capture (`ILatticeBootstrapCoordinatorGrain.GetDrainedExportEpochAsync`; `acaught`, `bcaught`). The model's capture is at the boundary; production's, at every export's end, is later and so covers more. A shipper off the log advances no frontier, so its tree passes only the second way. |
| `decom`, `afresh`, `bfresh`, `dw` | A tree removed for good, then added back fresh | A decommission of the peer (`ILatticeReplicationPeerAdmin.DecommissionPeerAsync`, #4724, the fix for issue #4723): the origin un-enrols the peer and so releases its cross-tree holds (`ICrossTreePeerEnrolmentGrain.DecommissionAsync`), and the receiver abandons every undecided barrier from the peer, then settles each tree's buckets from it (#4740). Added back, each tree of the origin is a fresh replica, unreadable until its full bootstrap, which clears its stale buckets (#4701). `dw` holds the trees the decommission has still to walk, and `bfresh` is `afresh` for tree B. |
| `xo`, `xs` | The export of a cross-tree import of tree A | `xo`: the export is open, and whether the operation was decided at the origin when it opened - the open epoch C0 that issue #4684's R2 compares with the operation's decision stamp (#4716). `xs`: what the export closed with, its decision read and rows of one instant (`LatticeSnapshotProvider.EnumerateCompletionAsync`, #4694, the fix for issue #4685), and `cut`, tree A's records retained at the close, which the shipper may re-ship. |
| `idx`, `bclr`, `bdrop` | The barrier index entry and the barrier's retention | `idx`: the operation's barrier is listed in its trees' barrier indexes (`ICrossTreeBarrierIndexGrain`): indexed when the barrier opens, withdrawn best effort when it decides (`LatticeCrossTreeReceiverGrain.UnindexAsync`). `bclr`: the barrier's retention TTL has cleared its arrivals, keeping a tombstone of its verdict (#4732, the fix for issue #4730). `bdrop`: the tombstone was dropped once the origin's cross-tree purge frontier passed the operation (#4735, issue #4733). Tracked only on the slices that set `BarrierTtl` or `IndexFaults`; elsewhere the index is exactly the set of open, undecided barriers. |
| `boff`, `bpur` | Tree B off the log; tree B's decision row purged | `rs` and `purged` for tree B, on the loss path that takes both trees off the log at one boundary. |

## Action mapping

| Spec action | Protocol step | Code counterpart | Detector |
|-------------|---------------|------------------|----------|
| `OriginPrepare` | The origin's prepare fan-out, as replication records | `AtomicCommit`'s `PrepareTx` for the saga, plus every prepared write appended to the origin WAL with `WalRecord.IsPrepared` and the transaction id, which the shipper ships and `ReplicationApplier.ApplyAsync` routes to `IReplicationApplyGrain.ApplyPreparedSetAsync`. A cross-tree sub-saga registers its `TxRegistryState.ExternalAuthorities` row first (`TxRegistryGrain.RegisterExternalDecisionAuthorityAsync`). | Yes: `ReplicationApplierTests.ApplyAsync_routes_prepared_set_through_apply_grain_with_full_atomic_batch_metadata` pins a replicated prepare reaching the receiver as a prepared, transaction-scoped write. |
| `OriginDecide` | The origin records its decision | `AtomicCommit`'s `DecideTx`, `AtomicWriteGrain.RecordTerminalDecisionAsync`. Nothing is replicated by the decision itself: a receiver learns the outcome only from terminals. | Yes: `AtomicWriteGrainTests.RunSagaAsync_commit_records_the_decision_before_broadcasting_terminals`. |
| `OriginBroadcast(k)` | One source shard's terminal, as a replication record | `AtomicCommit`'s `BroadcastStep`, plus the terminal record `ShardRootGrain.AppendTxTerminalAsync` appends before its leaf fan-out, stamped with `WalRecord.AtomicShardCount` from `LatticeAtomicShardCountContext.Current`, which `AtomicWriteGrain.BroadcastTerminalsAsync` sets to the saga's touched-shard count. Every other caller of `ShardRootGrain.AppendTxTerminalAsync` (the split's retroactive sweep among them) writes a count of 0; the model has no such terminal, and `RAllOrNothingLegacyNoTallyMultiShard` shows what one does. A cross-tree sub-saga's local mark drops its `TxRegistryState.ExternalAuthorities` row before its terminals. | Yes: `AtomicWriteGrainTests.Committing_saga_stamps_its_touched_shard_count_on_every_terminal_it_broadcasts` and `AtomicWriteGrainTests.Aborting_saga_stamps_its_touched_shard_count_on_every_terminal_it_broadcasts`. |
| `OriginForget` | The origin retires the saga's registry row | `AtomicCommit`'s `ForgetDecision`, `ITxRegistryGrain.ForgetAsync`. Its only receiver consequence is what a later bootstrap export reports. | Yes: `TxRegistryGrainTests.ForgetAsync_drops_recorded_decision`. |
| `DeliverPrepare(m)` | A replicated prepare reaches its receiver leaf | `ReplicationApplier.ApplyAsync` -> `IReplicationApplyGrain.ApplyPreparedSetAsync`, which first settles the prepare against the receiver registry (`LatticeGrain.TrySettleReplicatedPrepareAsync`: `GetStatusForTerminalAsync`, the capture-gate-aware read (#4596), read through to `GetRecordedStatusAsync` on `Indeterminate`): applied as a committed write under `Committed`, dropped under `Aborted`, and otherwise staged in the leaf's pending bucket (issue #4482's fix, #4510). A prepare trailing the saga's terminal on that leaf is refused (`BPlusLeafGrain.IsLatePrepareForTerminalTransactionAsync`); the receiver registry forgets a decision only once no prepare of the saga is left to deliver (`ReceiverRetireImported`), so the settle stands in front of that refusal, which `RNoStrandedPrepareLatePrepareStaged` removes together with it. The transport the action stands in for delivers in any order, drops a delivery and duplicates on a lost ack, and never loses a record by itself: every loss is one of the loss-path actions below, each with its fix. Nothing is delivered while the peer is off the log, which both sides enforce: the sender withholds the peer's saga records, and the receiver refuses any that a pipelined push carried from before the marker (`ReplicationReseedResponder.RefusesStragglerAsync`). During a replay the shipper ships a record only under a ship verdict. A deferred prepare - neither applied nor acknowledged (#4633) - is this transport's lost delivery. | Yes: `CrossClusterAtomicVisibilityTests.Cross_cluster_prepared_set_lands_invisible_until_TxCommit_arrives` (staged and hidden), `BPlusLeafGrainTests.Prepared_set_trailing_its_sagas_terminal_is_refused` (the refusal), `BootstrapAtomicVisibilityTests.Pre_cut_prepare_reshipped_after_bootstrap_of_an_aborted_saga_is_dropped` and `BootstrapAtomicVisibilityTests.Pre_cut_prepare_reshipped_after_the_receivers_decision_retention_still_settles_against_the_exported_abort` (the settle's abort branch), and `BootstrapAtomicVisibilityTests.Pre_cut_prepare_reshipped_after_bootstrap_settles_against_the_exported_commit` and `BootstrapAtomicVisibilityTests.Pre_cut_prepare_settled_as_committed_stays_below_a_newer_write_on_the_key` (its commit branch, red once the receiver's apply cache is also neutralised: the cache otherwise dedupes the re-shipped prepare against the snapshot row it repeats, and it is per silo and bounded, so it does not stand in for the settle). The off-the-log refusal: `BootstrapAtomicVisibilityTests.Receiver_refuses_a_re_seeding_senders_saga_records_until_the_drain_consumes_the_request` and `LatticeReplicationGrpcServiceReseedTests.Push_of_a_saga_record_while_the_sender_awaits_a_reseed_is_refused_and_plain_records_apply`; the deferral: `ReceiverSagaDeferralIntegrationTests.Dead_lettered_prepare_is_deferred_so_the_saga_terminal_is_held_and_never_served_torn`. A prepare acknowledged unapplied with no fix behind it is `RAllOrNothingPrepareAckedUnapplied`. |
| `DeliverTerminal(m)` | A replicated source-shard terminal reaches the receiver registry | `IReplicationApplyGrain.ApplyTxTerminalAsync` -> `ITxRegistryGrain.RecordTerminalArrivalAsync`: the ungated legacy path (`TerminalArrivalTally.IsUngated`), the dedup set, `TerminalArrivalTally.MergeExpected`, `TerminalArrivalTally.IsFinalArrival`, and the mixed-outcome guard `TerminalDecisionGuard.Classify`. On a final tally a single-tree saga marks the registry (`TxRegistryWriteRetry.MarkDecisionAsync`) and owes the fan-out; a cross-tree saga hands off to the barrier. **The guard assumes a shard's terminal is delivered after that shard's outstanding prepares.** Production provides the stronger, saga-wide form: `ReplicationShipperGrain.MergeOneBatchAsync` pulls every terminal out of its per-tick merge into a hold, released only once the peer has acknowledged every prepare of that saga the WAL holds (`ReplicationShipperGrain.TerminalHold`), and a held terminal caps its partition's durable cursor so a restart re-reads it. Stated over outstanding records, so a prepare that left the outbox cannot hold its terminal back for ever; every way a prepare leaves the outbox unapplied takes the peer off the log or poisons the saga first, so no terminal is released over it. The same contract is kept on the receiver: a batch run defers a terminal behind a deferred prepare of the same saga (`ReplicationApplier.ApplyBatchAsync`, issue #4499, fixed by #4565), and a swept prepared bucket carries its saga's batch membership onto the destination WAL (`PendingMutationSnapshot.AtomicBatchSize`, #4565), so a peer tallies it. This module covers the built-in shipper's ordering; a bridge built on `IChangeFeed` relies on `ChangeFeed.Subscribe` yielding every terminal after its saga's prepares (issue #4511, fixed by #4519). Production's legacy (count-0) path returns before the mixed-outcome guard, so it accepts a conflicting legacy terminal the model refuses; the base never delivers one. A terminal of a saga the receiver poisoned stays unacknowledged until the re-seed retires the poison (#4633). A terminal that can never apply - malformed, contradicting the decision the receiver recorded, or failing every retry - is poisoned after a bound and re-seeded (#4695), and quarantined if it still fails after that re-seed (#4704): its saga is withheld, never served split. That is an input-integrity failure outside the model's transport, which never corrupts a record, so the liveness properties are claimed for well-formed records only. | Yes: `CrossClusterAtomicVisibilityTests.Multi_shard_saga_through_the_applier_stays_invisible_until_every_source_shard_terminal_arrives` and `TxRegistryGrainTerminalArrivalTests.RecordTerminalArrivalAsync_with_partial_tally_reports_not_final` pin the tally; `ReplicationShipperGrainTests.Terminal_does_not_overtake_a_prepare_landing_in_a_partition_read_empty_earlier_in_the_tick`, `ReplicationShipperGrainTests.Terminal_does_not_overtake_a_prepare_queued_behind_a_higher_hlc_entry`, `ReplicationShipperGrainTests.Terminal_is_not_applied_ahead_of_a_failed_pipelined_batch_that_carried_its_prepare` and `CrossClusterAtomicVisibilityTests.Saga_shipped_from_a_skewed_multi_partition_log_is_visible_whole_on_the_receiver` pin the ordering the guard assumes - the production analogue of `RAllOrNothingTerminalOvertakesPrepare` (issue #4480, fixed). The three shipper tests are red with the hold switched off. The skewed-log test is red only with the hold and the settle both off: the settle now materialises the late prepare under the committed registry, so without the hold production shows a transient split rather than a permanent one. `ReplicationApplierTests.ApplyBatchAsync_defers_a_terminal_behind_a_deferred_prepare_of_the_same_saga`, `PreparedBucketSweepBatchMembershipTests.Swept_prepare_reaches_the_destination_wal_with_its_atomic_batch_membership` and `ChangeFeedSagaTerminalOrderingTests.Subscribe_yields_terminal_after_a_prepare_with_a_later_hlc` pin the receiver deferral, the swept membership and the change feed. The poisoned saga's withheld terminal: `ReceiverSagaDeferralIntegrationTests.Later_terminal_of_a_poisoned_saga_is_withheld_not_applied` and `DeadLetterTrackingReplicationApplierTests.ApplyAsync_withholds_a_terminal_of_a_poisoned_saga_without_calling_inner_or_parking_it`; a deferred terminal: `ReceiverSagaDeferralIntegrationTests.Dead_lettered_terminal_is_deferred_and_redelivered_so_the_saga_is_not_stranded`. `RAllOrNothingPoisonedTerminalApplied` applies it; `RNoStrandedPrepareShipperDropsTerminal` loses a terminal with no fix behind it. The quarantine: `ReceiverSagaPoisonReseedIntegrationTests.A_malformed_terminal_that_fails_again_after_its_re_seed_quarantines_the_saga` and `ReceiverSagaPoisonReseedIntegrationTests.A_terminal_contradicting_the_decision_its_re_seed_recorded_quarantines_the_saga`. |
| `ReceiverRegister(tr)` | Step (a) of the barrier hand-off | `LatticeGrain.ApplyTxTerminalAsync` calling `TxRegistryGrain.RegisterReceiverDecisionAuthorityAsync`, strictly before the notify. A local decision already recorded supersedes it. | Yes: `LatticeGrainReplicationApplyTests.A_cross_tree_terminal_delegates_its_tree_to_the_barrier_until_every_tree_arrives` observes the delegation on the first tree's registry while the barrier waits. |
| `ReceiverNotify(tr)` | Step (b): the barrier records the tree and decides | `LatticeCrossTreeReceiverGrain.NotifyTerminalAsync`, through `CrossTreeReceiverBarrier.IsComplete` and `CrossTreeReceiverBarrier.CommitsAll`; it persists before it returns, which the model's single step stands for. A tree that stopped being replicated here is dropped from the wait set, and a barrier whose other trees have all arrived decides (`ILatticeCrossTreeReceiverGrain.NotifyParticipantAbsentAsync`, #4698). It also takes the arrival of a tree imported from an export opened after the operation's decision that named nothing of it, with its siblings' verdict, whenever the barrier opens or records an arrival and whenever a drain re-evaluates the barriers indexed under its tree; every carrier of the operation holds its full per-tree decision stamp vector (issue #4684's R2, #4716). The barrier indexes itself under every wait-set tree when it opens and withdraws, best effort, when it decides; a barrier already decided - one whose retention left only its tombstone included - answers a later arrival from its verdict and never reopens (#4732). A barrier never decides with no tree left to wait for. In production a barrier opens only with its opener's arrival, and a drop refuses an arrived tree, so its remainder always holds an arrival; #4740's guard refuses an empty remainder as defence in depth (issue #4741). | Yes: `LatticeCrossTreeReceiverGrainTests.NotifyTerminalAsync_first_of_two_trees_is_in_flight`, `LatticeCrossTreeReceiverGrainTests.NotifyTerminalAsync_any_abort_makes_the_global_verdict_aborted` and `CrossTreeReceiverBarrierTests.The_barrier_is_incomplete_until_every_wait_set_tree_has_arrived`. The drop: `LatticeCrossTreeReceiverGrainTests.NotifyParticipantAbsentAsync_decides_on_the_remaining_trees_once_they_have_all_arrived`. The uniform arrival: `CrossTreeImportBarrierIntegrationTests.A_stamped_barrier_that_opens_after_an_unnaming_import_from_after_the_decision_records_the_arrival`, `CrossTreeImportBarrierIntegrationTests.An_import_that_names_no_row_of_an_operation_a_sibling_already_arrived_at_records_its_arrival` (the drain's re-evaluation) and `CrossTreeDecisionHoldIntegrationTests.A_shipped_cross_tree_terminal_carries_the_full_decision_stamp_vector`. `RImportFenceLiftsBarrierIgnoresUniformImport` takes a uniform arrival at import time only, issue #4684's R2 as first built. A decided barrier answering a later arrival: `CrossTreeImportBarrierIntegrationTests.A_terminal_re_shipped_after_the_barrier_retention_does_not_reopen_it` and `CrossTreeImportBarrierIntegrationTests.A_re_drain_after_the_barrier_retention_whose_export_still_carries_the_decision_lifts_its_fence`. |
| `ReceiverFinalize(tr)` | A decided tree materializes its slice | `LatticeGrain.FinalizeCrossTreeTerminalCoreAsync` (inline for the notifying tree, `IReplicationApplyGrain.FinalizeCrossTreeTerminalAsync` for a sibling): `TxRegistryWriteRetry.MarkDecisionAsync` records the barrier's verdict, which drops the delegation row, then the fan-out is owed. | Yes: `LatticeGrainReplicationApplyTests.A_cross_tree_terminal_delegates_its_tree_to_the_barrier_until_every_tree_arrives`, which reads each tree's recorded decision before anything dials the barrier, because a dial caches the verdict itself and would hide a finalise that never marked the registry. |
| `ReceiverFanOut(k)` | One receiver leaf applies the recorded terminal | `LatticeGrain.ApplyTerminalPostGateAsync` -> `ShardRootGrain.AppendTxTerminalAsync` -> `BPlusLeafGrain.ApplyTxTerminalAsync`, whose bucket disposition is `MigrationTerminalCore.DecideBucketAction`. A leaf with no bucket records the terminal and materializes nothing (`BPlusLeafGrain.ApplyTxCommit`). | Yes: `LatticeGrainReplicationApplyTests.A_replicated_commit_terminal_drains_the_bucket_into_the_projection` and `LatticeGrainReplicationApplyTests.A_replicated_abort_terminal_discards_the_bucket`, which look at the leaves' buckets because a read cannot tell a drained bucket from one a committed registry surfaces. |
| `DialFault(tr)` | The receiver registry cannot reach the barrier | `TxRegistryGrain.ResolveReceiverDelegatedAsync`'s catch, answering `TxStatus.Indeterminate` and keeping the delegation row. Unfair and unordered: a failed grain call needs no ordering, so the model's guard - any time a delegation exists - is no stronger than production's. The point path answers this way, and since issue #4448's fix (#4461) so do the snapshot read paths (`TxRegistryGrain.SnapshotAsync`, `TxRegistryGrain.SnapshotWithRevisionAsync`), which carry the txid as `Indeterminate` rather than leave it out. | Yes: `TxRegistryGrainTests.GetStatusAsync_reports_indeterminate_when_the_receiver_coordinator_cannot_be_dialled` pins the point path, and `TxRegistryGrainTests.SnapshotAsync_reports_indeterminate_for_an_unreachable_receiver_coordinator` and `TxRegistryGrainTests.SnapshotWithRevisionAsync_reports_indeterminate_for_an_unreachable_receiver_coordinator` the snapshot paths. `RAllOrNothingSnapshotReadsUnresolvableAsInFlight` restores the omission and stands as #4448's regression check. |
| `ForeignOriginClaim(tr)` | The origin is handed its own cross-tree terminal | A caller of the public apply seam supplying the origin's own cluster id, which `ReplicationApplier.ApplyAsync` drops and `LatticeGrain.ApplyTxTerminalAsync` does not check; `TxRegistryGrain.ThrowIfWouldCoexist` refuses the registration. Enabled for the whole window the authoring row exists, which is every moment a coexistence could arise: before it there is no saga, and after it the tree's local decision supersedes any registration. | Yes: `TxRegistryGrainTests.RegisterReceiverDecisionAuthorityAsync_rejects_a_txid_already_delegated_outbound`. |
| `Bootstrap` | A fresh receiver joins through a snapshot | `LatticeSnapshotProvider.ExportAsync`: snap0 frozen first, then the prepared-row pass (`LatticeSnapshotProvider.EnumeratePreparedAsync`) and the committed-projection pass. A decided saga ships as committed rows, its still-resident buckets included, plus a decision row (`SnapshotEntry.SettledDecision`) the drain records in the receiver registry and never forgets (`LatticeBootstrapCoordinatorGrain.ApplySettledDecisionAsync`); a saga whose decision has aged out but is still stored ships by its recorded verdict (`ITxRegistryGrain.GetRecordedStatusAsync`, issue #4481's fix, #4501); an in-flight saga ships its buckets as prepared rows. A fresh bootstrap applies rows to a held shadow copy, mirrors receiver writes into it, and publishes the complete view with alias cutover only after reconciliation and incremental handoff (#4567); readers keep the original physical tree until that swap, which is the model's atomic import. Persisted legacy in-place imports retain the durable read fence (#4526). The shipper then resumes from its own cursors, so any retained subset of the pre-cut records is shipped again; `DeliverPrepare`'s settle consumes it (issue #4482's fix, #4510), and the replay filter, armed by the bootstrap (`ReplicationShipperGrain.BeginReplayFilterAsync`), withholds a purged saga whole. The replay waits while any silo predates the purge hold (`PurgeHoldSupport.AllSilosHonour`). In the cross-tree shape the export is opened and closed in steps of its own (`ExportOpen`, `ExportClose`) and the drain imports what it closed with, keeping every tree A record written after the close; the export's decision row names the operation and its participants, and the drain records the tree's arrival with the receiver barrier from it and keeps the held shadow unpublished past the drain (`LatticeBootstrapCoordinatorGrain.NotifyImportedCrossTreeArrivalAsync`, #4706, the fix for issue #4683); `FenceLift` publishes it once the barrier and sibling-boundary conditions are met. An import that names nothing of an operation decided before its export opened is the barrier's uniform arrival (`ReceiverNotify`), and no cross-tree export is served while a silo predates the cross-tree hold (`CrossTreeExportGate.EnsureMayExport`; the receiver applies the rule for an unstamped decision only to an export served under it, `RemoteSnapshotMetadata.CrossTreeHoldHonoured`), both issue #4684's fix (#4716). | Yes: `BootstrapAtomicVisibilityTests.ExportAsync_emits_prepared_rows_for_in_flight_saga` (the prepared rows); `BootstrapAtomicVisibilityTests.ExportAsync_ships_the_recorded_commit_when_the_decision_has_aged_out`, `BootstrapAtomicVisibilityTests.Receiver_bootstrapped_over_an_aged_out_commit_with_a_stranded_prepare_serves_the_saga_whole` and `BootstrapAtomicVisibilityTests.Pre_cut_prepare_reshipped_after_bootstrap_settles_against_the_exported_commit` in its aged-out case (the recorded verdict, #4501); `BootstrapAtomicVisibilityTests.Pre_cut_prepare_reshipped_after_bootstrap_of_an_aborted_saga_is_dropped` and `BootstrapAtomicVisibilityTests.Pre_cut_prepare_reshipped_after_the_receivers_decision_retention_still_settles_against_the_exported_abort` (the decision rows and the settle, #4510); `BootstrapReadFenceIntegrationTests.A_read_part_way_through_a_shadow_drain_keeps_the_original_view_readable` and `LatticeBootstrapCoordinatorGrainTests.A_drain_arms_the_read_fence_before_its_first_entry_and_lifts_it_after_its_last` (the legacy in-place read fence, #4594); `BootstrapShadowCopyIntegrationTests.Bootstrap_copy_keeps_original_view_until_complete` and `BootstrapShadowCopyIntegrationTests.Bootstrap_copy_abort_discards_staged_rows_and_keeps_original_view` (shadow publication and abort); `CrossClusterAtomicVisibilityTests.Shipper_stays_off_the_log_while_a_silo_predates_the_purge_hold` (the wait). `RAllOrNothingExportOverStrandedPrepare`, `RNoStrandedPrepareBootstrapReshipsPreCut` and `RNoStrandedPrepareBootstrapUnderPreHoldSilo` restore production before each fix. The cross-tree import: `CrossTreeImportBarrierIntegrationTests.The_export_names_the_cross_tree_operation_on_its_sub_saga_decision_row` and `CrossTreeImportBarrierIntegrationTests.Importing_one_cross_tree_participant_completes_the_barrier_its_sibling_delegated_to` (#4706); `RAllOrNothingCrossTreeImportSettlesLocally` restores production before it, and `RAllOrNothingCrossTreeImportUnfenced` serves the import unfenced. Issue #4684's: `CrossTreeImportBarrierIntegrationTests.An_import_whose_export_opened_before_the_decision_leaves_the_tree_pending` and `CrossTreeImportBarrierIntegrationTests.An_import_that_opened_after_the_decision_but_named_the_operation_leaves_the_tree_to_its_rows` (the uniform arrival's guards), `CrossTreeImportBarrierIntegrationTests.A_barrier_opened_by_an_imported_decision_row_judges_a_sibling_import_against_its_stamps` (the stamps an imported decision row carries, red when they are dropped before the barrier), `CrossTreeImportBarrierIntegrationTests.An_import_not_served_under_the_cross_tree_hold_is_never_taken_as_an_arrival` (the receiver's guard on an export the source did not serve under the cross-tree hold), `CrossTreeDecisionHoldIntegrationTests.While_a_silo_predates_the_hold_nothing_is_released_and_no_export_is_served` and `LatticeRemoteSnapshotGrpcServiceFailureTests.A_deferred_export_surfaces_as_unavailable_which_the_receiver_retries` (the precondition). `RAllOrNothingUniformArrivalFromExportBeforeDecision` drops the opened-after-the-decision guard, and `RAllOrNothingCrossTreeExportUnderPreHoldSilo` serves a cross-tree export while a silo predates the hold. |
| `OriginPurge` | The origin registry purges a forgotten saga's decision row | Retention purging the forgotten saga's decision from the origin tree's registry. A guarded registry purges only once `LatticeWalGc` has trimmed past every prepare of the saga (`TxRegistryGrain.IsWalPurgeCleared`, issue #4508's fix, #4553) - the GC trims a prepare once no registered shipper's durable position needs it, freely while none is registered, and never past the records a peer off the log withheld (`ReplicationShipperState.ReseedRetainFrom`); the model takes that trim and the purge as one step - and suspends every purge while the tree has a purge hold (`IWalPurgeHoldGrain`): the replay hold from the re-seed marker until the replay clears (#4533) and the forced-trim hold a WAL GC records before trimming past a shipper (#4534-B, released by `WalPurgeHoldGrain.ReleaseIfCoveredAsync` once the shipper's durable position covers the trim). A registry on a silo that predates the hold purges on retention alone. A cross-tree sub-saga's decision is also held (`ReplicationCrossTreeDecisionHold.MayPurgeAsync`, issue #4684's fix, #4716) until every peer of every participant tree - its configured peers and every peer that ever attached a shipper (`ICrossTreePeerEnrolmentGrain`) - has durably acknowledged past that participant's terminal, which the receiver does only after the barrier recorded it; a detached peer holds. A decommission un-enrols the peer, which releases the hold for it (`ICrossTreePeerEnrolmentGrain.DecommissionAsync`, #4724). An open export holds the tree's purges too (`ExportOpen`, #4694). The origin's purge frontier is a sound release for a barrier's tombstone (`TombstoneDrop`) whatever the hold waited for: a tree's decision is purged only once its WAL is trimmed past every record of the operation, terminals included, so none ships again after the drop. A decommission releases the hold before the peer acknowledges, which is why `TombstoneDrop` states that directly (`RImportFenceLiftsTombstoneDropsOverShippableTerminal`). | Yes: `TxRegistryWalPurgeGuardTests.Replicated_tree_holds_an_aged_out_decision_until_the_wal_trims_past_its_prepare` and `TxRegistryWalPurgeGuardTests.Replicated_tree_with_zero_retention_still_holds_the_decision_until_the_wal_trims` (the guard); `CrossClusterAtomicVisibilityTests.Reseed_holds_decision_purges_from_before_the_marker_until_the_replay_clears` (the replay hold); `WalGcShipperOffsetFloorTests.Retention_trim_past_a_shipper_records_its_purge_hold_before_the_trim` (the forced-trim hold); `TxRegistryWalPurgeGuardTests.Outstanding_purge_hold_suspends_every_purge_until_it_is_removed` (the registry honouring a hold, which the replication-side hold detectors stub); `CrossClusterAtomicVisibilityTests.Saga_records_withheld_for_a_reseed_stay_retained_for_its_rewind` (the withheld records). `RNoStrandedPreparePurgeIgnoresHold` removes the hold. Removing the guard alone leaves every property holding, because the replay filter then withholds the purged saga's retained prepare; `RNoStrandedPrepareDedupeOverPurgedDecision` removes both. The cross-tree hold: `CrossTreeDecisionHoldIntegrationTests.A_cross_tree_sub_saga_decision_is_held_until_the_peer_of_its_sibling_tree_acknowledged_past_it` and `CrossTreeImportBarrierIntegrationTests.The_receiver_acknowledges_a_cross_tree_terminal_only_after_the_barrier_recorded_it`; `RAllOrNothingCrossTreePurgeBeforeBarrierDecides` removes it and `RAllOrNothingCrossTreeHoldReleasedOnDetach` releases it on a detach. |
| `UpgradeDone` | Every silo comes to honour the purge hold | Every active silo in the cluster manifest hosting `IWalPurgeHoldGrain`, which ships with the registry that reads holds (`PurgeHoldSupport.AllSilosHonour`). The model starts with a silo that predates it, which loses nothing: this step may come first. A pre-hold silo that joins later makes the shipper take the peer off the log again, which the model reaches as `ShipperGap`. It is a boundary for the cross-tree import too: no cross-tree export is served before it (`CrossTreeExportGate.EnsureMayExport`), and the records outstanding at it are what an imported tree's fence waits on its siblings to pass (`FenceLift`, #4716 and #4721). | Yes: `CrossClusterAtomicVisibilityTests.Shipper_stays_off_the_log_while_a_silo_predates_the_purge_hold` and `CrossClusterAtomicVisibilityTests.Replay_takes_the_peer_off_the_log_when_a_silo_that_predates_the_purge_hold_joins`. `RCommittedEventuallyVisibleUpgradeNeverSeen` never observes the upgrade. The cross-tree precondition: `CrossTreeDecisionHoldIntegrationTests.While_a_silo_predates_the_hold_nothing_is_released_and_no_export_is_served`. |
| `ShipperGap(m)` | The shipper loses a record and takes the peer off the log | A `WalRetention` trim past the shipper's durable read position (issue #4534), detected as a forced gap since #4577, or a batch the shipper cannot encode (#4651). Both go through `ReplicationShipperGrain.TakePeerOffLogStateAsync`, one durable write: the replay hold, the export-epoch marker (`ReplicationShipperState.ReseedRequiredEpoch`, raised if one is already set), `ReplicationShipperState.ReseedRetainFrom`, saga records withheld, and the re-seed request on every push and probe. A trimmed record is gone; a quarantined batch is skipped by the rewind (`ReplicationShipperState.EncodeQuarantineFrom`), and the export carries its writes. A trim below the shipper's read position without the TTL can no longer happen (issue #4579, fixed by #4595). | Yes: `CrossClusterAtomicVisibilityTests.Shipper_asks_a_peer_it_took_off_the_log_to_reseed_and_resumes_once_it_has`, `SourceWalTrimFallOffIntegrationTests.Receiver_behind_a_source_wal_trim_is_re_seeded_and_converges`, `ReplicationShipperGrainTests.Encode_failure_takes_the_peer_off_the_log_and_quarantines_the_batch`, `ReplicationShipperGrainTests.Terminal_of_a_saga_that_lost_a_prepare_does_not_reach_the_peer_before_the_re_seed`, `ReplicationShipperGrainTests.Later_prepare_of_a_saga_that_lost_a_prepare_is_withheld_until_the_re_seed` and `ReplicationShipperGrainTests.After_the_re_seed_the_rewind_skips_the_quarantined_batch_and_the_saga_commits`; #4579's fix is pinned by `WalGcShipperOffsetFloorTests.Gc_retains_an_unshipped_entry_stamped_below_the_shipper_cursor_after_its_leaf_checkpoints`, red when the GC's offset-reader clause is removed. `RAllOrNothingGapStaysOnLog` leaves the peer on the log. |
| `Detach` | A removed peer's shipper leaves the log | `IReplicationShipperGrain.DetachFromLogAsync` on a topology removal (#4534-B): one write sets `ReplicationShipperState.DetachedFromLog` and takes the peer off the log, then the shipper leaves the WAL's offset consumers and releases its forced-trim and replay holds. While detached the GC trims freely, purges are not held, and `ReplicationShipperGrain.MaybeClearReseedAsync` never rewinds. The cross-tree purge hold survives a detach: the peer stays enrolled and a detached shipper publishes no position (`OriginPurge`, #4716). | Yes: `WalGcShipperOffsetFloorTests.Detaching_a_removed_peers_shipper_releases_its_purge_hold_and_the_log`, and `CrossClusterAtomicVisibilityTests.Detached_shipper_does_not_rewind_when_its_peer_echoes_a_later_epoch`, red when a detached shipper clears its re-seed and rewinds on a later-epoch echo. `RAllOrNothingDetachStaysOnLog` leaves the peer on the log, and `RAllOrNothingRewindWhileDetached` rewinds while detached. The cross-tree hold kept through a detach: `DecommissionPeerIntegrationTests.Decommissioning_the_peer_releases_a_cross_tree_decision_hold_it_was_pinning`, whose precondition - the decision outlives its retention while the removed peer is still enrolled - is red when the hold ignores the enrolment, and `CrossTreeDecisionHoldIntegrationTests.The_hold_compares_only_the_partitions_a_shipper_reads_and_holds_on_no_published_position` for the position a detached shipper does not publish. |
| `Readd` | A detached peer returns to the topology | The shipper re-attaching on its next activation: it re-takes the replay hold and raises the marker to the current export epoch, so no export drained while it was detached settles the re-seed, then clears `ReplicationShipperState.DetachedFromLog`. **Liveness carve-out:** the module assumes an operator eventually re-adds or decommissions a detached peer (weak fairness on `Readd` and `Decommission`), as the `Decommission` row states. | Yes: `WalGcShipperOffsetFloorTests.Detaching_a_removed_peers_shipper_releases_its_purge_hold_and_the_log`, which re-adds the peer and asks for a re-seed past an export taken while it was detached. `RNoStrandedPrepareReaddKeepsDetachedDrain` lets that export settle it. |
| `ReceiverPoison(m)` | The receiver gives up on a prepare | `DeadLetterTrackingReplicationApplier`: a saga prepare deferred past the saga deferral timeout, or named by `ILatticeReplicationDeadLetters.PoisonSagaAsync`, is parked and acknowledged, its txid poisoned in `IReceiverSagaPoisonGrain`, and a re-seed started (#4633, the fix for issue #4591). Only a prepare, and never for a saga the receiver registry has recorded a decision for (`GetRecordedStatusAsync`). | Yes: `ReceiverSagaDeferralIntegrationTests.Later_terminal_of_a_poisoned_saga_is_withheld_not_applied` and `ReceiverSagaPoisonGrainTests.PoisonAsync_records_reseed_owed_and_filter_returns_poisoned_subset`. `RAllOrNothingReceiverParksWithoutPoison` parks and acknowledges the prepare without poisoning the saga, which is issue #4591 as it stood. The registry guard is defence in depth here: removing it leaves every property holding, because a receiver registry decides only on a final tally, after every prepare of the saga has arrived. |
| `PoisonReseed` | The poisoned saga's re-seed | `ReceiverSagaPoisonReseed.TryStartOrMarkOwedAsync` starts the receiver's bootstrap from the origin, retried by the maintenance tick while it is owed. A plain bootstrap drain behind the read fence; at the drain the coordinator keeps the buckets of a poisoned saga the export shipped as prepared rows and discards every other poisoned saga's stale buckets with no registry outcome (`BPlusLeafGrain.DiscardPendingTransactionAsync`, with a durable per-leaf replay marker), and the poison retires. A cross-tree import does as `Bootstrap`'s: the same drain. | Yes: `ReceiverSagaPoisonReseedIntegrationTests.Poison_then_re_seed_of_an_in_flight_saga_restages_it_and_its_terminal_commits_it_whole` and `ReceiverSagaPoisonReseedIntegrationTests.Poison_then_re_seed_leaves_no_stranded_bucket_and_the_saga_visible_whole`. `RAllOrNothingPoisonSettleDiscardsCarried` discards a carried saga's buckets. Discarding a non-carried saga's buckets is defence in depth in the model: its withheld terminals drain them once the poison retires. The cross-tree import is the `Bootstrap` row's, with its detectors. |
| `ReseedDrain` | The receiver drains the re-seed's export | The receiver's bootstrap from an export opened after the marker, which `LatticeBootstrapCoordinatorGrain` drains behind the read fence (#4594). Taken atomically: nothing of the saga reaches the receiver between the export and its drain, since the sender withholds and the receiver refuses stragglers, and the export's late-decision pass ships a decision row for a saga it carried that decided while it ran (issue #4627), so the export's decision read and its rows are of one instant. The drain applies the rows, then settles every leftover bucket from the source through a durable terminal mark: drained by an exported or local decision, discarded with no registry outcome when the export names its saga in no row (`StalePendingClearer`, #4533). Only an export opened after the marker counts (its epoch above `ReplicationShipperState.ReseedRequiredEpoch`), and none opened before the first tick on which every silo honoured the purge hold (`ReplicationShipperState.ReseedSpansPreHoldSilo`, issue #4664's fix, #4666). A cross-tree import does as `Bootstrap`'s: the same drain. | Yes: `BootstrapAtomicVisibilityTests.Reseed_clear_discards_a_purged_sagas_buckets_and_leaves_carried_and_foreign_ones`, `BootstrapAtomicVisibilityTests.Reseed_clear_drains_a_leftover_bucket_by_the_exported_decision`, `BootstrapAtomicVisibilityTests.Saga_undecided_at_the_cut_survives_the_reseed_clear_and_commits_after_it`, `BootstrapAtomicVisibilityTests.Export_ships_the_decision_of_a_saga_that_decides_mid_export_so_the_receiver_never_serves_it_split` (#4627), `LatticeBootstrapCoordinatorGrainTests.Drain_from_an_export_after_the_reseed_request_consumes_it`, `LatticeBootstrapCoordinatorGrainTests.Bootstrap_completing_with_an_unconsumed_reseed_request_does_not_echo_its_epoch`, `CrossClusterAtomicVisibilityTests.Bootstrap_whose_export_opened_before_the_reseed_epoch_does_not_clear_the_marker` and `CrossClusterAtomicVisibilityTests.A_reseed_deferred_for_a_pre_hold_silo_does_not_settle_on_an_export_drained_before_the_upgrade` (#4666). That detector is double-guarded: it goes red when no silo is seen to predate the purge hold, or when both the shipper's pre-hold guard and the replay filter's own pre-hold re-mark are bypassed, but not when the guard alone is, because the re-mark takes the peer off the log again before the next merge ships anything. The clearer's own tests hand it a carried set directly, so the coordinator's derivation of that set from the export it drains is pinned end to end by `ReceiverSagaPoisonReseedIntegrationTests.Reseed_drain_keeps_a_saga_its_export_carried_in_flight_and_its_terminal_commits_it_whole`, red when the coordinator hands the clearer an empty carried set. `RNoStrandedPrepareReseedKeepsStaleBucket`, `RAllOrNothingReseedClearsCarriedBucket`, `RNoStrandedPrepareDecisionRowNotFannedOut`, `RAllOrNothingExportDecisionReadStale` and `RNoStrandedPrepareDrainUnderPreHoldSiloSettles` restore production before each fix. The cross-tree import is the `Bootstrap` row's, with its detectors. |
| `ReseedRewind` | The shipper rewinds and replays | `ReplicationShipperGrain.MaybeClearReseedAsync` at the end of the pump tick (issue #4606), on an ack echoing an export epoch above the marker: never while detached and never while a silo predates the hold, it rewinds every partition to its lowest retained record, clears the marker and arms the replay filter (`ReplicationShipperGrain.BeginReplayFilterAsync`). A retention trim past the records it withheld re-marks the peer instead. The model's own pre-hold check here is subsumed by `ReseedDrain`'s: removing it leaves every property holding. | Yes: `CrossClusterAtomicVisibilityTests.Pipelined_shipper_clears_the_reseed_once_the_peer_echoes_a_later_epoch`, `CrossClusterAtomicVisibilityTests.Quiet_shipper_clears_the_reseed_from_a_liveness_probe_echo`, `CrossClusterAtomicVisibilityTests.Saga_records_withheld_for_a_reseed_stay_retained_for_its_rewind` and `CrossClusterAtomicVisibilityTests.A_trim_past_withheld_records_takes_the_peer_off_the_log_again_instead_of_rewinding`. `RNoStrandedPrepareWithheldRecordsNotRetained` loses the withheld records before the rewind. |
| `ReplayWithhold(m)` | The replay filter withholds a purged saga | `ReplicationShipperGrain.TryWithholdReplayedSagaAsync` (#4533), active while `ReplicationShipperState.ReplayFilterHorizon` is set: at first sight it reads the saga's participant row and then its decision, and a saga with neither - forgotten, then purged - is withheld whole for the rest of the replay; any other ships. Forget follows the decision and purge follows forget, so the two reads in that order are the model's single read. A replay with no snapshot behind it (a rebind) or begun by an earlier activation re-seeds the peer instead. | Yes: `CrossClusterAtomicVisibilityTests.Reseed_replay_withholds_a_purged_saga_whole_and_ships_live_and_decided_sagas`, `CrossClusterAtomicVisibilityTests.Rebind_replay_that_meets_a_purged_saga_re_seeds_the_peer`, `CrossClusterAtomicVisibilityTests.Replay_resumed_by_a_new_activation_that_meets_a_purged_saga_re_seeds_the_peer`, and the participant row it reads: `TxRegistryGrainTests.A_later_shards_failed_registration_keeps_the_landed_shards_participant_row` and `TxRegistryGrainTests.A_failed_first_registration_fails_every_queued_registration_and_leaves_no_row`. `RNoStrandedPrepareReplayVerdictReadsDecisionOnly` skips the participant row, and `RNoStrandedPrepareReplayFilterOff` removes the filter. |
| `FilterClear` | The replay passes its horizon | Every cursor past `ReplicationShipperState.ReplayFilterHorizon` with no re-seed outstanding: the filter clears and the replay hold is released (`ReplicationShipperGrain.MaybeReleaseReplayHoldAsync`). | Yes: `CrossClusterAtomicVisibilityTests.Reseed_holds_decision_purges_from_before_the_marker_until_the_replay_clears`, which checks at every tick after the rewind that the replay hold is still recorded until the replay passes its horizon, and that it is released once it has: red when the hold is released at the rewind. `RNoStrandedPrepareFilterClearsBeforeHorizon` clears the filter early. |
| `ReceiverRetireImported(tr)` | The receiver forgets a decision row a bootstrap import recorded | `ImportedDecisionRetirementGrain.RetireAsync` (issue #4524): the drain registers the txids it recorded (`LatticeBootstrapCoordinatorGrain.RegisterImportedDecisionsAsync`) with the boundary the export carried on its trailer (`RemoteSnapshotStreamItem.ExportBoundary`, captured after its last entry by `CrossTreeExportGate.CaptureExportBoundaryAsync`), and forgets them (`ITxRegistryGrain.ForgetAsync`) only once the shipper from that source vouches acknowledged positions on the captured log at or past every tail (`ReplicationAckedPositions.CoversTails`, #4684). The positions are cleared when an import replaces the tree, are shipped only while the peer is on the log with no replay filter or re-seed outstanding, and pass a tail only once every earlier record is acknowledged; every pre-cut prepare is below the tails, so none is left to deliver - the model's guard. A source whose export carried no boundary (an older sender) is retained. The model retires any decided row under that guard and does not wait on a pre-cut terminal, an over-approximation of the gate. | Yes: `ImportedDecisionRetirementIntegrationTests.Imported_decision_rows_are_retained_until_the_stream_passes_the_exports_cut_then_retired` (retained with no positions and one position short of the cut, retired at the tails), `ImportedDecisionRetirementIntegrationTests.Positions_on_another_log_do_not_retire_imported_rows` and `ImportedDecisionRetirementIntegrationTests.Rows_from_a_source_that_captured_no_cut_are_retained_and_an_empty_cut_retires_at_once`; the settle a retained row serves: `BootstrapAtomicVisibilityTests.Pre_cut_prepare_reshipped_after_the_receivers_decision_retention_still_settles_against_the_exported_abort`. `RNoStrandedPrepareRetireImportedBeforeCut` forgets the row while a pre-cut prepare is still in the outbox. |
| `Decommission` | A detached peer is removed from replication for good: the abandon phase | The operator's decommission of the peer (`ILatticeReplicationPeerAdmin.DecommissionPeerAsync`, #4724, the fix for issue #4723): the origin un-enrols the peer from every tree, which releases its cross-tree purge holds (`ICrossTreePeerEnrolmentGrain.DecommissionAsync`). On a receiving cluster (`LatticeReplicationPeerDecommissioner`, #4740, the fix for issue #4736) it first abandons, per barrier and before any bucket is touched, every undecided barrier from that peer: the barrier withdraws its index entries and clears to unopened, taking no decision, so every tree of the origin leaves it at once and each tree's registry answers from its own row again (issue #4742's fix). A decided barrier is left to finalize its trees. The decommission is marked first, so no read fence of the origin lifts while it stands (`FenceLift`) and re-enrolment is refused until the peer is re-added (`CrossTreePeerEnrolmentGrain.EnrolAsync`). The model takes every tree of the origin in one step; the per-tree bucket pass is `DecomWalk`. **Liveness carve-out:** the module assumes an operator eventually decommissions or re-adds a detached peer (weak fairness on `Decommission` and `Readd`); one left detached for ever keeps the origin's cross-tree purge holds for as long, which is safe. | Yes: `DecommissionPeerIntegrationTests.Decommissioning_the_peer_releases_a_cross_tree_decision_hold_it_was_pinning` (the origin's release), `DecommissionPeerIntegrationTests.Detaching_the_peer_from_the_log_does_not_decommission_it` (a detach keeps the hold), `DecommissionPeerIntegrationTests.Decommissioning_the_peer_unblocks_a_receiver_side_barrier_that_was_still_waiting_on_it` (the abandon), `DecommissionPeerIntegrationTests.Decommission_drains_a_decided_cross_tree_operation_whose_finalize_never_ran_on_every_tree` (a decided barrier is left to finalize its trees), `DecommissionPeerIntegrationTests.Decommission_serves_a_cross_tree_operation_all_or_nothing_whatever_the_tree_order` (issue #4742: the abandon precedes every tree's pass, in either order) and `DecommissionPeerIntegrationTests.A_decommissioned_peer_cannot_re_enrol_without_a_fresh_bootstrap` (the re-enrolment gate). `RAllOrNothingDecommissionWalksTreeByTree` drops each tree from its barriers as the walk reaches it and decides on the trees that remain, issue #4742 as filed: one walk order serves a committed operation split. |
| `DecomWalk(tr)` | The decommission's pass over one tree | The decommission's per-tree pass, in registry order, which the model leaves arbitrary (`LatticeReplicationPeerDecommissioner`, #4740): each of the peer's pending buckets on the tree is settled by the tree's registry (`StalePendingClearer`, #4701), drained under a committed verdict and otherwise discarded. The verdict is the delegation-aware one (`ITxRegistryGrain.GetStatusManyAsync`, in owner-routed windows of at most 128): a tree delegated to a barrier that decided answers with the barrier's verdict, and one whose barrier cannot be dialled answers `Indeterminate`, so the pass is retried. | Yes: `DecommissionPeerIntegrationTests.Decommissioning_the_peer_discards_its_pending_buckets_whose_terminals_never_arrived`, `DecommissionPeerIntegrationTests.Decommission_serves_a_cross_tree_operation_all_or_nothing_whatever_the_tree_order` and `DecommissionPeerIntegrationTests.Decommission_drains_a_decided_cross_tree_operation_whose_finalize_never_ran_on_every_tree` (a tree whose finalize never ran drains by the barrier's committed verdict). `RNoStrandedPrepareDecommissionKeepsBuckets` keeps the peer's pending buckets, which a tree staged before its terminal arrived; `RAllOrNothingDecommissionClearsByLocalStatus` settles a tree delegated to a decided barrier by its own undecided row. |
| `ReaddFresh` | The decommissioned peer is added back as a fresh replica | The peer re-added after a decommission: the re-add (`PeerChangeKind.Added`, `ReplicationDriverActivationService`) abandons every barrier from that origin, its tombstones included, before clearing the decommissioned mark (#4740), and each tree takes a fresh shadow bootstrap whose drain first clears every stale bucket from that origin (#4701); the original physical tree remains readable until the imported copy is published. A tree added to the peer is a new R1 boundary (#4721); every tree of the origin is added back here and each passes it by its own fresh import, so the model tracks no sibling record at the re-add. | Yes: `ReapedSourceDeleteReconcileIntegrationTests.A_re_added_tree_bootstraps_as_a_fresh_replica_with_no_leftover_bucket_from_the_origin`, `ReapedSourceDeleteReconcileIntegrationTests.A_plain_bootstrap_keeps_the_bucket_of_a_saga_staged_after_the_export_opened`, `DecommissionPeerIntegrationTests.A_peer_re_added_after_decommission_is_a_fresh_bootstrap_not_a_resumed_one` and `DecommissionPeerIntegrationTests.Re_adding_a_decommissioned_peer_resets_a_barrier_a_late_terminal_reopened_so_the_fence_lifts` (the barrier reset) and `CrossTreeImportBarrierIntegrationTests.Re_adding_a_decommissioned_source_re_drives_its_held_import_and_publishes_after_the_barrier_decides` (the re-drive of a held import). `RAllOrNothingFreshReaddReadableBeforeBootstrap` serves the trees before their fresh imports. `RAllOrNothingFreshReaddNoBoundary`, which took no boundary at the re-add, is retired: every tree of the origin is re-added together and each passes the boundary by its own fresh import, so it no longer fires. The boundary itself: `CrossTreeSiblingBoundaryIntegrationTests.A_tree_remains_readable_while_its_sibling_waits_for_an_export_opened_after_capture`. |
| `MutualOffLog` | Both trees' shippers take the peer off the log | Each tree's shipper taking the peer off the log (`ReplicationShipperGrain.TakePeerOffLogStateAsync`) for a record of its own it lost - of this saga or another - while a silo predates the purge hold, so the peer needs a re-seed of both trees at one boundary: the case in which issue #4684's R1, built as an import gate, deadlocked, and why #4721 made it a condition on the fence instead. A shipper off the log holds its positions at `ReplicationShipperState.ReseedRetainFrom`, so it acknowledges none of the records it withholds. | Yes: `CrossClusterAtomicVisibilityTests.Saga_records_withheld_for_a_reseed_stay_retained_for_its_rewind` and `ReplicationShipperGrainTests.Later_prepare_of_a_saga_that_lost_a_prepare_is_withheld_until_the_re_seed`. `RAllOrNothingOffLogShipperAcksWithheldRecords` counts the withheld records as acknowledged. |
| `TreeReseed(tr)` | A tree re-seeded alongside its sibling | Each tree's re-seed on that path: `ReseedDrain` then `ReseedRewind` for the tree, taken as one step because every purge precedes the boundary, so the replay filter's verdict is fixed before the export opens. The fresh import stages rows on a held shadow copy and, cross-tree, records its arrival as `Bootstrap` does; the original view remains readable until publication. Neither tree's import waits on the other's: a sibling counts as past its boundary once it is drained, before its own shadow is published (`ILatticeBootstrapCoordinatorGrain.GetDrainedExportEpochAsync`, #4721), and a sibling that never passes is re-seeded automatically. | Yes: `SourceWalTrimFallOffIntegrationTests.Receiver_behind_a_source_wal_trim_is_re_seeded_and_converges` and `CrossTreeImportBarrierIntegrationTests.An_imported_cross_tree_participant_keeps_the_original_view_until_its_sibling_terminal_arrives`. `RAllOrNothingMutualReseedUnfenced` serves the import unfenced, and `RCommittedEventuallyVisibleReseedWaitsOnSibling` makes the import wait on the sibling's boundary, issue #4684's R1 as first designed, under which two re-seeds wait on each other for ever. The mutual wait: `CrossTreeSiblingBoundaryIntegrationTests.A_sibling_import_whose_own_fence_is_held_still_passes_the_boundary_once_drained` and `CrossTreeSiblingBoundaryIntegrationTests.A_sibling_that_never_passes_is_re_seeded_automatically`. |
| `BarrierTtlExpire` | A decided barrier's retention expires | `LatticeCrossTreeReceiverGrain`'s retention TTL (`OnTtlExpiredAsync`), armed once its decision is durable: it withdraws the barrier from every wait-set tree's index first, skipping the clear if that fails, then clears the arrivals and keeps a tombstone of its verdict (#4732, the fix for issue #4730). | Yes: `CrossTreeImportBarrierIntegrationTests.A_barrier_whose_retention_expires_withdraws_its_index_entries_before_it_clears`, `CrossTreeImportBarrierIntegrationTests.A_terminal_re_shipped_after_the_barrier_retention_does_not_reopen_it` and `CrossTreeImportBarrierIntegrationTests.A_re_drain_after_the_barrier_retention_whose_export_still_carries_the_decision_lifts_its_fence`. `RImportFenceLiftsTombstoneDroppedAtTtl` clears the verdict too, the third route of issue #4730, and `RImportFenceLiftsStaleIndexEntry` clears without withdrawing under a reader that does not settle. Withdrawing before the clear is defence in depth in the model: with the tombstone and the settle, an entry left behind holds nothing. |
| `TombstoneDrop` | A decided barrier's tombstone is dropped | The receiver's sweep of a tree's tombstones when the origin's cross-tree purge frontier advances (`CrossTreePurgeFrontierGrain`, #4735, issue #4733): a tombstone drops once every participant's frontier has passed the operation's decision sequence, the origin then storing its decision on no participant, so no export carries its row and the replay filter withholds it whole. A purge on a tree waits until its WAL is trimmed past every record of the operation, terminals included (#4508), so no terminal of it is left to ship; the model states that directly, because its purge trims only prepares and a decommission releases the cross-tree hold that otherwise saw every terminal acknowledged first. The frontier rides the origin-authenticated source-frontier header from configured peers. A tombstone of an operation decided before sequencing counts as sequence 0, and one from a barrier that recorded no participants is kept: bounded residues, logged at each sweep. | Yes: `TxRegistryWalPurgeGuardTests.Replicated_tree_holds_an_aged_out_decision_until_the_wal_trims_past_its_terminal` (the purge waits for the WAL to trim past the operation's terminal, which is what leaves no terminal to ship once the frontier passes), `CrossTreeImportBarrierIntegrationTests.A_tombstone_is_kept_until_the_origin_purge_frontier_passes_every_participant`, `CrossTreeImportBarrierIntegrationTests.A_tombstone_whose_frontier_already_passed_drops_when_its_retention_runs`, `CrossTreeImportBarrierIntegrationTests.A_tombstone_of_an_operation_decided_before_sequencing_drops_once_no_such_decision_remains`, `CrossTreeImportBarrierIntegrationTests.The_purge_frontier_only_advances`, `CrossTreeDecisionHoldIntegrationTests.The_purge_frontier_stays_below_a_stored_cross_tree_decision_and_passes_it_once_purged`, `CrossTreeDecisionHoldIntegrationTests.A_pending_sequence_holds_the_purge_frontier_below_it_until_confirmed`, `CrossTreeDecisionHoldIntegrationTests.A_cross_tree_decision_stored_before_sequencing_holds_the_purge_frontier_below_zero`, `CrossTreeDecisionHoldIntegrationTests.A_shipper_advertises_the_cross_tree_purge_frontier_beside_its_batches`, `LatticeReplicationGrpcServiceSourceFrontierTests.A_purge_frontier_on_a_call_whose_origin_is_not_authenticated_as_the_body_origin_is_never_read` and `LatticeReplicationGrpcServiceSourceFrontierTests.A_purge_frontier_from_a_peer_that_is_not_configured_is_ignored`. `RImportFenceLiftsTombstoneDroppedBeforeFrontier` drops the tombstone with no frontier. `RImportFenceLiftsTombstoneDropsOverShippableTerminal` drops the tombstone with a terminal still to ship. `RImportFenceLiftsPurgeBeforeTerminalsAcked`, which released the cross-tree hold on the barrier's decision alone, is retired: with the frontier stated over the terminals left to ship, it no longer fires. |
| `ExportOpen` | The export of a cross-tree import of tree A opens | `LatticeSnapshotProvider.ExportAsync` reading the tree's export epoch (C0) before snap0 and taking the tree's decision purge hold for the export (`LatticeSnapshotProvider.EnumerateHeldAsync`, #4694); no cross-tree export opens while a silo predates the hold (`CrossTreeExportGate.EnsureMayExport`). Whether the operation was decided before C0 is what the drain's barrier compares with the operation's decision stamp (#4716). | Yes: `BootstrapAtomicVisibilityTests.Export_holds_the_tree_decision_purges_while_it_reads_and_releases_them_when_done`, `CrossTreeImportBarrierIntegrationTests.An_import_whose_export_opened_before_the_decision_leaves_the_tree_pending` and `CrossTreeDecisionHoldIntegrationTests.While_a_silo_predates_the_hold_nothing_is_released_and_no_export_is_served`. `RAllOrNothingExportOpenPastEveryDecision` records no open point, `RAllOrNothingCrossTreeExportUnderPreHoldSilo` opens one while a silo predates the hold, and `RAllOrNothingUniformArrivalGuardAtImport` takes R2's guard at the import instead of the open. |
| `ExportClose` | The export closes: its decision read and its rows of one instant | The export's prepared and committed passes, completed from the source WAL (`LatticeSnapshotProvider.EnumerateCompletionAsync`, #4694, the fix for issue #4685): the sagas decided between snap0 and snap1 ship whole from the segment [C0, C1) of the log, so the export's decision read and its rows are of one instant, later than its open; the export fails closed when the log no longer holds that segment. **Why one step refines that close.** Production closes in several steps - snap1, then the segment read - and the model's single `ExportClose` stands for them only because nothing the export reads can change its verdict between them. The decision is what could: purged after snap1 read it and before the segment read, a saga in L would ship with its decision row gone, and its prepared and committed rows would answer differently. The export's purge hold, taken at its open (`ExportOpen`), forbids exactly that purge for the whole export, and the fail-closed check covers a log trimmed past C0 meanwhile. With both in force the steps observe one decision, so taking them as one instant loses no behaviour; the hold is load-bearing for this abstraction, not defence in depth. The model's own copy of the hold (`OriginPurge`) cannot be shown load-bearing by a mutation, because a mutation of it still meets a close that is atomic by construction; the production detector below is what pins it. | Yes: `BootstrapAtomicVisibilityTests.Export_never_ships_part_of_a_saga_that_decides_after_the_prepared_pass_so_the_receiver_never_serves_it_split`, `BootstrapAtomicVisibilityTests.Export_ships_whole_a_saga_that_decides_between_two_committed_pass_reads`, `BootstrapAtomicVisibilityTests.Export_completion_ships_a_CRDT_saga_delta_without_double_counting_a_key_already_drained` and `BootstrapAtomicVisibilityTests.Export_fails_closed_when_the_log_no_longer_holds_a_saga_it_must_complete`; the hold that makes the close one instant: `BootstrapAtomicVisibilityTests.Export_holds_the_tree_decision_purges_while_it_reads_and_releases_them_when_done`; the rows read from the copy the close resolves, never through the logical tree's cached routing, which after an alias move can still address the superseded copy: `LatticeSnapshotProviderAliasMoveTests.Export_after_an_alias_move_reads_the_rows_of_the_copy_it_stamps`. `RAllOrNothingExportPassesInterleaveWithSaga` reads the decision before the rows, issue #4685 as it stood. |
| `FenceLift(tr)` | An imported tree's held shadow copy is published | The drain's alias cutover publishes the held shadow copy (`LatticeBootstrapCoordinatorGrain.ReleaseCrossTreeHoldAsync`, #4706) once no barrier of the tree's operations is undecided. It also waits until no barrier indexed under the tree is undecided (#4716), each entry settled at its barrier (`ILatticeCrossTreeReceiverGrain.SettleIndexEntryAsync`, #4732, the fix for issue #4730): a barrier holds publication only while it is open and undecided, and an entry whose barrier never opened or was cleared after deciding is withdrawn and holds nothing, and until every sibling replicated here from that origin has passed its boundary: its shipper vouches acknowledged positions on the captured log at or past the captured tails, or it has been drained here from an export opened after the capture (issue #4684's R1, #4721). No publication proceeds while the tree's source cluster is decommissioned: the decommission latches the publication hold before it abandons the barrier that held it without a verdict (`LatticeBootstrapCoordinatorGrain.HoldFenceForDecommissionedSourceAsync`), and the re-add clears the latch and re-drives the tree's import (`LatticeBootstrapCoordinatorGrain.RedriveForReAddedSourceAsync`), whose fresh drain allows the shadow publication (#4740). The coordinator also latches the publication hold by itself when the decommissioned-peer registry lists the source, and holds when that read fails: defence in depth behind the decommission's own latch, which the model's `~decom` guard stands for. | Yes: `CrossTreeImportBarrierIntegrationTests.An_imported_cross_tree_participant_keeps_the_original_view_until_its_sibling_terminal_arrives`. `CrossTreeImportBarrierIntegrationTests.An_imported_tree_keeps_its_original_view_while_any_barrier_indexed_under_it_is_undecided`, `CrossTreeSiblingBoundaryIntegrationTests.A_tree_remains_readable_while_its_sibling_waits_for_an_export_opened_after_capture`, `CrossTreeSiblingBoundaryIntegrationTests.A_sibling_drained_only_from_an_export_opened_before_the_capture_does_not_pass_the_boundary` (red when a drain from any export passes), `CrossTreeSiblingBoundaryIntegrationTests.A_sibling_passes_once_its_shipper_vouches_acknowledged_positions_past_the_captured_tails`, `CrossTreeSiblingBoundaryIntegrationTests.A_sibling_not_replicated_here_holds_nothing` and `CrossTreeDecisionHoldIntegrationTests.A_vouching_shipper_ships_its_acknowledged_positions_on_its_log`. `RAllOrNothingFenceLiftsBeforeSiblingPasses` lifts the fence before the sibling's boundary. The settled entry: `CrossTreeImportBarrierIntegrationTests.An_index_entry_whose_barrier_holds_no_state_does_not_pin_the_import_fence`, `CrossTreeImportBarrierIntegrationTests.An_index_entry_whose_barrier_decided_but_did_not_withdraw_does_not_pin_the_import_fence`, `CrossTreeImportBarrierIntegrationTests.An_undecided_barrier_that_waits_for_the_tree_keeps_holding_it_and_its_entry` and `CrossTreeImportBarrierIntegrationTests.Settling_an_index_entry_is_serialized_with_the_calls_that_open_or_decide_a_barrier`; `RImportFenceLiftsStaleIndexEntry` reads the entry without settling it, issue #4730 as filed. The decommission's hold: `CrossTreeImportBarrierIntegrationTests.Decommissioning_the_source_keeps_an_imported_participant_on_its_original_view_until_re_added` and `CrossTreeImportBarrierIntegrationTests.Re_adding_a_decommissioned_source_re_drives_its_held_import_and_publishes_after_the_barrier_decides`; `RAllOrNothingDecommissionLiftsImportFence` lifts the fence once the abandon leaves no barrier undecided. |
| `Stutter` | Natural termination | Not a protocol step; a stuttering successor at quiescence so TLC does not report termination as a deadlock. | Not applicable: not a protocol step, so there is no production behaviour to detect. |

## Property mapping

| Spec property | Code-level property it abstracts | Detector |
|---------------|----------------------------------|----------|
| `RAllOrNothing` | A receiver reader never sees one of a replicated saga's keys post-saga and another pre-saga, within one tree (the tally) or across trees (the barrier). Hidden is compatible with either, as in `AtomicCommit`. | Yes: `CrossClusterAtomicVisibilityTests.Multi_shard_saga_through_the_applier_stays_invisible_until_every_source_shard_terminal_arrives` and `CrossClusterCrossTreeAtomicVisibilityTests.Cross_tree_batch_stays_invisible_until_every_tree_terminal_arrives`. It holds under every loss path with its fix - a shipper gap, a detach and re-add, a receiver poison - in the variant configurations, whose detectors are on the `ShipperGap`, `Detach`, `ReceiverPoison`, `PoisonReseed` and `ReseedDrain` rows; among them `ReceiverSagaDeferralIntegrationTests.Dead_lettered_prepare_is_deferred_so_the_saga_terminal_is_held_and_never_served_torn` and `ReplicationShipperGrainTests.Terminal_of_a_saga_that_lost_a_prepare_does_not_reach_the_peer_before_the_re_seed` pin a lost prepare never serving its saga split. `RAllOrNothingPrepareAckedUnapplied` loses a prepare with no fix behind it. |
| `RStrictIsolation` | The receiver never surfaces a saga the origin did not commit: a replicated abort leaves every staged write invisible. | Yes: `CrossClusterAtomicVisibilityTests.Cross_cluster_prepared_set_remains_invisible_after_TxAbort` and `LatticeGrainReplicationApplyTests.ApplyPreparedSetAsync_followed_by_abort_terminal_keeps_value_invisible`. |
| `RLinearizedTerminals` | A receiver leaf applies the outcome the receiver registry recorded, and only after it is recorded: `LatticeGrain.ApplyTxTerminalAsync` marks before it fans out, and the fan-out carries the recorded verdict. | Yes: `LatticeGrainReplicationApplyTests.A_replicated_abort_terminal_discards_the_bucket`, which addresses the key's own source shard, so a fan-out carrying the wrong verdict reaches the bucket and surfaces the aborted write. |
| `DelegationsDisjoint` | No registry holds both delegation rows for one txid (issue #2353's premise), enforced at both registration sites. | Yes: `TxRegistryGrainTests.RegisterReceiverDecisionAuthorityAsync_rejects_a_txid_already_delegated_outbound` and `TxRegistryGrainTests.RegisterExternalDecisionAuthorityAsync_rejects_a_txid_already_delegated_inbound`. |
| `RMonotonicVisibility` | A replicated committed value, once served on the receiver, is never served pre-saga again: the fan-out drains the bucket into the projection rather than consuming it, so the value survives the registry ever ceasing to answer for the saga. | Yes: `LatticeGrainReplicationApplyTests.A_replicated_commit_terminal_drains_the_bucket_into_the_projection`. A read-only test cannot detect this row: while the registry answers Committed the gate surfaces an undrained bucket too, so the detector inspects the bucket. |
| `RCommittedEventuallyVisible` | Under at-least-once delivery every replicated committed saga is eventually materialized on every receiver leaf. Stated over materialization because a failing dial hides a delegated key for as long as it lasts. | Yes: `LatticeGrainReplicationApplyTests.A_replicated_commit_terminal_drains_the_bucket_into_the_projection`, for the reason given in the `RMonotonicVisibility` row. Every loss path's re-seed brings the saga back: `SourceWalTrimFallOffIntegrationTests.Receiver_behind_a_source_wal_trim_is_re_seeded_and_converges`, `ReplicationShipperGrainTests.After_the_re_seed_the_rewind_skips_the_quarantined_batch_and_the_saga_commits` and `ReceiverSagaPoisonReseedIntegrationTests.Poison_then_re_seed_of_an_in_flight_saga_restages_it_and_its_terminal_commits_it_whole`. `RCommittedEventuallyVisiblePrepareNotShipped` loses a prepare with no fix behind it. |
| `RNoStrandedPrepare` | Every bucket the receiver stages is eventually consumed by the saga's terminal. | Yes: `LatticeGrainReplicationApplyTests.A_replicated_commit_terminal_drains_the_bucket_into_the_projection` and `LatticeGrainReplicationApplyTests.A_replicated_abort_terminal_discards_the_bucket`. A pre-cut prepare re-shipped after a bootstrap is settled against the exported decision (issue #4482, fixed by #4510): `BootstrapAtomicVisibilityTests.Pre_cut_prepare_reshipped_after_bootstrap_of_an_aborted_saga_is_dropped`. After a loss, every bucket is drained or discarded by the re-seed: `ReceiverSagaPoisonReseedIntegrationTests.Poison_then_re_seed_leaves_no_stranded_bucket_and_the_saga_visible_whole`, `BootstrapAtomicVisibilityTests.Reseed_clear_discards_a_purged_sagas_buckets_and_leaves_carried_and_foreign_ones` and `CrossClusterAtomicVisibilityTests.Reseed_replay_withholds_a_purged_saga_whole_and_ships_live_and_decided_sagas`. `RNoStrandedPrepareShipperDropsTerminal` loses a terminal with no fix behind it. |
| `RImportFenceLifts` | Every held import eventually publishes: no tree remains indefinitely on its original view, whether it waits on a barrier that never decides or on a sibling that never passes its boundary. A tree a decommission removed for good is not a replica and owes nothing, as in `RCommittedEventuallyVisible`. | Yes: `CrossTreeImportBarrierIntegrationTests.Importing_one_cross_tree_participant_completes_the_barrier_its_sibling_delegated_to` and `CrossTreeImportBarrierIntegrationTests.An_imported_cross_tree_participant_keeps_the_original_view_until_its_sibling_terminal_arrives`. `CrossTreeImportBarrierIntegrationTests.A_stamped_barrier_that_opens_after_an_unnaming_import_from_after_the_decision_records_the_arrival` and `CrossTreeSiblingBoundaryIntegrationTests.A_sibling_that_never_passes_is_re_seeded_automatically`. `RImportFenceLiftsBarrierIgnoresUniformImport` leaves a barrier waiting on a bare import for ever. A barrier's retention and index: `CrossTreeImportBarrierIntegrationTests.An_index_entry_whose_barrier_holds_no_state_does_not_pin_the_import_fence` and `CrossTreeImportBarrierIntegrationTests.A_terminal_re_shipped_after_the_barrier_retention_does_not_reopen_it` (#4732), `CrossTreeImportBarrierIntegrationTests.A_tombstone_is_kept_until_the_origin_purge_frontier_passes_every_participant` (#4735). |

## 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. |

## The Detector column

The rules are [`Refinement.md`'s](Refinement.md#the-detector-column): a detector
is a test over production code, never a TLA+ mutation; the names are resolved by
`RefinementDetectorMappingTests`; and no census of the column is recorded here.
Every detector named above was shown to go red by perturbing the production code
it covers; the perturbations are listed in the pull request that last changed
each citation. Where a detector goes red only with a second production mechanism
also neutralised - the settle, or the receiver's apply cache - the row says so.
The gap-citation gate checks that a row reporting a gap cites an issue, not that
the issue is still open, so a fixed defect is recorded in prose as fixed by its
pull request, which the gate cannot tell from an open one.

## Deliberate abstraction gaps

- **The origin is one saga.** `AtomicCommit`'s second saga never starts, so
  inter-saga last-writer-wins on a shared key is not exercised on the receiver
  either. That is the single-cluster note's per-saga-projection gap, unchanged.
  No production symbol: the gap bounds the checked instance; it is not a
  production mechanism.
- **One source shard per key, and the same layout on both clusters.** Production
  tallies source-shard indices independently of the receiver's layout and fans
  each observed index out through its split-forward closure
  (`TerminalFanOutResolver`); the model identifies a shard with a key, so a
  receiver whose shards have split since is not modelled.
  Production symbols: `TerminalFanOutResolver`.
- **Unstamped terminals.** The model's terminals all carry the touched-shard
  count. Production writes a count of 0 on every terminal outside the saga
  coordinator's broadcast, including the split's retroactive-sweep terminals, and
  the receiver takes them down the legacy path; for a multi-shard saga that marks
  the saga early (`RAllOrNothingLegacyNoTallyMultiShard`). That is harmless
  once every prepare of the saga has arrived, which the shipper's terminal hold
  now guarantees for every terminal, unstamped ones included: checked in TLC by
  tightening `DeliverTerminal`'s guard to that saga-wide form, under which
  `RAllOrNothing` holds with every terminal unstamped. The base keeps the
  weaker per-shard guard as the minimum contract, so the mutation still fires.
  Production symbols: `AtomicWriteGrain.BroadcastTerminalsAsync`,
  `TreeShardSplitGrain.RetroactiveSweepPreparedMutationsAsync`.
- **The bootstrap and the re-seed export.** Taken atomically at the drain for a single-tree saga and for the re-seeds of the path that takes both trees off the log, on which the saga is finished and every purge precedes the boundary, so nothing interleaves with the export. A cross-tree import of tree A takes it in three steps - open, close, drain - so the operation can prepare, decide, purge and arrive at the barrier between them; the close is one instant. Production's export is two passes against a frozen
  snap0, and its late-decision pass ships a decision row for any saga it
  carried that decided while it ran (issue #4627), and its completion from the
  source WAL ships whole any saga that decided between its passes (issue #4685,
  fixed by #4694), so its decision read and its rows are of one instant, as the
  model's are. Its drain applies the rows one at
  a time behind a read fence for the whole drain (issue #4526, fixed by #4594),
  which is observationally the model's atomic import, and nothing of the saga
  reaches the receiver between a re-seed's export and its drain: the sender
  withholds and the receiver refuses stragglers. A stranded origin bucket whose
  decision row has already been purged is exported as the split the origin
  itself serves (#2318's premise): the base reaches no stranded origin bucket,
  for the reason `AtomicCommit`'s base does not, and the stranding half of
  `RAllOrNothingExportOverStrandedPrepare` alone reaches that split through
  the purged answer. The base exports a decided saga's still-resident buckets
  as committed rows; that is what keeps the settle atomic, and without it a
  reader between two prepare arrivals sees the saga split
  (`RAllOrNothingSettleKeyByKey`).
  No production symbol: the gap argues the model's atomic export against
  production's two-pass export and paged drain as a whole.
- **The origin WAL is derived, and the GC is coarse.** The model keeps no WAL
  of its own: what the origin has appended follows from the saga's state, and
  what it still retains is that minus a record a shipper gap lost and, once the
  GC has trimmed them, the saga's prepares. The GC's trim of the prepares is
  taken together with the guarded purge that waits for it, and the model never
  trims an acknowledged terminal, so a rewind re-ships it; the registry already
  counted it, so the re-ship is a duplicate the tally absorbs.
  No production symbol: the gap is a modelling abstraction with no single
  production owner.
- **Loss paths, one per behaviour.** The transport never loses a record by
  itself. Each way production loses one is an action with its fix: a shipper
  gap (a `WalRetention` trim or an encode failure), a detach and re-add, a
  receiver poison, and a decommission and fresh re-add. A behaviour takes at
  most one, in either shape, on tree A's stream while tree B stays on its own;
  the two trees are symmetric there, so fixing which one is lost loses nothing.
  One more path takes both trees off the log at one boundary (`MutualOffLog`),
  the case a peer added to a cluster with trimmed logs is in, and re-seeds each
  (`TreeReseed`). A second loss while the peer is already off the log raises
  the marker in production
  (`ReplicationShipperGrainTests.A_second_encode_failure_raises_the_marker_so_an_export_opened_past_the_old_epoch_does_not_clear_it`),
  which the model's single loss does not reach.
  No production symbol: the gap bounds the checked instance; it is not a
  production mechanism.
- **The instance is checked in slices.** Every cross-tree slice takes the export in steps (`SplitExport`). The base cfg checks every property
  with no loss path and a receiver that follows the stream, over both shapes; a
  receiver that joins through a bootstrap is checked in the `Join` variants. Each
  loss path is checked, with every property, in variant configurations that
  slice its instance so that every run fits the TLC budget. The single-tree
  slices partition it by how the receiver joins and by the saga's outcome. The
  cross-tree slices pair the bounds that interact rather than crossing all of
  them: a shipper gap and a receiver poison are checked with a silo that
  predates the purge hold, with no dial fault and no lost acknowledgement, and
  separately with dial faults and lost acknowledgements where every silo
  honours the hold; a detach and a decommission are checked where every silo
  honours the hold, since a silo that predates it holds nothing for either to
  release. A dial fault only hides a delegated key, and is checked with no loss
  path and on the gap's and the poison's follow slices; a lost acknowledgement
  only repeats a delivery, and is checked on every slice but the pre-hold ones,
  the barrier-retention ones (below), the cross-tree decommission slices that
  replicate both trees and the path that takes both trees off the
  log. The cross-tree decommission slices partition its instance by how the
  receiver joins and by the saga's outcome.
  What the pairing leaves out is either of them combined with a pre-hold purge
  on one behaviour, and a dial fault combined with a detach, a decommission or
  a joining receiver's loss. An
  aborting saga takes one vote set (no participant acking): which participant
  refused is invisible to the receiver, and the origin aborts the same way
  whichever it was. A silo that predates the purge hold is present from the
  start until `UpgradeDone`; starting with one loses nothing, since that step
  may come first. The path that takes both trees off the log is sliced by the
  decision rows a pre-hold silo purged before the boundary - none, tree A's, or
  both, tree A being the one purged by the trees' symmetry, and tree A
  re-seeded first when neither is - with the origin's saga finished and
  forgotten before the boundary, which every purge already requires. Its slices
  take no lost acknowledgement (`AckLoss`), because the rewind re-ships every
  retained record and so duplicates every delivery made before the loss; the
  other paths check the transport's own duplicates.
  No production symbol: the gap describes how the instance is checked, not a
  production mechanism.
- **One participant replicated here.** The cross-tree slices replicate both
  trees to the receiver. The `XOne` slices replicate only tree A
  (`OneReplicated`), so its barrier waits on tree A alone and tree B's records
  never reach this receiver. The receiver properties then speak for tree A's
  key only.
  No production symbol: the gap bounds the checked instance; it is not a
  production mechanism.
- **The barrier's retention is checked on slices of its own.** Its retention
  TTL, the tombstone it keeps, the origin's purge frontier that drops it, and
  a failed withdrawal from the trees' barrier indexes (`BarrierTtl`,
  `IndexFaults`) are checked on cross-tree slices of every loss path but the
  one that takes both trees off the log, every silo honouring the hold, with no
  dial fault and no lost acknowledgement, which together outgrow the TLC
  budget. On the decommission's path the retention and the failed withdrawal
  are checked on slices of their own (`XTtlDecom`, `XIdxDecom`), each by the
  saga's outcome; together they outgrow the budget there too. Elsewhere the index is exactly the set of open, undecided barriers
  and is not tracked. A barrier never opened - an index entry whose open write
  failed - is not modelled; an entry of a barrier with no arrival holds
  nothing, which the settle's production detectors pin.
  No production symbol: the gap describes how the instance is checked, not a
  production mechanism.
- **Mechanisms the model shows to be defence in depth.** Four production
  mechanisms are modelled but are not load-bearing in it, because another fix
  already covers the case: the purge guard behind the replay filter, the
  receiver poison's registry guard behind the tally, the poison re-seed's
  discard of a saga it did not carry behind that saga's withheld terminals, and
  the rewind's own wait for a pre-hold silo behind the drain's. Each is still
  pinned by its production detector, on the row of the action it guards.
  No production symbol: each mechanism is mapped, with its detector, on the row
  of the action it guards.
- **The origin drives only part of `AtomicCommit`.** `PrepareTx`, `DecideTx`,
  `BroadcastStep` and `ForgetDecision` run for the replicated saga;
  `ShadowForwardOrphan`, `OrphanDrain` and `RegistryMask` never do. So no
  forwarded prepare on a split destination (which production writes to the
  destination's WAL and replicates), no orphan-drain terminal, and no masked
  registry view reaches the origin WAL or the export. A masked view would
  have exported as Indeterminate before #4501; the base's export reads the
  stored verdict, as production now does.
  No production symbol: the gap restricts which actions of the instanced module
  run, not a production mechanism.
- **Key filters.** The shipper drops prepares outside a peer's `KeyFilter` or
  `KeyPrefixes` but always ships terminals, so on a filtered peer a saga is
  applied with its unreplicated keys absent, and `RAllOrNothing` holds only over
  the keys the peer replicates. The model replicates every key.
  Production symbols: `ReplicationShipperGrain`.
- **The receiver registry is never masked by retention.** No receiver-side
  `ForgetAsync` runs, so a receiver decision row is never tombstoned; the only
  `Indeterminate` a receiver registry gives is the failed dial.
  Production symbols: `TxRegistryGrain.ForgetAsync`.
- **No crash, reactivation or redelivery mechanics.** Production re-drives a
  partially applied terminal by redelivery; the model holds the owed work as
  durable obligations. A receiver leaf's recently-terminal memory is per
  activation, but since #4461 its late-prepare refusal also consults the
  registry's decision (issue #4445's fix), and on the replication path the
  settle stands in front of it. A reactivation is not modelled.
  No production symbol: the gap is a modelling abstraction with no single
  production owner.
- **No snapshot read path as such.** The model has one read view, the point
  path's. Since #4461 the snapshot read paths give the same answer for an
  undiallable delegation (issue #4448); `RAllOrNothingSnapshotReadsUnresolvableAsInFlight`
  is the regression check.
  Production symbols: `TxRegistryGrain.ResolveAllDelegatedAsync`.
