← Back to Pull requests

fix(store-client): keep fault-remediation's change stream resumable after the last event expires #2403

Closed
unknown closed this pull request without merging on Nov 16, 2026 14:54 UTC
View on GitHub
unknown unknown commented on Nov 14, 2026 18:11 UTC
Author

Summary

After a restart, fault-remediation could skip the first drained event, and the node stayed cordoned at drain-succeeded with no maintenance CR. The update branches of its change stream pipeline matched on fullDocument, 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 UnQuarantined and Cancelled events 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 is UnQuarantined with AlreadyDrained, or that is already Cancelled. 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


  • 🐛 Bug fix

  • ✨ New feature

  • 💥 Breaking change

  • 📚 Documentation

  • 🔧 Refactoring

  • 🔨 Build/CI
  • Component(s) Affected


  • Health Monitor

  • Core Service

  • Fault Management

  • Janitor

  • Deployment/Config

  • API/Interface

  • Preflight

  • Plugins

  • Documentation/CI

  • New Component

  • Multiple Components

  • Other
  • Testing


  • Tests pass locally

  • Manual testing completed

  • No breaking changes (or documented)
  • TestQuarantinedAndDrainedPipelineMatchesMainBranch and TestBuildQuarantinedAndDrainedNodesPipeline pin the pipeline structure and fail on main. They do not exercise a resume.

  • kind with a 120 s retention: after the last processed event expired and fault-remediation restarted, a fatal RESTART_VM event got no RebootNode on main and got one within a second with this change.

  • Both pipelines against MongoDB 8.0.34: after the token's document is deleted or its quarantine status changes, main fails with ChangeStreamFatalError and 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 on store-client/pkg/client.
  • Checklist


  • Self-review completed

  • Documentation updated (if needed)

  • Ready for review
  • Diff: 320 lines (+240 / -80) across 4 files Reviewer: KaivalyaMDabhadkar Review duration: 2682m
    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
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 41.9% (MEDIUM) · Higher = larger blast radius
    41.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.6% · Safe to merge
    16.6%