pingqiu 2e8c3a0469 G5-5 fix v2: latch on Epoch=0, not all-fields-zero (round-11 bug)
QA round 11 reported the 41045e5 fix didn't take effect — same
ErrStalePrimary as round 10. Reason: my latch condition required
ALL FOUR Identity fields zero, but at EnsureStorage construction
time, AdapterProjectionView.Projection() returns:
  VolumeID  = cfg.VolumeID  ("v1" — non-empty, from CLI)
  ReplicaID = cfg.ReplicaID ("r1" — non-empty, from CLI)
  Epoch     = engine state Epoch (0 — no AssignmentObserved yet)
  EV        = engine state EndpointVersion (0 — same)

So the captured b.id = {v1, r1, 0, 0} — partially-zero, not
all-zero. SetIdentity's strict zero-check refused to update.
Subsequent lineageCheck saw proj.Epoch=1 vs b.id.Epoch=0 → still
ErrStalePrimary.

Fix: latch keys on Epoch (the meaningful "no authority line yet"
indicator). VolumeID/ReplicaID match is asserted as paranoia but
unchanged. Drift past a non-zero Epoch is still rejected (failover
safety net preserved via lineageCheck).

Plus 2 diagnostic INFO logs (per QA round-11 ask):
  durable: dp.Open latching identity from projection volume=N
    replica=N epoch=N ev=N (post-waitHealthy)
  durable: StorageBackend.SetIdentity latched volume=N replica=N
    epoch=N ev=N

Test renamed: LatchFromZero → LatchFromZeroEpoch. Now constructs
backend with the realistic pre-assignment shape ({v1, r1, 0, 0})
and verifies (a) latch transitions from Epoch=0, (b) drift past
non-zero Epoch is rejected, (c) Identity returns the latched
value.

Tests still green: durable, blockvolume (G5-4 integration), master,
authority, replication, replication/component.

Refs: QA round 11 — fix didn't take effect; my zero-check was
wrong about the pre-assignment Identity shape.
2026-04-27 01:26:00 -07:00
Languages
Go 84.5%
Rust 7.9%
Shell 2.7%
templ 1.6%
Java 1%
Other 2%