From 8e30a497fffb85f72cbdd70e253f828b4b3446e0 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sat, 25 Apr 2026 21:48:34 -0700 Subject: [PATCH] T4d-2 doc fix: stale godoc post-round-46 (gate is lane-pure; CARRY-T4D-LANE-CONTEXT-001) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per QA T4d-2 final closure: pre/with-T4d-3 doc fixes. apply_gate.go (lines 38-43): the godoc on ReplicaApplyGate still described "lane discrimination" as the gate reading lineage.TargetLSN — that text predated the round-46 rework. Replaced with a clear statement of the lane-pure contract: - Gate is LANE-PURE; caller decides - Caller invokes ApplyRecovery vs ApplyLive explicitly - Gate does NOT inspect lineage payload to discriminate - Today's caller (transport replica.go) uses a transitional TargetLSN-based shim — but the shim lives at the CALLER - The architectural fence (gate is lane-pure) is durable; the caller's signal source is replaceable - Reference to CARRY-T4D-LANE-CONTEXT-001 for the future fix replica.go NewReplicaListenerWithApplyHook godoc: previously described `hook.Apply(lineage, lba, data, lsn)` as the dispatch mechanism — that signature no longer exists post-round-46. Replaced with: - Handler dispatches caller-side to hook.ApplyRecovery / hook.ApplyLive - Hook itself is LANE-PURE - Today's caller-side decision is a transitional shim based on TargetLSN==liveShipTargetLSNSentinel - Reference to CARRY-T4D-LANE-CONTEXT-001 Both godoc updates inscribe the architectural fence + name the named carry by ID so future readers find the gap tracking via catalogue cross-reference. 22 packages green; 0 failures. Refs: round-46 architect ruling (lane-pure gate); CARRY-T4D-LANE- CONTEXT-001 (catalogue §3.3 — QA-inscribed named carry). Co-Authored-By: Claude Opus 4.7 (1M context) --- seaweed-block/core/replication/apply_gate.go | 22 ++++++++++++++------ seaweed-block/core/transport/replica.go | 16 +++++++++++--- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/seaweed-block/core/replication/apply_gate.go b/seaweed-block/core/replication/apply_gate.go index b6394b8416..5cb106bd13 100644 --- a/seaweed-block/core/replication/apply_gate.go +++ b/seaweed-block/core/replication/apply_gate.go @@ -35,12 +35,22 @@ import ( // return error (caller logs + closes conn); do NOT silently skip; // do NOT advance recoveryCovered. // -// Lane discrimination (Q2 — no wire byte; implicit from session -// context): catch-up / rebuild sessions ship with -// `lineage.TargetLSN > liveShipTargetLSN` (=1); live ship sessions -// ship with `TargetLSN == liveShipTargetLSN`. The gate reads the -// lineage's TargetLSN signal — already on the wire from T4a/T4c — -// without adding a new field. +// Lane discrimination (Q2 + round-46 architect ruling): the gate is +// LANE-PURE. Caller (transport replica handler) decides lane from +// connection/session handler context and invokes the appropriate +// explicit method (ApplyRecovery vs ApplyLive). The gate does NOT +// inspect the lineage payload to discriminate lane — payload-derived +// lane signals were rejected as "changes recovery semantics to +// protect an implementation shortcut." +// +// Today's caller (transport replica.go MsgShipEntry handler) uses a +// transitional shim based on lineage.TargetLSN to choose which gate +// method to invoke — that shim lives at the CALLER, not in the gate. +// The architectural fence: gate is pure on lane; caller's signal +// source is replaceable. See CARRY-T4D-LANE-CONTEXT-001 (catalogue +// §3.3) for the named carry tracking the future replacement (true +// per-connection lane tag / separate handler routes / distinct +// listener ports). // // Per-LBA applied LSN source (Option C hybrid, kickoff §2.5 #1): // at session init, query `store.AppliedLSNs()` for substrate- diff --git a/seaweed-block/core/transport/replica.go b/seaweed-block/core/transport/replica.go index a260f8bd09..0fbfa490ab 100644 --- a/seaweed-block/core/transport/replica.go +++ b/seaweed-block/core/transport/replica.go @@ -65,9 +65,19 @@ func NewReplicaListener(addr string, store storage.LogicalStorage) (*ReplicaList } // NewReplicaListenerWithApplyHook creates a listener with the T4d-2 -// apply-gate plug-in installed. The MsgShipEntry handler delegates -// to `hook.Apply(lineage, lba, data, lsn)` for lane discrimination -// + per-LBA stale-skip + coverage accounting. +// apply-gate plug-in installed. The MsgShipEntry handler dispatches +// caller-side to `hook.ApplyRecovery` or `hook.ApplyLive` based on +// the connection/session lane it has established for this entry. The +// hook itself is LANE-PURE per round-46 architect ruling — it does +// not inspect payload bytes to decide lane. +// +// Today the handler's lane decision is a transitional shim based on +// `lineage.TargetLSN == liveShipTargetLSNSentinel` (live) vs +// otherwise (recovery). The shim lives at the CALLER (this handler), +// not in the gate. See `CARRY-T4D-LANE-CONTEXT-001` (catalogue §3.3) +// for the named carry tracking the future replacement (true +// per-connection lane tag / separate handler routes / distinct +// listener ports). // // Pass nil hook to get the no-gate behavior (== NewReplicaListener). func NewReplicaListenerWithApplyHook(addr string, store storage.LogicalStorage, hook ApplyHook) (*ReplicaListener, error) {