fix(performance): report slack usage only for entries that have slack

A wall-clock measurement above `value` but within `value × toleranceRatio`
fell into the slack branch and was reported as using "slack", conflating
timing tolerance with counter slack. Only entries with `slack` report it now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0166PWobUjpoiWt8E9bBdsCs
This commit is contained in:
Claude committed 2026-09-28 06:11:23 +00:00
1 parent 13250e6752
commit bceb096e83
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -188,7 +188,7 @@ export function compareToBaselines({ baselines, summary, only = [] }) {
result.failures.push(
`${label}: ${formatNumber(measured)}${unit} exceeds ${limitText} by ${formatNumber(measured - limit)}${unit}. Bring the value back down; baselines only move down. If the growth is a deliberate trade-off, raise the baseline in ${DEFAULT_BASELINES_PATH}, make the case in the PR, and ask a maintainer to add the ${BASELINE_INCREASE_LABEL} label.`
);
} else if (measured > entry.value) {
} else if (entry.slack && measured > entry.value) {
result.passed.push(
`${label}: ${formatNumber(measured)}${unit} within ${limitText}; uses ${formatNumber(measured - entry.value)} of ${formatNumber(limit - entry.value)}${unit} slack.`
);
@@ -155,8 +155,9 @@ test('wall-clock entries fail only above value × toleranceRatio', () => {
assert.deepEqual(within.failures, []);
assert.match(
within.passed[1],
/1,250 ms within 1,250 \(baseline 1,000 × 1\.25\)/
/1,250 ms within 1,250 \(baseline 1,000 × 1\.25\)\.$/
);
assert.doesNotMatch(within.passed[1], /slack/);
const above = compareToBaselines({
baselines,