Skip to content

Integrated benchmark alerts fire on PRs that cannot affect the measured code #29

Closed

Description

@zkochan

The integrated benchmark has alerted on four consecutive pure-code-motion PRs. In at least one the changed code cannot execute in any benchmarked scenario, so the alerts are not measuring what they claim to.

pacquet-integrated-benchmark.yml already anticipates this. It reports each scenario's minimum latency rather than the mean, and the comment explains why:

the latency-free offline scenario is pure CPU/disk and swung ~30% between runs, tripping a spurious alert on a control run whose HEAD and main binaries were byte-identical

That mitigation is not holding.

Evidence

PR What changed Alerts Contradicting signal in the same run
pnpm/pnpm#13649 deps-restorer split + file: fix +23.2%, +27.1%, +23.1% peer-heavy-resolve −25.6%
pnpm/pnpm#13652 tarball crate split 1 alert —
pnpm/pnpm#13657 cli_args/audit.rs only +20.4% —
pnpm/pnpm#13659 frozen-install split +20.5%, +24.4% fresh-resolve −7.7%

pnpm/pnpm#13657 is the decisive case. Its diff touches only the pnpm audit command. Nothing on the install path references that module — it is reachable only from the audit subcommand, which no benchmarked scenario invokes. A 20% install regression from it is not possible.

Two further tells:

The affected scenarios are consistently the short hot ones (roughly 200-500 ms), where a fixed perturbation is a large fraction of the measurement.

Why it matters

--err fails the workflow on a breach, so every PR needs a manual re-run to get green. The larger cost is that a real regression in this size range is now indistinguishable from the noise — the gate cannot do the job it exists for.

Possible directions

Worth measuring before choosing:

  1. Re-run the control experiment. Benchmark byte-identical HEAD and main binaries N times and record per-scenario spread. That gives a real noise floor per scenario instead of assumptions, and says directly whether the min-metric mitigation still works.
  2. Raise min_runs for the short scenarios. The min only needs one uncontended run, so more samples strictly improve it — cheapest fix if the floor is contention-driven.
  3. Widen the boundary, or drop --err, for scenarios whose measured floor exceeds it. Keep them reported, stop them blocking.
  4. Check whether runner heterogeneity is the cause. If baseline and PR runs land on different hardware generations, the minimum shifts with the machine and no sampling strategy fixes it; pinning the runner class would.

Happy to do (1) — it is a self-contained experiment and would tell us which of the rest is warranted.


Written by an agent (Claude Code, claude-opus-5).

Activity

  1. self-assigned this
    on Aug 10, 2026
  2. zkochan commented on Sep 20, 2026

    @zkochan
    MemberAuthor

    Four data points from two PRs this week, one of which could not have affected the measured binary at all.

    pnpm/pnpm#15107 — diff was 100% files under pnpm/crates/cli/tests/suite/, which are never compiled into the release binary the benchmark measures.

    Run Alerted
    first fresh-resolve.hot-cache.offline +23.13%, peer-heavy-resolve.hot-cache.offline +23.35%
    re-run clean

    pnpm/pnpm#15160 — a retry wrapper whose Linux path is a single inlined call, since the retry loop is #[cfg(windows)].

    Commit Contents Result
    33e158bd2f the whole hot-path change, all three call sites passed
    a62d54dd5b, first run two NotFound branches on an error path, plus comments and a changeset repeat-install.cold-cache.hot-store +20.59%
    a62d54dd5b, re-run same commit fresh-resolve.hot-cache.offline +22.73%, linked-workspace-resolve.hot-cache.offline +55.23%

    Two things stand out.

    The alerts do not name the same benchmark twice. Two runs of one commit produced three different alerting benchmarks. A regression moves the same measurement every time; this moves around.

    The commit that carried the change passed, and the one that could not have caused a regression failed. Whatever the alerts track, it is not the diff.

    fresh-resolve.hot-cache.offline alerts in both PRs, including the test-only one, so it looks like the least stable of them.

    Margins are also thin against the boundaries: the first pnpm/pnpm#15160 alert was 7.37 ms against a 7.33 ms upper boundary, 0.5% over, on a 7 ms benchmark whose siblings that run came in at +1.34%, -0.75% and -0.09%.

    Worth considering whether the sub-10 ms benchmarks can carry a percentage threshold at all on shared runners, and whether a diff that touches no code the benchmark compiles should be measured against a threshold in the first place.


    Written by an agent (Claude Code, claude-opus-5).

  3. zkochan commented on Sep 21, 2026

    @zkochan
    MemberAuthor

    Another data point, from pnpm/pnpm#15188 (a test-only PR plus a monomorphized generic parameter).

    gvs-linker.fresh-restore.hot-cache.hot-store alerted twice on the same head: 123.84 ms, then 129.12 ms on a re-run, against a 123.56 ms upper boundary.

    The integrated-benchmark table from the same job shows why that is not the PR:

    Command Mean [ms] Min [ms]
    pacquet@HEAD 137.4 ± 5.9 129.1
    pacquet@main 140.7 ± 6.2 132.1

    pacquet@main's own minimum, measured on the same machine in the same job, is 132.1 ms. That is above the 123.56 ms boundary Bencher applied to HEAD. So main alerts on itself on that runner, and any PR branched from it inherits the alert regardless of its contents.

    This one is worth separating from the pure-variance cases already on this issue: repeated runs landed at 123.84 and 129.12 ms, so it is not only run-to-run spread. The boundary looks stale relative to what the runner currently measures for main.

    The in-job HEAD-vs-main table is the check that survives this, since both sides run on the same machine. It is already produced and posted on every PR.


    Written by an agent (Claude Code, claude-opus-5).

  4. transferred this issue frompnpm/pnpmon Sep 26, 2026
  5. zkochan commented on Sep 26, 2026

    @zkochan
    MemberAuthor

    Fixed by pnpm/pnpm#15228 and pnpm/pnpm#15231.

    The new check runs on merged PRs: 16205, 16197, 16196, 16187 and 15886 all report "Same-run benchmark comparison" and passed.


    Written by an agent (Claude Code, claude-opus-5-5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions