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) <noreply@anthropic.com>
Architect round-46 rejected my lane-discriminator implementation:
the gate inspecting `lineage.TargetLSN > 1` to dispatch lane was a
"payload-derived signal" — wrong placement. The fix: gate is
LANE-PURE; CALLER decides lane from connection/session handler
context.
GATE API REWORKED:
- Removed: Apply(lineage, ...) + isRecoveryLane(lineage) helper
- Added: ApplyRecovery(lineage, lba, data, lsn) — explicit recovery
lane (stale → skip data + advance recoveryCovered)
- Added: ApplyLive(lineage, lba, data, lsn) — explicit live lane
(stale → return error fail-loud; never advance recoveryCovered)
- Gate methods do NOT inspect lineage.TargetLSN for lane decisions
TRANSPORT INTERFACE REWORKED:
- transport.ApplyHook becomes 2-method interface (ApplyRecovery +
ApplyLive)
- replica.go MsgShipEntry handler dispatches CALLER-SIDE based on
TargetLSN==liveShipTargetLSNSentinel; this is a TRANSITIONAL SHIM
with explicit TODO marking it as caller-side-only — the
architectural fence (gate is lane-pure) is the durable property
- TODO references future fix: true handler-context lane via
per-connection lane tag, separate live/recovery handler routes,
or distinct listener ports (T4e or post-G5 refactor)
- liveShipTargetLSNSentinel const lives in transport (NOT importing
replication for the value; same wire-stable constant)
REGRESSION TESTS (architect round-46 HARD GATE):
- TestApplyGate_RecoveryWithTargetLSN1_RoutesToRecoveryLane —
recovery lineage with TargetLSN=1 (the OLD live-ship sentinel
value): pre-rework this routed to live and fail-loud'd a stale
recovery entry; post-rework gate honors caller's ApplyRecovery
choice → stale skips silently + recovery coverage advances
- TestApplyGate_LiveWithTargetLSN100_RoutesToLiveLane — mirror:
live lineage with TargetLSN=100 (would have been recovery
pre-rework): post-rework gate honors caller's ApplyLive choice →
stale fail-louds + recovery coverage NOT advanced
TESTS REPLACED / RENAMED:
- TestApplyGate_LaneDiscriminator_RecoveryWhenTargetLSNAboveLive
REMOVED (the gate no longer has a lane discriminator helper)
- TestComponent_LaneDerivedFromTargetLSN renamed →
TestComponent_LanePurity_CallerControlsDispatch — repurposed:
uses identical lineage payload across two test paths, only the
caller's choice of method differs; gate honors choice; pins
INV-REPL-LANE-DERIVED-FROM-HANDLER-CONTEXT (round-46 strengthened
meaning: handler context, NOT payload-derived signals)
REMAINING TESTS UPDATED:
- All gate.Apply(...) call sites in apply_gate_test.go +
apply_gate_scenarios_test.go updated to use ApplyRecovery /
ApplyLive based on the test's intended lane (recoveryLineage →
ApplyRecovery; liveLineage → ApplyLive)
Forward-carry status:
- T4d-1 typed-kind contract unaffected (gate orthogonal to failure
classification)
- All round-43/44 invariants still pinned by the 16 tests; lane-
routing now via explicit method instead of payload sniffing
- 22 packages green; 0 failures
- T4d-3 G-1 sign HARD GATE now satisfied per round-46 QA call
T4d-3 unblocked. T4d-4 unblocked + parallel-eligible.
Refs: round-46 architect ruling (rework lane discriminator);
mini-plan v0.3 §2.2 (apply gate); kickoff §9.3 #2 (Q2 — lane
implicit from handler context).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>