diff --git a/seaweed-block/core/recovery/peer_ship_coordinator.go b/seaweed-block/core/recovery/peer_ship_coordinator.go index a6640e3e4f..2f14c82f40 100644 --- a/seaweed-block/core/recovery/peer_ship_coordinator.go +++ b/seaweed-block/core/recovery/peer_ship_coordinator.go @@ -263,6 +263,17 @@ func (c *PeerShipCoordinator) TryAdvanceToSteadyLive(id ReplicaID) bool { // // CHK-BARRIER-BEFORE-CLOSE: callers MUST have observed a successful // barrier round-trip before calling this; it is purely the comparison. +// +// §IV.2.1 / FS-1 / Gate G0 — Tier 1 completion-authority site. +// The `achievedLSN >= st.targetLSN` predicate below is the historic +// recover(a,b) gate; per consensus §I P8, this is NOT the recover(a) +// completion authority. Migration target (per +// `sw-block/design/recover-semantics-adjustment-plan.md` §1 + +// `learn/2026-05-01-recover-target-audit.md` Tier 1) replaces this +// with PrimaryWalLegOk(P) under serializer lock + ReplicaWalWitness +// reporting at the BarrierHandshake cut. AchievedLSN becomes a +// per-cut witness, not a "crossed target" finishing condition. NO +// behavior change pre-Gate G0. func (c *PeerShipCoordinator) CanEmitSessionComplete(id ReplicaID, achievedLSN uint64) bool { c.mu.Lock() defer c.mu.Unlock() diff --git a/seaweed-block/core/recovery/rebuild_session.go b/seaweed-block/core/recovery/rebuild_session.go index 96c4da41c2..aaa418f171 100644 --- a/seaweed-block/core/recovery/rebuild_session.go +++ b/seaweed-block/core/recovery/rebuild_session.go @@ -180,6 +180,18 @@ func (s *RebuildSession) MarkBaseComplete() { // INV-SESSION-COMPLETE-ON-CONJUNCTION-LAYER1. Note: the system-level // "rebuild done" closure additionally requires a barrier-ack from the // replica matching achievedLSN — that is layer 2's responsibility. +// +// §IV.2.1 / FS-1 / Gate G0 — Tier 1 completion-authority site. +// The `walApplied < targetLSN` predicate below is the historic +// recover(a,b) gate; per consensus §I P8, this is NOT the recover(a) +// completion authority. The migration target (per +// `sw-block/design/recover-semantics-adjustment-plan.md` §1 row +// "TryComplete: walApplied ≥ Target 独断 → 新 conjunct" and +// `learn/2026-05-01-recover-target-audit.md` Tier 1 row) replaces +// this with `baseDone ∧ ReplicaWalWitness ∧ (coordinator-explicit +// PrimaryWalLegOk OR barrier state machine phase)`. NO behavior +// change pre-Gate G0; Tier-1 edits await T2 predicate name + witness +// channel pinning. func (s *RebuildSession) TryComplete() (achievedLSN uint64, done bool) { s.mu.Lock() defer s.mu.Unlock() diff --git a/seaweed-block/core/recovery/sender.go b/seaweed-block/core/recovery/sender.go index 32271a9d19..c98e6a87e6 100644 --- a/seaweed-block/core/recovery/sender.go +++ b/seaweed-block/core/recovery/sender.go @@ -477,6 +477,17 @@ func (s *Sender) Run(ctx context.Context, sessionID, fromLSN, targetLSN uint64) case <-ctx.Done(): return 0, newFailure(FailureCancelled, PhaseBarrierResp, ctx.Err()) } + // §IV.2.1 / FS-1 / Gate G0 — Tier 1 completion-authority site. + // The CanEmitSessionComplete check below + FailureContract on + // `achieved < target` is the historic recover(a,b) Run-success + // predicate; per consensus §I P8, this is NOT the recover(a) + // completion authority. Migration target (per + // `sw-block/design/recover-semantics-adjustment-plan.md` §1 + + // `learn/2026-05-01-recover-target-audit.md` Tier 1) replaces + // this with `baseDone (replica) ∧ PrimaryWalLegOk(P) (primary + // WalShipper) ∧ BarrierHandshake`; FailureContract is rebound + // to "barrier-pre violation / lifecycle contract violation" + // rather than "did not reach Y". NO behavior change pre-Gate G0. if !s.coordinator.CanEmitSessionComplete(s.replicaID, achieved) { return achieved, newFailure(FailureContract, PhaseBarrierResp, fmt.Errorf("achieved=%d < target=%d", achieved, targetLSN))