fix(bench): anchor KNOWN_REGRESSIONS staleness to recorded baseline (#1703)#1704
Merged
Conversation
The 'KNOWN_REGRESSIONS entries are not stale' guard measured each entry's age against package.json, which is bumped at release time before the post-publish benchmark-recording PR lands. When the package version jumped >1 minor ahead of the latest recorded baseline (e.g. 3.15.0 while data was stuck at 3.13.0), still-live exemptions keyed to the current baseline were wrongly flagged stale and failed the pre-publish benchmark gate. Anchor staleness to the latest recorded benchmark version instead, computed from the committed history. An exemption is only flagged once a newer baseline that supersedes it has actually landed. Extract the anchor and stale-detection into pure helpers (latestRecordedVersion, findStaleEntries) and add always-on unit tests covering the anchoring, dev/SKIP_VERSIONS exclusion, and the exact #1703 regression case. Closes #1703
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Pre-publish benchmark gate's "KNOWN_REGRESSIONS entries are not stale" test measured each exemption's age againstpackage.json. Butpackage.jsonis bumped at release time, while the benchmark baseline is only recorded after publish (via thebenchmark.ymlworkflow_runPR). During that window the package version races ahead of the recorded baseline.This bit PR #1701 (release 3.15.0): the recorded baseline was stuck at 3.13.0, so the 6 still-live
3.13.0:*exemptions — the actual baseline for the dev-vs-baseline comparison — were flagged as ">1 minor behind 3.15.0" and failed the gate, even though they were not yet dead.Fix
Anchor staleness to the latest recorded benchmark version (computed from the committed build/query/incremental history) instead of
package.json. An exemption is only flagged once a newer baseline that actually supersedes it has landed — which is exactly when it becomes dead weight.latestRecordedVersion(histories)(highest non-dev, non-SKIP_VERSIONSrelease across all history files) andfindStaleEntries(entries, anchorVersion).has at least one engine to comparetests).RUN_REGRESSION_GUARD) covering the anchor selection,dev/SKIP_VERSIONSexclusion, semver (not lexical) ordering, and the exact Release PRs trip the KNOWN_REGRESSIONS staleness guard when version jumps >1 minor ahead of the benchmark baseline #1703 case: a3.13.0entry stays live when the baseline is 3.13.0 but is correctly flagged once the baseline reaches 3.15.0.The guard still forces pruning — it just fires when a superseding baseline lands rather than prematurely at version-bump time.
Verification
RUN_REGRESSION_GUARD=1full suite + unit tests: 25 passed.npm testpath (gated suite skipped): 8 unit tests run, 17 skipped — the anchor logic is now covered even when the data-driven guard isn't.tsc --noEmit: clean. Biome: clean.Test-only change; no Rust mirror needed.
Closes #1703