← Back to Pull requests

perf(add): skip the second OSV query for packages the name gate already cleared #2034

Closed
unknown closed this pull request without merging on Dec 03, 2026 21:35 UTC
View on GitHub
unknown unknown commented on Dec 03, 2026 20:40 UTC
Author

aube add left-pad asked OSV about left-pad twice: once in the name gate before the manifest is written, and again in the live check after resolve. The second query is on the critical path of the install, so every aube add waited for an extra OSV round trip even when the answer was already known.

Now the name gate remembers which packages OSV cleared, and the scoped live check after resolve skips them. Packages the add brings in transitively are still checked, so aube add express still sends its new dependencies to OSV.

What counts as cleared:

  • Name-only query (aube add left-pad, aube add left-pad@^1): only names whose OSV response lists no MAL- advisory for any version. A name-only query returns every advisory for the package, so a versioned query for any of its versions would also be clean. Names whose only advisories cover specific releases are not cleared. The gate lets those through, but the versioned check still has to look at them. Results that OSV paginated are never treated as clean.

  • Exact version (aube add left-pad@1.3.0): the exact pair, when the versioned query came back clean.

  • A failed query clears nothing, so under advisoryCheck = on the live check still runs after a degraded gate.
  • Protection is unchanged. The skip only applies where the live check is already scoped to new picks: aube add under the default advisoryCheck = on. advisoryCheck = required, paranoid, and advisoryCheckEveryInstall keep the full live check.

    Benchmark

    aube add left-pad, interleaved, 9 rounds each, warm caches, against a local stand-in for api.osv.dev (100 ms to connect, 50 ms per request). Median wall ms:

    | fixture | before | after |
    |---|---|---|
    | next | 558 | 370 (-34%) |
    | astro | 528 | 347 (-34%) |
    | vue | 588 | 401 (-32%) |

    The stand-in logged one OSV request per aube add left-pad instead of two. aube add express (new transitive dependencies) still made two.

    Validation

  • Unit tests: which names a response clears (MAL, non-MAL, paginated), next_page_token parsing, cleared-set matching, and when the scope applies.

  • cargo clippy --workspace --all-targets -- -D warnings, cargo fmt, and the add_supply_chain and supply_chain tests pass locally.
  • 🤖 Generated with Claude Code

    AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5-5; version: unavailable.

    ---
    _Generated by Claude Code_

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    Avoid repeating malicious-advisory checks for package names or exact versions already confirmed clean during the add flow.
    Preserve full advisory checks when they’re required or configured for every install.
    Treat results as clean only when no malicious advisory is found and no additional OSV results remain to be checked.
    Keep advisory results in input order when checking multiple package versions.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 388 lines (+291 / -97) across 4 files Reviewer: jdx Review duration: 54m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 388 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.357
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2034"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 43.1% (MEDIUM) · Higher = larger blast radius
    43.1%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 17% · Safe to merge
    17%
    Repository