Commit eab91c9
committed
feat(keyviz): address PR #709 round-1 (Claude bot 4 items)
- groupID=0 reserved for virtual aggregate buckets:
SetLeaderTerm now silently ignores calls with groupID=0
(early-return) and the doc explicitly notes the
reservation. Without this guard, a future caller that
accidentally publishes a non-zero term for groupID=0
would cause appendDrainedRow's `terms[groupID]` lookup
to stamp aggregate rows with that term, breaking the
fan-out merge's max-merge fallback for cross-group
cells.
- TestSetLeaderTermZeroGroupIDDoesNotPolluteVirtualBucket
reproduces the bug (fails without the guard) and pins
the post-fix invariant that aggregate rows always emit
LeaderTerm=0 even when SetLeaderTerm(0, x) was called.
- TestVirtualBucketRaftGroupIDIsZero closes the gap that
no test pinned: even when member routes are registered
with non-zero groupIDs, the over-budget virtual bucket
must emit RaftGroupID=0 so the fan-out merge falls back
to max-merge for cross-group aggregate cells.
- TestRegisterRouteSecondCallIgnoresGroupID locks the
live-slot idempotency contract documented on
RegisterRoute: a second call with a different groupID
returns true without updating the slot's metadata.
Callers that need to retag must RemoveRoute +
RegisterRoute.
- snapshotGroupTerms returns nil when no terms have been
published yet, avoiding the per-Flush map allocation
before PR-3b wires SetLeaderTerm. `nil[k]` returns the
zero value in Go, so the row-builder hot path needs no
nil guard.
- Cleanup: stale comment leftover ("// TestNonPositive...
pins Codex round-8 P2: a") that was orphaned when the
TestRegisterRouteCarriesGroupID block was inserted.1 parent e7f3bad commit eab91c9
2 files changed
Lines changed: 116 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
380 | 386 | | |
381 | 387 | | |
382 | | - | |
| 388 | + | |
383 | 389 | | |
384 | 390 | | |
385 | 391 | | |
| |||
390 | 396 | | |
391 | 397 | | |
392 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
393 | 402 | | |
394 | 403 | | |
395 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
396 | 408 | | |
397 | 409 | | |
398 | 410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
843 | 843 | | |
844 | 844 | | |
845 | 845 | | |
846 | | - | |
847 | 846 | | |
848 | 847 | | |
849 | 848 | | |
| |||
908 | 907 | | |
909 | 908 | | |
910 | 909 | | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
911 | 1013 | | |
912 | 1014 | | |
913 | 1015 | | |
| |||
0 commit comments