← Back to Pull requests

Shard the WebCryptoAPI WPT suite #8853

Closed
unknown closed this pull request without merging on Nov 25, 2026 19:58 UTC
View on GitHub
unknown unknown commented on Nov 24, 2026 04:32 UTC
Author

The WebCryptoAPI WPT suite runs as one test of about 210 files. It takes 25 seconds in an ASan build and 35 in TSan, and most of that is generating RSA keys: the three RSA files of generateKey/successes take 16 of the 25 seconds, and successes_RSA-OAEP.https.any.js alone takes 10. Splitting the suite by file can't bring it much below that one file.

WPT splits such files into variants that each select a range of subsetTest() calls (// META: variant=?1-10), and runs each variant as its own test. This PR makes the harness do the same, and lets a wpt_test() target be sharded.

Harness

  • subsetTest() runs only the calls in the range that the test's variant selects, as /common/subset-tests.js does. A test without such a variant still runs them all.

  • A file whose variants all select ranges runs each variant as a separate unit, with its own results, reported under the variant's URL (…/successes_RSA-OAEP.https.any.html?1-10) as WPT reports them. Files with expectedFailures still run whole, so each expected failure is still checked against all of the file's subtests.

  • Each variant evaluates the file again, so subtests outside subsetTest() calls (such as setup - define tests in hkdf and pbkdf2) run once per variant, as in WPT. Apart from those, the suite runs the same subtests with the same results: 1786 expected failures before and after. encoding's two files with range variants also split, and run the same subtests as before.
  • Sharding

  • wpt_test() accepts shard_count. The generated module reads TEST_TOTAL_SHARDS and TEST_SHARD_INDEX from cloudflare:workers, and shard i runs every n-th unit starting at i. Its report and stats cover only the units it ran.

  • wd_test() gains a supports_sharding attribute, which makes the test script touch TEST_SHARD_STATUS_FILE so that Bazel accepts the sharding. wpt_test() sets it.

  • wpt_logs.py also reads the logs in shard_<n>_of_<count>/ directories, and adds up the stats of a target's shards.
  • WebCryptoAPI now uses 8 shards, and drops from enormous to large. Timings on Linux x64, slowest shard (before: the whole test):

    | Config | Before | After |
    | --- | --- | --- |
    | debug | 33.0s | 8.2s |
    | ASan | 25.7s | 7.1s (max of 5 runs) |
    | TSan | 35.2s | 10.4s (max of 5 runs) |

    All //src/wpt/... targets pass.

    🤖 Generated with Claude Code

    Diff: 300 lines (+225 / -75) across 3 files Reviewer: npaun Review duration: 2365m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.63) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 300 lines diff across 3 files
    0.63
    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%
    56%
    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.341
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #8853"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed sensitive_module
    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: 63.2% (MEDIUM) · Higher = larger blast radius
    63.2%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 27.4% · Safe to merge
    27.4%