← Back to Pull requests

ci: compare the browser timings with the base commit (P73) #322

Closed
unknown closed this pull request without merging on Nov 27, 2026 15:10 UTC
View on GitHub
unknown unknown commented on Nov 26, 2026 17:45 UTC
Author

What and why

Closes #185 (P73). The last open item on it was "a regression run for the browser timings" (docs/BENCHMARKS.md, "Still to come"); the rest of the done-when list is on main (#226, #228, #232, #233, #297).

  • browser-timings job (.github/workflows/bench.yml). On pull requests that touch the timed code (core.ts, envelope.ts, any *.browser.bench.ts, backend/, the frontend's dependencies), it runs npm run bench:browser in Chromium at the base commit (the merge ref's first parent) and then the head, on one runner. Each side is checked out in place, builds its own wasm module with the wasm-bindgen CLI its own Cargo.lock pins, and installs its own dependencies, so the base build reuses the restored cache. A regression is a warning in the job summary; the job fails only when the comparison cannot run. The summary also gives each commit's Chromium version and wasm module size. Pushes to main only build the module, for the cache, and the job does not run on demand, since the browser workflow times all three browsers then. Not a required check.

  • scripts/bench-compare.sh vitest <base.json> <head.json>. The agreed rule (the lower bound of the 95 % interval of the mean change above +10 %) on two Vitest reports. Vitest gives each benchmark's mean and standard error but no interval for the change, so the script computes one: the delta method for the ratio of two independent means, with the larger of the two runs' t critical values. A benchmark with one sample in either run (the wasm cold start) is listed, not judged. Exit codes are the criterion mode's: 1 for a regression, 2 when nothing could be judged or a report is unusable.

  • scripts/bench-targets.sh lists the bench targets of every workspace crate, so a criterion bench added outside platform-crypto and quackxide-engine (P85's attestation round trip, say) joins the bench job without an edit. Its output is unchanged today.

  • Docs. docs/BENCHMARKS.md gains how to compare browser timings locally, the job, an "Adding a benchmark" section for what P55, P56 and P85 add, and the rule for Vitest results; "Still to come" is gone. docs/TESTING.md, CONTRIBUTING.md, docs/PROJECT_SCOPE.md and CHANGELOG.md follow.
  • @AxolDad: the browser timings' rule is marked "proposed, needs @AxolDad" in docs/BENCHMARKS.md. If you agree, I'll mark it agreed before you approve, so the approval isn't dismissed.

    @abendrothj: this differs from what you proposed on #185, a comparison by hand that flags a regression when the head's mean ± rme starts more than 10 % of the base mean above the base's interval. It runs in CI instead, which the done-when allows ("base and head are compared in the same job with a written threshold"), and computes the change's interval, so the browser timings use the same rule as the native benchmarks rather than a second one. Yours is the more conservative: with both rme at 3 %, it flags a change above about 16.5 %, this one above about 15 %. I can switch to yours if you both prefer it.

    Not in this PR: since #286 the wasm module is 861 675 bytes, about 228 KiB at brotli -11 (a local build), against the "under 64 KiB brotli-compressed (now 31.8 KiB)" target under "Browser envelope seal". That is P85's target to revisit; this job now shows the module's size at both commits.

    How it was tested

  • scripts/bench-compare.sh selftest (run by check.sh) covers the Vitest mode: regressed, improved and within threshold, with the interval checked exactly; a three-sample head whose larger t critical value keeps within threshold a change the base's would have flagged; one-sample, new and removed benchmarks. Each unusable input exits 2: a repeated name, a zero or missing mean, a missing t critical value, no results, truncated JSON, a missing file, nothing judged. Mutating each term of the formula fails the selftest.

  • Headless Chromium 159 on an Apple M4: three runs of the same code, compared pairwise, all within threshold (every change within ±4 %). With a second encryption planted in encryptPayload: +92 % at 4 KiB and +98 % at 4 MiB, both regressed, exit 1. The compare step on its own: a regression gives the warning and exits 0; an unusable report fails it.

  • The job's run: steps, read from bench.yml and run in order in a scratch clone against a merge commit of main and this branch, with the uses: steps done by hand: both sides built, timed and compared, and the summary came out; the push path only builds the module. A depth-2 clone of a merge commit can read and check out its first parent. This pull request is the job's first real run.

  • scripts/check.sh passes (locally without gitleaks, so the secret scan was skipped).
  • Checklist

  • scripts/check.sh passes locally

  • Every new refusal has a negative test (each unusable report, in the selftest)

  • Every new security decision emits a SECURITY_AUDIT_EVENT covered by audit_coverage.rs (n/a: CI and docs only)

  • Fails closed on missing configuration, key material, or attestation (an empty or unusable report fails the job, never passes)

  • No new cryptographic primitives; suites stay behind their type aliases

  • Synthetic or public data only (docs/DATA_POLICY.md)

  • Docs and CHANGELOG.md updated for user-visible changes

  • Architectural decision recorded in docs/adr/ if one was made (n/a: the issue needs no ADR)
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: abendrothj Review duration: 1285m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #322"
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 20.5% · Safe to merge
    20.5%