← Back to Pull requests

Report only the moves off a Drain's own Server (#2852) #3164

Closed
unknown closed this pull request without merging on Oct 23, 2026 02:28 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 01:11 UTC
Author

Fixes #2852.

Summary

A Drain converges each of its Services, and a convergence moves every copy off every Server whose services role is off. With two standalone Drains at once, each Drain's convergence of web moved both Servers' copies, and each Drain reported all of those moves as its own.

A Drain now reports only the moves off its own Server. It still waits for every old copy its convergence retires, so nothing it started is left unwatched.

 Behind::flush
   moves = pending.moves
+    .filter(step.from == this Drain's Server)
   Shape::Moved
+    no own moves left → NothingToMove        # the other Drain moved this Server's copy first
     else               → Moved { moves }

Review round 1 (Opus) shaped two details:

  • A move off another Server stays in the report when its old copy didn't end stopped (left running, still in, or refused as the last copy serving). A Server whose services role is off but that has no Drain of its own would otherwise have its left-behind copy go unreported. A last-in refusal on such a step still fails this Service, as before.

  • When the convergence moved only other Servers' copies and this Service has leftover rows (held, or old copies let go), the Drain adds no "nothing to move" row beside them, the same as a real NothingToMove convergence.
  • Not changed: converge stops at its first failure, whichever Server that copy is on, so a Failed row can name another Server's failure. That was already so on main.

    DESIGN.md bets

  • Bet 3 (bounded imperative commands): the Drain itself is unchanged; only its report is.

  • Bet 4 (partial results are outcomes): each report says what happened to its own Server.

  • Bet 10 (client-first): a CLI-only change.
  • Stable promise: additive only. The JSON report keeps its shape and lists fewer moves.

    Evidence

    Unit test drain::tests::a_drain_reports_only_the_moves_off_its_own_server:

    convergence of web returns moves off web-2 (this Drain) and web-3 → report: web moved [web-2→web-1]     before ✗ (both)
    convergence of api returns only a move off web-3                   → report: api nothing_to_move        before ✗ (moved)
    another_server_s_old_copy_left_running_is_still_reported            → web moved [web-3→web-1, old running], incomplete
    only_another_server_s_moves_beside_an_out_copy_report_just_the_old_copy → one row: old copies; web-3's retirement still awaited
    

    Incus, 3 Machines, standalone. web has replicas=3, with one copy on each Machine. Then I ran ployz --json server drain machine-1 & ployz server drain machine-2 & wait.

  • Before (main's CLI, same cluster):

  •   machine-1: lc-production/web moved [machine-2→machine-3, machine-1→machine-3]
      machine-2: lc-production/web moved [machine-1→machine-3, machine-2→machine-3]
      

  • After (this branch), run twice:

  •   machine-1 (json):  lc-production/web moved [machine-1→machine-3]          complete: true
      machine-2 (human): lc-production/web  moved to machine-3, old copy stopped  done
      ployz ps → 3 web copies on machine-3
      

    The drain tests (52) pass, and cargo clippy -p ployz --all-targets is clean.

    Merge Danger

    Door: two-way.

    Blast Radius: narrow. Only a Drain's report changes, and only when another Drain or role change makes its convergence move copies off other Servers.

    Diff: 420 lines (+315 / -105) across 5 files Reviewer: nick-potts Review duration: 77m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 420 lines diff across 5 files
    0.45
    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%
    56%
    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.362
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3164"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 45% (MEDIUM) · Higher = larger blast radius
    45%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 19.5% · Safe to merge
    19.5%
    Repository