← Back to Pull requests

fix(inkless:switch): keep consolidated records past a lowered seal [KC-837] #884

Closed
unknown closed this pull request without merging on Nov 19, 2026 15:54 UTC
View on GitHub
unknown unknown commented on Nov 19, 2026 11:56 UTC
Author

lower-seal moves the committed seal from S to S' < S, but the diskless log still starts at S. Consolidation fetches at S' and appends the first diskless batch at S, so every replica's leader epoch cache maps S', S) to the last classic epoch. hasConsolidatedDisklessSuffixFromSeal read the epoch at the seal, got that classic epoch, and reported the consolidated records as a classic tail. maybeTruncateSwitchedFollower and maybeReconcileSwitchedLeader then truncated them to S', and divergenceFromCommittedHistory recreated the replica on a new leader epoch.

This hit every replica in phase 2. The leader that the seal was lowered to has the diskless leader epoch at S' from makeLeader, but the restart that the recovery needs bumps its leader epoch. The consolidated batch then replaces that entry with the diskless leader epoch at S.

hasConsolidatedDisklessSuffixFromSeal now starts its proof at the first local batch that holds an offset at or past the seal. A batch that spans the seal still starts the proof at the seal. A classic record past the seal still fails the check. The check reads the log, not a cache entry that only consolidation writes, so it gives the same answer after a log directory move or a rebuild from remote storage.

Test plan

  • ReplicaManagerInklessTest.testSwitchedReplicaKeepsConsolidatedRecordsAfterLoweredSeal applies a phase 2 delta with a new leader epoch to a replica with classic records [0, 7), a lowered seal 7, and consolidated records [10, 13) in the diskless leader epoch. Its cache maps 7 to epoch 0. The replica keeps its log as a leader, as a leader whose cache had a later epoch at 7 before the append, and as a follower.

  • testSwitchedFollowerTruncatesOnlyClassicTailPastLoweredSeal applies a phase 1 follower delta. The follower keeps [10, 13) when its classic records end at the seal, and truncates to the seal when it holds a classic tail [7, 9).

  • With the previous check, the four cases that keep the log fail, and the classic-tail case passes.

  • ReplicaManagerInklessTest and ConsolidationFetcherThreadTest pass.

  • No cluster test takes a lowered seal through phase 2.
  • 🤖 Generated with [Claude Code

    Diff: 281 lines (+210 / -71) across 3 files Reviewer: giuseppelillo Review duration: 237m
    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 · 281 lines diff across 3 files
    0.40
    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.338
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #884"
    general weight: 0.35
    Reviewers
    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: 39.7% (MEDIUM) · Higher = larger blast radius
    39.7%
    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: 15.7% · Safe to merge
    15.7%
    Repository