fix(inkless:switch): skip ISR expansion while a phase 1 leader's log ends below the seal [KC-773] #880
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 293 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.340
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #880"
general
weight: 0.35
viktorsomogyi
ClassicToDisklessSwitchLastKnownLeaderClusterTest(loseTail=true) fails intermittently in CI. The cause is a race in the broker, not in the test.After a last-known-leader election in phase 1 of the classic-to-diskless switch, the restarted leader runs
makeLeaderand then fences itself when its log ends below the committed seal. A follower fetch between those two steps expands the ISR. The controller then records a full ISR and a recovered leader for a partition that the leader marks offline. When the operator lowers the seal and restarts the leader, the controller elects another ISR member, and the test times out waiting for the restarted broker to lead.This contradicts [CLASSIC_TO_DISKLESS_SWITCH.md](docs/inkless/CLASSIC_TO_DISKLESS_SWITCH.md), which says the controller keeps an ISR of one after this election.
Partition.isFollowerInSyncnow returns false while the leader's log end offset is below the committed seal. The check readsreplicationStopOffset()directly instead of the sealed-gated value, becauseseal()runs aftermakeLeaderon a restarted leader.Evidence
In the CI artifact for the failure on
e3913e8c10(run 44107792176), the leader is broker 2. When it shuts down inreSeal, broker 0 takes over, which only an ISR member can do.To reproduce it locally, I added a 1.5-second sleep between
makeLeaderandmaybeReconcileSwitchedLeaderinReplicaManager.applyLocalLeadersDelta. The test then failed on the first run with the ticket's signature:leader=2, isr=[0,1,2], leaderRecoveryState=RECOVERED. The logs of the failing run show:The election sets the ISR to
[1]and the state toRECOVERING.Broker 1 logs
ISR updated to 1,2and thenISR updated to 2,1,0before it marks the partition offline.Testing
PartitionTest.testIsrNotExpandedWhileLeaderLogEndsBelowSealfails without the change (expected: <0> but was: <1>) and passes with it. All 106 tests inPartitionTestpass.With the same 1.5-second sleep and the change,
ClassicToDisklessSwitchLastKnownLeaderClusterTestpasses both cases. The sleep isn't part of this PR.Fixes KC-773.
🤖 Generated with Claude Code