← Back to Pull requests

fix: guard upgrade dispatch during teardown and emit observations #8057

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 11, 2026 11:25 UTC
Author

Why

The RP must not dispatch another control-plane upgrade policy once deletion or
CS uninstallation is observed. Reliable version/lifecycle observations are also
needed before reviewing a replacement for version-specific upgrade alerting.

This is the backend-only Phase 1 of
ARO-30519, extracted from
Azure/ARO-HCP#7982 onto a clean
main-based branch. The complete earlier implementation is preserved separately.

What changes

  • Preserve/test the existing RP deletion-timestamp guard and add an explicit

  • status-only CS-uninstalling check on the shared y-stream/z-stream trigger.
  • Probe CS only after the local initialization/create/desired-current gates

  • establish a dispatch candidate. Local RP and dispatched-CS deletion
    timestamps independently block without any CS call.
  • Block policy dispatch on that lifecycle-read failure or missing state; do

  • not couple converged/no-work reconciliations to CS availability.
  • Persist the last uninstallation observation on the primary Cluster; a later

  • dispatch candidate revalidates it and can recover from a spurious/obsolete
    observation when no local deletion timestamp is present.
  • Avoid fleet-wide initialization writes: Active is implied until a disable

  • observation, and True is persisted only to recover an existing SPC condition.
  • Export coherent current-target rows/count, convergence and lifecycle metrics

  • while preserving the existing per-version metric contract.
  • Export primary inventory independently of the SPC workqueue. Invalid entries

  • are logged/counted, valid rows remain available and expected totals include
    malformed entries rather than falsely reporting a complete subset.
  • Use one shared registration epoch for all new upgrade metrics; deliberately

  • retain the deployed legacy version metric's original label contract.
  • Represent primary teardown as a stable inventory gauge value, not a changing

  • deletion_confirmed label.
  • Guard missing active versions and rate-limit malformed-inventory error logs

  • to one summary per five minutes while exporting the exact invalid count.
  • Document snapshot meaning, implied/last eligibility, source join keys,

  • synchronization limits and exporter-lifetime cardinality/churn.

    No public ARM API fields are added.

    What deliberately does not change

  • No new or changed recording rules or output names.

  • No alert-definition, correlation, Action Group or routing changes.

  • No legacy/shadow/active mode, configuration changes or alert-module split.

  • Existing deleting-state suppression from

  • Azure/ARO-HCP#8004 remains intact.
  • No change to version selection, fleet rollout percentages, node-pool skew

  • policy or the definition of ARM operation completion.

    Duplicate version-specific upgrade IcMs are not resolved by this phase alone.
    Phase 2 will review the recording-state policy and alert/IcM consumer together.
    ARO-30662 tracks later cutover.

    Safety boundary

    These checks prevent new RP policy dispatch after teardown is observed.
    They do not cancel accepted/running policies. A CS lifecycle read and a policy
    POST are not atomic; CS must enforce admission/execution during concurrent
    uninstallation too.

    Verification

  • Linux go test -C backend -p 2 ./pkg/controllers/... -count=1 passes.

  • Linux go test -C internal -p 2 ./api/... ./azureapi/... -count=1 passes,

  • including all internal persistence/deepcopy and public-version conversion tests.
    The round-trip fuzzer excludes the new internal-only observation like other
    server-only fields; no public ARM conversion property is introduced.
  • Full workspace make lint passes with zero issues.

  • Full make -k verify passes, including complete shared generation and both

  • deepcopy/generation guards, materialization, formatting and repository checks.
  • make vendor and make verify-vendor pass for both vendor trees. The existing

  • golang.org/x/time version is now a direct backend requirement; no vendored
    bytes or dependency versions change.
  • Coherent-scrape/reconcile, SPC cleanup/restart, malformed-inventory HTTP and

  • last-observation/dispatch regressions.
  • Scope comparison against the Phase 1 base: recordings, alert definitions,

  • generated rules, routing, configuration and generator tooling remain identical.

    After approved SDP deployment, collect seven usable days of observation data
    and check coverage, snapshot consistency, lifecycle visibility, polling load and
    series churn. This is observation validation, not proof of an undeployed
    stateful monitor. Raw telemetry/caches are not committed to this PR.

    No environment deployment, customer mutation or incident update was performed.

    External CI limitation

    The reported podman-integration failure is in Cosmos emulator TLS setup
    (self-signed certificate in certificate chain), before the changed observation
    logic can be exercised. It is reported as a pre-existing infrastructure issue;
    this change does not disable TLS checks or modify emulator certificates, and
    that integration job has not been claimed as fixed.

    Documentation: cluster-upgrade observation contract.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: shubhadapaithankar Review duration: 28448m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #8057"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 27.7% · Safe to merge
    27.7%
    Repository