← Back to Pull requests

test(inkless:switch): run the stale high watermark promotion test in phase 2 [KC-721] #854

Closed
unknown closed this pull request without merging on Nov 05, 2026 13:18 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 09:43 UTC
Author

test_switched_leader_promotion_restores_stale_hw fails on main since
#849 (KC-636). The test sets unclean.leader.election.enable=true right
after the seal commit, and the controller now rejects that config until
phase 2. The test cluster had no remote storage, so its switched partition
never left phase 1.

The old scenario can't happen in phase 1 anymore. There, the controller
elects only ISR members, and the old test needed unclean election to
promote a replica outside the ISR. In phase 2, remote storage holds the
prefix and the controller can elect any live replica. A replica with a
stale high watermark can still become leader there. This change reworks
the test to cover that case instead of removing it.

The test runs on a consolidation cluster with tiered storage on MinIO. It
switches with remote.storage.enable in the same alter as
diskless.enable, and it waits for classicPrefixInRemoteStorage before
it injects the stale high watermark checkpoint. The test stops the
promoted replica last instead of isolating it with a network partition.
It's then the last ISR member of the test topic and of the internal
topics, so the controller elects it without unclean election when it
restarts alone. It also leads __remote_log_metadata, which it needs to
serve the prefix from remote storage. The consumer must read every record
across the seal.

On main, the follower consolidation fetcher repairs the stale high
watermark before the promotion. The leader-side repair in
maybeReconcileSwitchedLeader doesn't run in this test, and
testApplyDeltaRestoresStaleHwmWhenSwitchedFollowerBecomesLeader covers
it.

The change also removes _run_unclean_leader_election, which has no other
callers.

Testing

  • test_switched_leader_promotion_restores_stale_hw passes twice in ducker

  • on main. The logs show phase 2 at seal 5000, a broker reload with high
    watermark 2500, a local log start offset of 5000, and 6000 records
    consumed.
  • make vale passes.
  • Assisted-by: Claude Opus 5.5

    Diff: 251 lines (+188 / -63) across 3 files Reviewer: viktorsomogyi Review duration: 215m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 251 lines diff across 3 files
    0.39
    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.331
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #854"
    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% (MEDIUM) · Higher = larger blast radius
    39%
    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.4% · Safe to merge
    15.4%
    Repository