← Back to Pull requests

fix(spark): validate requested job statuses #874

Open
Karman580 opened this pull request with 63 lines diff across 4 files
View on GitHub
Karman580 Karman580 commented on Oct 18, 2026 19:49 UTC
Author

What this PR does / why we need it:

Problem: SparkClient.wait_for_job_status() does not check the requested status against SparkJobStatus. If a value can never match the job's status, the Kubernetes backend keeps polling until timeout instead of reporting invalid input. Two cases:

  • A misspelled status such as {"Complete"}, which is the Trainer/Optimizer spelling. Spark uses "Completed".

  • An empty set.
  • Solution: KubernetesBackend.wait_for_job_status() now validates the requested statuses against set(SparkJobStatus) before polling. It raises ValueError if the collection is empty or contains a value that is not a valid SparkJobStatus.

  • This mirrors the existing status.issubset(...) checks in the Trainer and Optimizer Kubernetes backends.

  • The check uses set(SparkJobStatus) rather than a hard-coded list, so it stays correct if enum members are added, as #690 proposes.

  • The Raises: docs in the backend, the RuntimeBackend base interface, and SparkClient are updated to match.
  • Compatibility:

  • SparkJobStatus is a str enum, so enum members and correctly spelled plain strings such as {"Completed"} behave as before.

  • The status: set[SparkJobStatus] signature and its {SparkJobStatus.COMPLETED} default are unchanged.

  • The only inputs that now fail fast are ones that previously could never return successfully:

  • - invalid values
    - an empty set
    - a bare string that is not an exact single status, such as "Complete". A bare str is outside the set[...] type hint.

    Tests (run locally on macOS):

  • Added cases to the parametrized test_wait_for_job_status in kubeflow/spark/backends/kubernetes/backend_test.py:

  • - {"Complete"} raises ValueError
    - set() raises ValueError
    - {"Completed"} (plain string) returns the job

    The existing enum case {SparkJobStatus.COMPLETED} is unchanged and still passes.

  • uv run pytest -q kubeflow/spark/backends/kubernetes/backend_test.py -k wait_for_job_status: 10 passed.

  • With the backend change reverted, the two new ValueError cases fail. That confirms they cover the defect.

  • I ran the commands behind make verify directly: uv lock --check, ruff check, ruff format --check kubeflow, ty check kubeflow/hub. All passed. The Makefile's GNU sed check stops make itself on macOS.

  • I ran the test command behind make test-python directly: uv run coverage run --source=kubeflow -m pytest ./kubeflow/. 700 passed.

  • The pre-commit hooks passed on the changed files.
  • Note: #690 also modifies wait_for_job_status, in the docstring and the RuntimeError message. The overlap is small, and I am happy to rebase on whichever lands first.

    Which issue(s) this PR fixes:

    Fixes #873

    Checklist:

  • Docs included if any changes are user facing
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    Job-status polling now rejects zero or negative polling intervals, empty status sets, bare-string statuses, and unrecognized status values with a ValueError.
    Documentation
    Updated the polling method documentation to describe the conditions that raise ValueError.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 63 lines (+60 / -3) across 4 files Reviewer: tariq-hasan Review duration: 66195m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.39) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 63 lines diff across 4 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.90 · 5 substantive comment(s)
    0.90
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    88%
    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.249
    Real PR Conversation Timeline
    16 items
    google-oss-prow[bot] google-oss-prow[bot] commented on Oct 18, 2026 19:50 UTC
    Bot

    [APPROVALNOTIFIER] This PR is NOT APPROVED

    This pull-request has been approved by:
    Once this PR has been reviewed and has the lgtm label, please assign kramaranya for approval. For more information see the Kubernetes Code Review Process.

    The full list of commands accepted by this bot can be found here.

    <details open>
    Needs approval from an approver in each of these files:

  • OWNERS
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":["kramaranya"]} -->

    tariq-hasan tariq-hasan commented on code on Oct 18, 2026 20:33 UTC
    Code Review
    kubeflow/spark/backends/kubernetes/backend.py:1
    @@ -1209,6 +1210,14 @@ def wait_for_job_status(
             if polling_interval <= 0:
                 raise ValueError("polling_interval must be positive.")
     
    +        # An invalid or empty status can never match, so fail fast instead of polling until timeout.
    +        valid_statuses = set(SparkJobStatus)
    +        if not status or not set(status).issubset(valid_statuses):

    Please add this check as well.

            valid_statuses = set(SparkJobStatus)
            if isinstance(status, str):
                raise ValueError(
                    f"status must be a set of SparkJobStatus values, e.g. "
                    f"{{SparkJobStatus.COMPLETED}}; got {status!r}"
                )
            if not status or not set(status).issubset(valid_statuses):
    

    tariq-hasan tariq-hasan requested changes on Oct 18, 2026 20:36 UTC
    Changes Requested Reviewer

    Requested changes.

    tariq-hasan tariq-hasan commented on Oct 18, 2026 20:36 UTC
    Contributor

    /ok-to-test
    /retest

    Karman580 Karman580 commented on code on Oct 19, 2026 07:11 UTC
    Code Review
    kubeflow/spark/backends/kubernetes/backend.py:1
    @@ -1209,6 +1210,14 @@ def wait_for_job_status(
             if polling_interval <= 0:
                 raise ValueError("polling_interval must be positive.")
     
    +        # An invalid or empty status can never match, so fail fast instead of polling until timeout.
    +        valid_statuses = set(SparkJobStatus)
    +        if not status or not set(status).issubset(valid_statuses):

    Added an explicit check to reject bare string inputs with a clear ValueError before collection validation (05436a6). Added regression coverage for bare strings while preserving valid string-set and enum-set inputs.

    Karman580 Karman580 commented on Oct 26, 2026 12:47 UTC
    Author

    Hi @tariq-hasan, @szaher ,@Shekharrajak could you please take a look at my PR #874 and review it when you get a chance

    tariq-hasan tariq-hasan commented on code on Nov 05, 2026 01:31 UTC
    Code Review
    kubeflow/spark/backends/kubernetes/backend.py:1
    @@ -1209,6 +1210,20 @@ def wait_for_job_status(
             if polling_interval <= 0:
                 raise ValueError("polling_interval must be positive.")
     
    +        # An invalid or empty status can never match, so fail fast instead of polling until timeout.
    +        valid_statuses = set(SparkJobStatus)
    +        # A bare str is iterable, so set("Completed") would yield characters rather than a status.
    +        if isinstance(status, str):
    +            raise ValueError(
    +                f"status must be a set of SparkJobStatus values, e.g. "
    +                f"{{SparkJobStatus.COMPLETED}}; got {status!r}"
    +            )

    No need for the comments. The code is self-explanatory.

            valid_statuses = set(SparkJobStatus)
            if isinstance(status, str):
                raise ValueError(
                    f"status must be a set of SparkJobStatus values, e.g. "
                    f"{{SparkJobStatus.COMPLETED}}; got {status!r}"
                )
    

    tariq-hasan tariq-hasan requested changes on Nov 05, 2026 01:44 UTC
    Changes Requested Reviewer

    Requested changes.

    Karman580 Karman580 commented on code on Nov 06, 2026 20:49 UTC
    Code Review
    kubeflow/spark/backends/kubernetes/backend.py:1
    @@ -1209,6 +1210,20 @@ def wait_for_job_status(
             if polling_interval <= 0:
                 raise ValueError("polling_interval must be positive.")
     
    +        # An invalid or empty status can never match, so fail fast instead of polling until timeout.
    +        valid_statuses = set(SparkJobStatus)
    +        # A bare str is iterable, so set("Completed") would yield characters rather than a status.
    +        if isinstance(status, str):
    +            raise ValueError(
    +                f"status must be a set of SparkJobStatus values, e.g. "
    +                f"{{SparkJobStatus.COMPLETED}}; got {status!r}"
    +            )

    Thanks for taking another look, @tariq-hasan! You're right, the code reads fine without them. I've removed both comments and applied your suggestion as-is in 91c5857, and the tests still pass locally.

    Whenever you have a moment, I'd really appreciate another review. Thanks again for your patience and the helpful feedback!

    Karman580 Karman580 commented on Nov 06, 2026 21:02 UTC
    Author

    Hi @tariq-hasan, a quick heads-up on the failing example-validation (1.32.0) check. It doesn't look related to this change. The notebook passes a valid {SparkJobStatus.COMPLETED}, so the new validation lets it through, but the Spark job itself goes to FAILED in the cluster a few seconds after submission.

    It seems to be the controller/Helm chart mismatch described in #933 (the same failure shows up on #910), which #930 should take care of. Once that lands, I'll rebase this branch on main so the checks run again on the fixed setup.

    Thanks a lot for your time!

    tariq-hasan tariq-hasan commented on Nov 13, 2026 07:07 UTC
    Contributor

    Thanks for the contribution @Karman580!
    /lgtm

    Please rebase on main once #930 merges to pass all the Spark E2E workflows.

    google-oss-prow[bot] google-oss-prow[bot] commented on Nov 29, 2026 16:46 UTC
    Bot

    New changes are detected. LGTM label has been removed.

    coderabbitai[bot] coderabbitai[bot] commented on Nov 29, 2026 16:46 UTC
    Bot

    <!-- coderabbit-ai-generated:v1 -->

    <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
    <!-- review_stack_entry_start -->

    <a href="https://app.coderabbit.ai/change-stack/kubeflow/sdk/pull/874?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a>

    <!-- review_stack_entry_end -->
    <!-- recent_review_status_start -->

    No actionable comments were generated in the recent review.

    <!-- recent_review_status_end -->
    <!-- walkthrough_start -->

    <details>
    <summary><strong>Walkthrough</strong></summary>
    <dl>
    <dd>
    <br>

    The Kubernetes backend now validates requested statuses before polling. It rejects bare strings, empty targets, and values outside SparkJobStatus with ValueError. Documentation and tests describe these conditions.

    Changes: Spark job status validation

    |Layer / File(s)|Summary|
    |:---|:---|
    |Validate status targets <br> kubeflow/spark/api/spark_client.py, kubeflow/spark/backends/base.py, kubeflow/spark/backends/kubernetes/backend.py, kubeflow/spark/backends/kubernetes/backend_test.py|The Kubernetes backend rejects bare-string, empty, or invalid status targets before polling. It also rejects nonpositive polling intervals. The documentation and tests cover these conditions, including acceptance of a valid plain-string status inside a set.|

    <!-- change_assessment_start -->
    Estimated code review effort: 2 (Simple) | ~10 minutes

    <!-- change_assessment_commit:"53413fa4f3a0f973937ef2bbb427be791003573c" -->
    <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} -->
    Change: Bug fix · Severity of issue fixed: Medium
    <!-- change_assessment_end -->

    Possibly related issues

  • Issue 877 describes status validation gaps in Trainer local backends. This PR changes Spark only, so it does not address that issue.
  • Suggested reviewers: goku2099

    </dd>
    </dl>
    </details>

    <!-- walkthrough_end -->
    <details>
    <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>53413</code></summary>
    <dl>
    <dd>
    <br>

    <!-- final_review_risk_start -->
    <!-- final_review_risk_label
    Merge Risk: ⚪ Minimal · up to 53413
    -->
    <!-- final_review_risk_coverage:{"sourceCommitId":"53413fa4f3a0f973937ef2bbb427be791003573c","coveredCommitId":"53413fa4f3a0f973937ef2bbb427be791003573c","kind":"reviewed"} -->

    Spark job status waits now fail fast with a ValueError on bare strings, empty sets, or invalid statuses, instead of timing out. The change is small, documented, and covered by tests, so merge-readiness risk is minimal.
    <!-- final_review_risk_end -->

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong>Security architecture risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>53413</code></summary>
    <dl>
    <dd>
    <br>

    <!-- architecture_review_start -->
    <!-- architecture_review_label

    Security Architecture Review

    Security architecture risk: ⚪ Minimal · up to 53413
    -->

    Invalid status targets now fail before the first Kubernetes job lookup. Valid status sets still use the same read-only wait, with no change to job access or job state.

    Retained concerns
    No architecture-level concerns identified.

    <details>
    <summary><strong>Security review details</strong></summary>
    <dl>
    <dd>
    <br>

    Security Blast Radius

  • _inferred_ — The changed branch can prevent Kubernetes reads but does not grant access to additional jobs or introduce a write path. Accepted calls still use the existing job lookup.
  • </dd>
    </dl>
    </details>
    <!-- architecture_review_end -->

    </dd>
    </dl>
    </details>
    <!-- pre_merge_checks_walkthrough_start -->

    <details>
    <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary>
    <dl>
    <dd>
    <br>

    | Check name | Status | Explanation |
    | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Description Check | !Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
    | Title check | !Passed | The title "fix(spark): validate requested job statuses" matches the main change. The PR adds ValueError validation to KubernetesBackend.wait_for_job_status for empty or invalid status collections and … |
    | Linked Issues check | !Passed | Issue #873 requires KubernetesBackend.wait_for_job_status() to raise ValueError before polling when the requested status is invalid or empty. The reviewed head adds this check in kubeflow/spark/b… |
    | Out of Scope Changes check | !Passed | The whole-PR diff against the merge base contains a backend change in
    kubeflow/spark/backends/kubernetes/backend.py that adds only the status validation and updates the Raises: docstring. I checke… |

    <details>
    <summary><strong>Full details: Title check</strong></summary>
    <dl>
    <dd>
    <br>

    Explanation

    The title "fix(spark): validate requested job statuses" matches the main change. The PR adds ValueError validation to KubernetesBackend.wait_for_job_status for empty or invalid status collections and bare strings, and updates the related Raises docs and tests. The title is specific and concise, and it names the affected area (spark) and the change type (fix). It does not mention the bare-string rejection, but that is a detail, not the main point.

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong>Full details: Linked Issues check</strong></summary>
    <dl>
    <dd>
    <br>

    Explanation

    Issue #873 requires KubernetesBackend.wait_for_job_status() to raise ValueError before polling when the requested status is invalid or empty. The reviewed head adds this check in kubeflow/spark/backends/kubernetes/backend.py, after the existing polling_interval check and before start_time and the polling loop. The check raises for a bare str, for an empty collection, and for any member outside set(SparkJobStatus). Because SparkJobStatus is a str enum, {"Completed"}, {SparkJobStatus.COMPLETED}, lists, and tuples still pass through set(status). The issue's proposed validation uses set(SparkJobStatus), and the code matches it. The issue's bare-string behavior change is also implemented, so a bare "Completed" now raises. The issue asks for regression tests for {"Complete"}, set(), and {"Completed"}. The PR description reports these cases added to the parametrized test_wait_for_job_status in kubeflow/spark/backends/kubernetes/backend_test.py. I did not re-run the test file. The test evidence comes from the author's report and the change summary. The issue's None default note is conditional and not a current requirement. The docstring updates are consistent with the code.

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong>Full details: Out of Scope Changes check</strong></summary>
    <dl>
    <dd>
    <br>

    Explanation

    The whole-PR diff against the merge base contains a backend change in kubeflow/spark/backends/kubernetes/backend.py that adds only the status validation and updates the Raises: docstring. I checked this diff directly. The existing polling_interval &lt;= 0 check is unchanged; the docstring wording now reflects existing behavior. Other changes are documentation-only updates in kubeflow/spark/api/spark_client.py and kubeflow/spark/backends/base.py, which describe the same ValueError conditions. The test file changes cover the issue's regression cases. No change was found that is unrelated to #873.

    </dd>
    </dl>
    </details>

    </dd>
    </dl>
    </details>

    <!-- pre_merge_checks_walkthrough_end -->
    <!-- finishing_touch_checkbox_start -->

    <details>
    <summary><strong>Finishing Touches</strong></summary>
    <dl>
    <dd>
    <br>

    <details open>
    <summary><strong>Generate unit tests (beta)</strong></summary>
    <dl>
    <dd>
    <br>

  • <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create a new PR
  • </dd>
    </dl>
    </details>

    </dd>
    </dl>
    </details>

    <!-- finishing_touch_checkbox_end -->

    <!-- autopilot:start -->

  • <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

  • <!-- autopilot:end -->
    <!-- recent_review_start -->

    <h6>
    <details>
    <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary>
    <dl>
    <dd>
    <br>

    <!-- review_info_content -->
    <details>
    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary>
    <dl>
    <dd>
    <br>

  • Source mode: Auto

  • Repository: [kubeflow/sdk](<https://github.com/kubeflow/sdk>)

  • Branch: [main](<https://github.com/kubeflow/sdk/tree/main>)

  • File: [.coderabbit.yaml](<https://github.com/kubeflow/sdk/blob/8961a455ad36c99d1e39cf0e1f36dbd4e11826b6/.coderabbit.yaml>)

  • Commit: [8961a45](<https://github.com/kubeflow/sdk/commit/8961a455ad36c99d1e39cf0e1f36dbd4e11826b6>)

  • Layers: Repository YAML

  • Review profile: CHILL

  • Plan: Advanced

  • Run ID: 5066ac25-4ac8-46f9-a653-66c476b96e6b
  • </dd>
    </dl>
    </details>

    <details>
    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary>
    <dl>
    <dd>
    <br>

    Reviewing files that changed from the base of the PR and between 8961a455ad36c99d1e39cf0e1f36dbd4e11826b6 and 53413fa4f3a0f973937ef2bbb427be791003573c.

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 4</strong></summary>
    <dl>
    <dd>
    <br>

    kubeflow/spark/api/spark_client.py
    kubeflow/spark/backends/base.py
    kubeflow/spark/backends/kubernetes/backend.py
    kubeflow/spark/backends/kubernetes/backend_test.py`

    </dd>
    </dl>
    </details>

    Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

    </dd>
    </dl>
    </details>
    </h6>

    <!-- recent_review_end -->

    Karman580 Karman580 commented on code on Nov 29, 2026 17:01 UTC
    Code Review
    kubeflow/spark/backends/kubernetes/backend.py:1
    @@ -1209,6 +1210,20 @@ def wait_for_job_status(
             if polling_interval <= 0:
                 raise ValueError("polling_interval must be positive.")
     
    +        # An invalid or empty status can never match, so fail fast instead of polling until timeout.
    +        valid_statuses = set(SparkJobStatus)
    +        # A bare str is iterable, so set("Completed") would yield characters rather than a status.
    +        if isinstance(status, str):
    +            raise ValueError(
    +                f"status must be a set of SparkJobStatus values, e.g. "
    +                f"{{SparkJobStatus.COMPLETED}}; got {status!r}"
    +            )

    @tariq-hasan Rebased on main now that #930 is in. The rebase was clean and the diff is unchanged; the comment cleanup from 91c5857 is now 53413fa. Spark Examples E2E passes on all four matrix versions (1.34.3, 1.35.8, 1.36.4, 1.37.0). #930 replaced the old 1.32.0 example-validation job, so that check no longer runs.

    Locally, all 11 wait_for_job_status cases pass (enum set, plain-string set, invalid value, empty set, bare string), along with the full Spark suite (289 tests). Prow dropped lgtm on the push, so this needs it reapplied.

    Karman580 Karman580 commented on Nov 29, 2026 18:32 UTC
    Author

    Hi @tariq-hasan, I've rebased on the latest main, and all 20 checks are now passing, including all Spark E2E workflows. Could you please take another look and reapply /lgtm when convenient

    Reviewers
    Assignees
    Karman580 Karman580
    Labels
    risk: low confidence: 88.9% 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.3% (MEDIUM) · Higher = larger blast radius
    39.3%
    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: 88.9% · Lower = rushed or shallow review
    88.9%
    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: 4.3% · Safe to merge
    4.3%
    Repository