You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Three review items, two of them resolved by the same
semantic change (per-cell wire format):
- Gemini HIGH (proto/admin.proto:116) — row-level scalar
raft_group_id / leader_term insufficient for the
per-cell dedupe goal. The pivot in admin_grpc.go and
keyviz_handler.go only captures the FIRST column's
identity, so subsequent columns under a mid-window
leader flip get the wrong term and the aggregator's
(bucket, group, term, column) dedupe key breaks.
- Gemini MEDIUM (keyviz_fanout.go:529) — first-seen
identity vs max-merge value can mismatch when the
source whose value won did not match the source whose
identity was seeded first.
Both resolved by switching wire format to per-cell
parallel arrays:
// proto/admin.proto KeyVizRow:
repeated uint64 raft_group_ids = 13;
repeated uint64 leader_terms = 14;
// internal/admin JSON KeyVizRow:
RaftGroupIDs []uint64 `json:"raft_group_ids,omitempty"`
LeaderTerms []uint64 `json:"leader_terms,omitempty"`
The pivot loops in admin_grpc.go and keyviz_handler.go
now stamp row.RaftGroupIDs[j] = mr.RaftGroupID per
column (parallel to row.Values[j] = pick(mr)). The
mergeRowInto in keyviz_fanout.go stamps the destination
cell's identity from whichever source contributed the
value kept at that cell — for maxMerge that's the
larger source; for sumMerge that's best-effort
last-touched (sum has no single owner, but in the
steady state both sources agree on the term, so the
distinction doesn't matter).
- Codex P2 (main.go:1565) — publishLeaderTerms reads
rt.engine twice (nil-check + Status() call) which
races rt.Close() setting rt.engine = nil during
startup-error teardown. Snapshotted into a local once.
Caller audit (per loop instructions): the only
production consumers of KeyVizRow.RaftGroupID/LeaderTerm
were the pivot/merge paths in adapter/admin_grpc.go and
internal/admin/keyviz_{handler,fanout}.go, all updated
in this commit. No external consumer reads these fields.
The PR-3c aggregator that will USE the per-cell dedupe
hasn't been written yet, so there are no callers
expecting the old scalar shape.
Test updates:
- TestKeyVizHandlerStampsRaftIdentity: extended to a
two-column scenario with a mid-window flip; asserts
parallel arrays match (route 1: groups=[7,7],
terms=[42,43]; route 2 absent in col1: zero pair).
- TestGetKeyVizMatrixStampsRaftIdentity: same shape on
the gRPC path against pb.KeyVizRow.RaftGroupIds /
LeaderTerms.
- TestMergeKeyVizMatricesPreservesRaftIdentity: source
rows now use parallel-array shape; pinned identity
survives mergeRowInto.
- TestMergeKeyVizMatricesPerCellIdentityMatchesValueOwner
(NEW): leadership flip across two cells with each
leader winning one cell; asserts merged identity at
each cell matches the value's owner (Gemini MEDIUM
regression guard).
Sampler tests at the package level are unchanged because
keyviz.MatrixRow still carries scalar RaftGroupID /
LeaderTerm — the per-cell representation only emerges
at the pivot where multiple per-column MatrixRows are
folded into one row-major KeyVizRow.
0 commit comments