fix(store-client): keep fault-remediation's change stream resumable after the last event expires #2403
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 320 lines diff across 4 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.345
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2403"
general
weight: 0.35
KaivalyaMDabhadkar
Summary
After a restart, fault-remediation could skip the first drained event, and the node stayed cordoned at
drain-succeededwith no maintenance CR. The update branches of its change stream pipeline matched onfullDocument, and MongoDB cannot resume after an event whose looked-up document has expired or changed. The watcher then deleted the token and reopened past the event that surfaced the error.The update branches now match only on what the update wrote. fault-remediation already loads the document again by ID and sends
UnQuarantinedandCancelledevents to cleanup, so for the statuses node-drainer writes, the stream delivers the same updates as before. Two more updates are now delivered and go to cleanup: a finished drain on an event that isUnQuarantinedwithAlreadyDrained, or that is alreadyCancelled. A finished drain on an event with no quarantine status would also be delivered and would go to remediation; node-drainer does not write a drain status on such events.The insert branches are unchanged, because an insert event carries its own document. The PostgreSQL pipeline is unchanged too: its changelog stores the document with each change.
Fixes #2402
Type of Change
Component(s) Affected
Testing
TestQuarantinedAndDrainedPipelineMatchesMainBranchandTestBuildQuarantinedAndDrainedNodesPipelinepin the pipeline structure and fail on main. They do not exercise a resume.RESTART_VMevent got no RebootNode on main and got one within a second with this change.ChangeStreamFatalErrorand this change resumes. A token saved by the main pipeline resumes as well.go test ./...passes in store-client and fault-remediation. golangci-lint v2.15.0 reports 0 issues onstore-client/pkg/client.Checklist