← Back to Pull requests

Replace `--no-verify` flag with `--verify` #1140

Merged
AleksaMCode merged 1 files (6 lines) on Sep 03, 2026 07:23 UTC
View on GitHub
AleksaMCode AleksaMCode commented on Aug 16, 2026 18:47 UTC
Author

Summary

Fixes the CLI --no-verify flag so it actually disables TLS certificate verification when used.

Edit:

After some discussion, the flag was changed from --no-verify to --verify.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)

  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.

  • I've updated the documentation accordingly.
  • <!-- This is an auto-generated description by cubic. -->
    <a href="https://cubic.dev/pr/pydantic/httpx2/pull/1140?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
    <!-- End of auto-generated description by cubic. -->

    Diff: 6 lines (+3 / -3) across 1 files Reviewer: mbeijen Review duration: 25236m
    All Vouch review confidence checks passed
    Residual risk 0.03 = Change Risk (0.20) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.20 · 6 lines diff across 1 files
    0.20
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.80 · 5 substantive comment(s)
    0.80
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    85%
    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.116
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    14 items
    codspeed[bot] codspeed[bot] commented on Aug 16, 2026 18:48 UTC
    Bot

    <!-- __CODSPEED_PERFORMANCE_REPORT_COMMENT__ -->

    Merging this PR will not alter performance

    ✅ 17 untouched benchmarks
    ⏩ 7 skipped benchmarks[^skipped]

    ---

    <sub>Comparing <code>AleksaMCode:fix/cli-no-verify-flag</code> (6c6f0b1) with <code>main</code> (71ae23b)</sub>

    <a href="https://app.codspeed.io/pydantic/httpx2/branches/AleksaMCode%3Afix%2Fcli-no-verify-flag?utm_source=github&utm_medium=comment-v2&utm_content=button">
    <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://codspeed.io/pr-report/open-in-codspeed-dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://codspeed.io/pr-report/open-in-codspeed-light.svg">
    <img alt="Open in CodSpeed" src="https://codspeed.io/pr-report/open-in-codspeed-light.svg" width="169" height="32">
    </picture>
    </a>

    [^skipped]: 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

    cubic-dev-ai[bot] cubic-dev-ai[bot] commented on Aug 16, 2026 18:49 UTC
    Reviewer

    <!-- cubic:review-summary:start -->
    No issues found across 1 file
    <!-- cubic:review-summary:end -->

    <sub>Re-trigger cubic</sub>

    <!-- cubic:review-post:ai_pr_review_1786906026799_36cca624-fc40-4043-ad89-bf862e8c193a:ad56ae1a37815395f9eb3cd7850f8cc60de0d734:ce3bb44e-509c-47b8-9e82-14bfc56d20b9 -->

    mbeijen mbeijen commented on Aug 17, 2026 20:58 UTC
    Contributor

    Thanks for catching this error!

    ~$ httpx2 --no-verify https://expired.badssl.com/
    ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1082)
    

    It's a click behavior change in 8.3.0! Up to 8.2.1, Option.__init__ contained flag_value = not self.default, so is_flag=True, default=True gave you flag_value=False.

    That line was removed in pallets/click#3030 in favour of self.flag_value = True, so --no-verify now sets verify=True and silently does nothing. But with your PR, on click 8.3, the default will be to not verify SSL, that's a problem!! (and then on 8.4 it would work again)

    So I think we'd best make it fully explicit:

    
    @click.option(
        "--no-verify",
        "no_verify",
        is_flag=True,
        default=False,
        help="Disable SSL verification.",
    )
    

    AleksaMCode AleksaMCode commented on Aug 17, 2026 21:09 UTC
    Author

    @mbeijen Totally agree this alternative may read clearer and better expresses the intent of the flag. That said, I don’t think Click 8.3 compatibility is a practical issue here, since this project explicitly requires click>=8.4.2 in src/httpx2/pyproject.toml for the current httpx2 version.

    mbeijen mbeijen commented on Aug 18, 2026 06:53 UTC
    Contributor

    @mbeijen Totally agree this alternative may read clearer and better expresses the intent of the flag. That said, I don’t think Click 8.3 compatibility is a practical issue here, since this project explicitly requires click>=8.4.2 in src/httpx2/pyproject.toml for the current httpx2 version.

    Ah, you're right, it got upped in 2cb02fe1c and later again a time. I was looking at an old checkout, I'm sorry.

    But indeed, explicit is better than implicit, this code is the best solution for the problem.
    @Kludex please consider this PR

    mbeijen mbeijen approved these changes on Aug 18, 2026 06:54 UTC
    Approved Reviewer

    Approved these changes.

    Kludex Kludex commented on code on Aug 18, 2026 07:40 UTC
    Code Review
    src/httpx2/httpx2/_main.py:1
    @@ -394,9 +394,9 @@ def handle_help(
     )
     @click.option(
         "--no-verify",

    Can't we replace this with --verify instead?

    AleksaMCode AleksaMCode commented on code on Aug 18, 2026 08:15 UTC
    Code Review
    src/httpx2/httpx2/_main.py:1
    @@ -394,9 +394,9 @@ def handle_help(
     )
     @click.option(
         "--no-verify",

    @Kludex we can, I just wanted to preserve already existing flag. I'll push the changes.

    Kludex Kludex commented on code on Aug 18, 2026 08:29 UTC
    Code Review
    src/httpx2/httpx2/_main.py:1
    @@ -394,9 +394,9 @@ def handle_help(
     )
     @click.option(
         "--no-verify",

    But I think the flag is preserved, because it's a boolean. 🤔

    AleksaMCode AleksaMCode commented on code on Aug 18, 2026 15:38 UTC
    Code Review
    src/httpx2/httpx2/_main.py:1
    @@ -394,9 +394,9 @@ def handle_help(
     )
     @click.option(
         "--no-verify",

    @Kludex I meant I wanted to keep --no-verify without changing it to --verify and introducing "breaking change." For me using --no-verify was "simpler":

    # Default SSL verification ON
    httpx2 https://example.com/
    # Disable SSL verification
    httpx2 --no-verify https://example.com/
    

    Compared to this new version:

    # Default SSL verification ON
    httpx2 https://example.com
    # Explicit SSL verification
    httpx2 --verify true https://example.com
    # Disable SSL verification
    httpx2 --verify false https://example.com
    

    AleksaMCode AleksaMCode commented on code on Aug 24, 2026 07:07 UTC
    Code Review
    src/httpx2/httpx2/_main.py:1
    @@ -394,9 +394,9 @@ def handle_help(
     )
     @click.option(
         "--no-verify",

    @Kludex I've pushed the new changes, could you take a look?

    Kludex Kludex approved these changes on Sep 03, 2026 07:23 UTC
    Approved Reviewer

    Approved these changes.

    Kludex Kludex commented on Sep 03, 2026 07:23 UTC
    Contributor

    Thanks. :)

    Reviewers
    Assignees
    AleksaMCode AleksaMCode
    Labels
    risk: low confidence: 85.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: 19.6% (LOW) · Higher = larger blast radius
    19.6%
    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: 85.9% · Lower = rushed or shallow review
    85.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: 2.8% · Safe to merge
    2.8%