← Back to Pull requests

Test the fallbacks of WebhookSelectsNamespace #3672

Merged
a1h8 merged 1 files (117 lines) on Nov 06, 2026 07:22 UTC
View on GitHub
a1h8 a1h8 commented on Nov 06, 2026 04:37 UTC
Author

What type of PR is this?

/kind cleanup

What this PR does / why we need it

WebhookSelectsNamespace decides whether a profile binding applies to a
namespace, but its fallbacks had no test coverage. This adds a table test
for each branch:

  • a namespace not matched by the selector is not selected

  • a webhook with a nil NamespaceSelector counts as selected

  • a missing MutatingWebhookConfiguration counts as selected

  • a failed lookup of the configuration returns false with the error

  • a webhook missing from the configuration counts as selected

  • an invalid namespace selector counts as selected

  • a missing namespace counts as selected

  • a failed namespace lookup returns false with the error, the only

  • branch that fails closed

    The failed lookups use interceptor.Funcs on Get, the invalid selector
    works with the fake client as is.

    Which issue(s) this PR fixes

    Fixes #3654

    Does this PR have test?

    Yes, it only adds unit tests.

    Special notes for your reviewer

    None

    Does this PR introduce a user-facing change?

    ``release-note
    NONE
    ``

    Diff: 117 lines (+117 / -0) across 1 files Reviewer: saschagrunert Review duration: 165m
    All Vouch review confidence checks passed
    Residual risk 0.03 = Change Risk (0.32) × (1 − Review Confidence (0.90)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.32 · 117 lines diff across 1 files
    0.32
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.92 · 4 substantive comment(s)
    0.92
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    90%
    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.285
    Real PR Conversation Timeline
    6 items
    kubernetes-prow[bot] kubernetes-prow[bot] commented on Nov 06, 2026 04:37 UTC
    Bot

    Hi @a1h8. Thanks for your PR.

    I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

    >[!TIP]
    >We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

    Once the patch is verified, the new status will be reflected by the ok-to-test label.

    I understand the commands that are listed here.

    <details>

    Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
    </details>

    codecov-commenter codecov-commenter commented on Nov 06, 2026 04:42 UTC
    Contributor

    Codecov Report


    :white_check_mark: All modified and coverable lines are covered by tests.
    :white_check_mark: Project coverage is 85.47%. Comparing base (14d2ca8) to head (7568c33).
    :warning: Report is 11 commits behind head on main.

    <details><summary>Additional details and impacted files</summary>

    @@            Coverage Diff             @@
    ##             main    #3672      +/-   ##
    ==========================================
    + Coverage   85.39%   85.47%   +0.07%     
    ==========================================
      Files         203      205       +2     
      Lines       21279    21650     +371     
    ==========================================
    + Hits        18172    18506     +334     
    - Misses       3103     3140      +37     
      Partials        4        4              
    

    </details>
    <details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • </details>

    saschagrunert saschagrunert commented on Nov 06, 2026 06:23 UTC
    Contributor

    /ok-to-test

    saschagrunert saschagrunert approved these changes on Nov 06, 2026 06:25 UTC
    Approved Reviewer

    Thanks!

    kubernetes-prow[bot] kubernetes-prow[bot] commented on Nov 06, 2026 06:25 UTC
    Bot

    [APPROVALNOTIFIER] This PR is APPROVED

    This pull-request has been approved by: <a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/3672#" title="Author self-approved">a1h8</a>, <a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/3672#pullrequestreview-5796555559" title="Approved">saschagrunert</a>

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

    The pull request process is described here

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

  • ~~OWNERS~~ [saschagrunert]
  • 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":[]} -->

    Reviewers
    Assignees
    a1h8 a1h8
    Labels
    risk: low confidence: 90.2% 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: 31.5% (LOW) · Higher = larger blast radius
    31.5%
    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: 90.2% · Lower = rushed or shallow review
    90.2%
    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: 3.1% · Safe to merge
    3.1%