← Back to Pull requests

Fix version range overlap bounds #215

Merged
Darshan808 merged 6 files (415 lines) on Nov 27, 2026 05:37 UTC
View on GitHub
Darshan808 Darshan808 commented on Nov 25, 2026 07:46 UTC
Author

Fixes the overlap logic in _test_overlap / _compare_ranges and makes them public, so jupyterlab can import them from here (jupyterlab/jupyterlab#20609).

  • Fixes jupyterlab/jupyterlab#20592: a hyphen range's upper bound is now inclusive, so ~4.2.0 overlaps 4.0.0 - 4.2.0.

  • Fixes jupyterlab/jupyterlab#20605: a strict > lower bound now excludes its version, so >1.0.0 doesn't overlap 1.0.0.

  • Based on the interval-intersection approach from jupyterlab/jupyterlab#20607, with two fixes.

  • Moves jupyterlab's tests for these functions into tests/test_version_ranges.py, along with the new tests from jupyterlab/jupyterlab#20596 and jupyterlab/jupyterlab#20607.

  • Moves _compare_ranges / _test_overlap from jupyter_builder.commands to public compare_ranges / ranges_overlap in jupyter_builder.version_ranges, since jupyterlab imports them (jupyterlab/jupyterlab#20613).
  • Diff: 415 lines (+268 / -147) across 6 files Reviewer: chrikrah Review duration: 2751m
    All Vouch review confidence checks passed
    Residual risk 0.06 = Change Risk (0.46) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 415 lines diff across 6 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.87 · 1 substantive comment(s)
    0.87
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    86%
    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.361
    Real PR Conversation Timeline
    4 items
    Darshan808 Darshan808 commented on code on Nov 25, 2026 11:29 UTC
    Code Review
    jupyter_builder/commands.py:1

    I removed this file because I felt like with the additional functions, it could be named better. Since it never had public exports ,by convention I don't think it would be a breaking change.

    chrikrah chrikrah approved these changes on Nov 26, 2026 09:11 UTC
    Approved Reviewer

    @Darshan808 I co-wrote a2621ac, so the part I checked on its own is 2708223 and 495859d. The move to version_ranges keeps every case below, and the #195 file: handling came over with its test (version_ranges.py:92, test_version_ranges.py:7). Nothing I found blocks it.

    # exported trees of base 2721be1 and head 495859d, Python 3.12, jupyter_builder imported from each tree
    $ python probe.py        # base: commands._test_overlap(a, b, drop_prerelease1=True)
    ~4.2.0 | 4.0.0 - 4.2.0 -> False
    1.0.0 - 1.5.0 | 1.5.0 -> False
    >1.0.0 | 1.0.0 -> True
    2.0.0 | ^1.4.0 -> True
    $ python probe.py        # head: version_ranges.ranges_overlap
    ~4.2.0 | 4.0.0 - 4.2.0 -> True
    1.0.0 - 1.5.0 | 1.5.0 -> True
    >1.0.0 | 1.0.0 -> False
    2.0.0 | ^1.4.0 -> False
    $ pytest tests/test_version_ranges.py    # imports pointed at base commands.py
    4 failed, 4 passed
    $ pytest tests/test_version_ranges.py    # head, includes the #195 file: case
    8 passed, 1 warning in 0.24s
    $ mypy jupyter_builder                   # mypy 2.4.1, head
    Success: no issues found in 17 source files
    

    Once #20613 points at version_ranges, I can run the same probe against it if that helps.

    krassowski krassowski approved these changes on Nov 26, 2026 09:41 UTC
    Approved Reviewer

    Thank you @Darshan808!

    Reviewers
    Assignees
    Darshan808 Darshan808
    Labels
    risk: low confidence: 86.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: 46.4% (MEDIUM) · Higher = larger blast radius
    46.4%
    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: 86.2% · Lower = rushed or shallow review
    86.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: 6.4% · Safe to merge
    6.4%