pingqiuandClaude Opus 4.7 11392baf41 fix(transport): unify replicaID in startRebuildDualLane (Phase 0 Fix #1)
INV-RID-UNIFIED-PER-SESSION: the engine arg replicaID is the single
source of truth for keying coord / WalShipper / sink / bridge for a
recovery session. Pre-fix, startRebuildDualLane built the RecoverySink
with the engine arg but called bridge.StartRebuildSessionWithSink with
the construction-time dl.ReplicaID. If the two diverged, the post-emit
hook keyed coord.RecordShipped under arg while the bridge keyed
coord.PinFloor under dl.ReplicaID — the keys never reconciled, no
error fired, watchdog timed out long after.

Fix:
  (a) Fail-closed assert at session entry: non-empty dl.ReplicaID must
      equal recovery.ReplicaID(arg). Empty stays permissive (legacy /
      test omission; arg flows through unchanged).
  (b) Thread argRID through to bridge.StartRebuildSessionWithSink so
      coord and sink key uniformly under arg from this point on.

Tests (core/transport/replicaid_unified_test.go):
  - TestPhase0Fix1_DriftRejected_FailsClosedAtEntry: non-empty drift
    returns error before any wire activity; coord.Phase Idle under
    both IDs; OnSessionStart/Close never fire.
  - TestPhase0Fix1_HappyPath_ArgEqualsConstructionID: aligned IDs,
    full rebuild, frontier converges, coord returns to Idle.
  - TestPhase0Fix1_EmptyConstructionRID_ArgFlowsThrough: empty
    construction RID bypasses guard; arg keys both bridge and sink;
    coord lifecycle observed under arg, never under empty key.

Refs: v3-recovery-execution-institution.md "Entity layering &
assembly contract" Phase 0; v3-recovery-wal-shipper-mini-plan §11.6.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 10:56:57 -07:00
Languages
Go 84.7%
Rust 7.7%
Shell 2.7%
templ 1.5%
Java 1%
Other 2.1%