[ci] Run performance benchmarks on demand - #5403
Conversation
commit: |
Bundle size
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@claude review |
PR reviewNothing here touches library runtime code, so there is no user-facing regression risk — but the new machinery has one deterministic misbehaviour (the publish workflow treats a routine push as artifact tampering) plus several load-bearing assumptions about Bugs (13)1. 🟠 The trust pin runs before the staleness check, so a normal push fails the publish workflow with a tampering messageLocation: if (pullRequest.head.sha !== context.payload.workflow_run.head_sha) {
throw new Error('The collector artifact does not describe the run that produced it.');
}
if (pullRequest.state !== 'open' || pullRequest.head.sha !== collectorContext.headSha) {
core.notice('The pull request is closed or has advanced past this collector run.');
return;
}The two checks are in the wrong order. The severities are also inverted: a benign race produces a red workflow run accusing the artifact of not describing its own run, while a genuinely forged Failure scenario: Author pushes Fix: Pin trust on the artifact, then treat divergence from the live PR as a skip: if (collectorContext.headSha !== context.payload.workflow_run.head_sha) {
throw new Error('The collector artifact does not describe the run that produced it.');
}
if (pullRequest.state !== 'open' || pullRequest.head.sha !== collectorContext.headSha) {
core.notice('The pull request is closed or has advanced past this collector run.');
return;
}This is equally safe — an artifact claiming a victim 2. 🟠 The whole ABBA comparison rests on
|
|
I went through each finding and applied the ones with confirmed current impact or a sufficiently cheap hardening path. Addressed
Not changed
Validation passed for workflow YAML parsing, embedded JavaScript syntax, Prettier, ESLint, and 🤖 Follow-up generated with Codex |
|
@brijeshb42 can you check if it makes sense for this to be part of the mui-public so it can be reused across other repos too? |
Render counts are the only worthwhile signal in the benchmark suite because they're deterministic, so any change is meaningful. The timing numbers are noise on the other hand: the baseline and head currently run on different machines under different conditions, so deltas mostly measure the environment. And the full suite takes long enough that it blocks the rest of CI on every relevant PR.
Previously the timing suite ran on every push, measuring each side once in a fixed base-then-head order — expensive, and runner drift systematically biased the head result. Now each PR gets a cheap, deterministic render-count diff automatically, while the full suite runs only on
/benchmark, measuring both sides twice in counterbalanced ABBA order so drift cancels and nondeterministic benchmarks fail loudly.Changes
/benchmarkcomment from a maintainer. It runs currentmasterand the exact PR head in ABBA order (master, PR, PR,master) on a single CircleCI runner, so both sides are measured on the same machine under the same conditions in one run.Since the full suite no longer gates every PR, it's also free to grow — more benchmarks and more samples are fine when the run is on demand.