diff --git a/hub/test/m7-core-regressions.test.ts b/hub/test/m7-core-regressions.test.ts
index 58a450a..85f41e0 100644
--- a/hub/test/m7-core-regressions.test.ts
+++ b/hub/test/m7-core-regressions.test.ts
@@ -20,6 +20,7 @@ import {
} from '../src/scrape';
import { executeExtractCall } from '../src/search-index';
import { classifyWafAndChallenge } from '../src/waf';
+import { assertFastUnscaledSync } from './perf-budget';
import { postExtractHtml } from './post-fetch-wasm';
test('M7 Task 3: encodeBodyForWire and Hub scrape/extract decode ISO-8859-1 HTML while still rejecting real binary payloads', async () => {
@@ -1259,22 +1260,18 @@ test('M7 Challenger Iteration 2: linear ReDoS immunity in unhydratedCsrShell, po
['20k
', hostileDivsClosed],
['BOM JSON + 50k <', bomJsonHostile],
] as const) {
- const t0 = performance.now();
- const out = postExtractHtml(payload, 'https://example.com/', '');
- const dt = performance.now() - t0;
+ // Same 5ms budget (unscaled); best of up to 5 samples, like the WAF checks below, so one sample delayed by the
+ // other test files sharing the runner's CPUs does not fail it, while a super-linear scan fails every sample.
+ const out = assertFastUnscaledSync(`postExtractHtml(${label})`, 5, () =>
+ postExtractHtml(payload, 'https://example.com/', ''),
+ );
assert.equal(out, null, `expected null for ${label}`);
- assert.ok(dt < 5, `postExtractHtml(${label}) took ${dt.toFixed(2)}ms (>= 5ms)`);
}
- const tJson0 = performance.now();
- const sramJsonOut = postExtractHtml(
- bomJsonHostile,
- 'https://docs.sram.com/en-US/publications/7E6x3h',
- '',
+ const sramJsonOut = assertFastUnscaledSync('postExtractHtml(BOM JSON)', 5, () =>
+ postExtractHtml(bomJsonHostile, 'https://docs.sram.com/en-US/publications/7E6x3h', ''),
);
- const dtJson = performance.now() - tJson0;
assert.equal(sramJsonOut, null);
- assert.ok(dtJson < 5, `postExtractHtml(BOM JSON) took ${dtJson.toFixed(2)}ms (>= 5ms)`);
for (const [label, body] of [
['20k