diff --git a/demo/benchmark_glow.mjs b/demo/benchmark_glow.mjs index 3c08a929..f61019b1 100644 --- a/demo/benchmark_glow.mjs +++ b/demo/benchmark_glow.mjs @@ -87,7 +87,7 @@ const viewport = { width: 1280, height: 900 }; const { page, browser } = await launch( viewport, 1, ['--enable-precise-memory-info', '--js-flags=--expose-gc'], - {}, resolve(targetRoot, 'demo/srv'), + {}, resolve(targetRoot, 'demo/srv'), targetRoot, ); await page.addScriptTag({ content: `window.__hpAssertCardContract = ${assertCardContract.toString()};`, diff --git a/demo/benchmark_large_house.mjs b/demo/benchmark_large_house.mjs index 500dfefd..9406baa0 100644 --- a/demo/benchmark_large_house.mjs +++ b/demo/benchmark_large_house.mjs @@ -43,6 +43,7 @@ const { page, browser } = await launch( ['--enable-precise-memory-info', '--js-flags=--expose-gc'], {}, resolve(targetRoot, 'demo/srv'), + targetRoot, ); await page.emulateMedia({ reducedMotion: 'reduce' }); await page.addStyleTag({ diff --git a/demo/serve.mjs b/demo/serve.mjs index 88a0af64..5471ebc0 100644 --- a/demo/serve.mjs +++ b/demo/serve.mjs @@ -50,6 +50,7 @@ export async function launch( browserArgs = [], contextOptions = {}, serveRoot = ROOT, + repoRoot = REPO_ROOT, ) { const browser = await chromium.launch({ args: ['--no-sandbox', ...browserArgs] }); const page = await (await browser.newContext({ @@ -75,7 +76,7 @@ export async function launch( // круга разбора: три проверки упали, четвёртая ложно прошла, поскольку старый // код одинаково врал в двух местах, которые сверялись друг с другом. // golden и бенчмарки эту защиту имели с самого начала, смоки — нет. - await assertFreshDemoBundleUnlessAllowed(page, REPO_ROOT); + await assertFreshDemoBundleUnlessAllowed(page, repoRoot); // HP-1552: the first-open boot veil hides the plan (visibility:hidden) until // the stage height settles — real pointer interaction cannot hit a hidden // plan, so every smoke starts where the user does: with the plan revealed. diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index 249d0504..9b8163bb 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -158,7 +158,9 @@ limits. See When the comparison base predates `scripts/bundle-sync.mjs`, the workflow still builds that exact tree and materializes its fresh bundle through the equivalent legacy copy path. This keeps old stable releases usable as performance baselines -without borrowing build output from the candidate. +without borrowing build output from the candidate. Comparative benchmark +launches also pass that target tree as the freshness authority; the ordinary +smoke launcher continues to default to the current repository root. Both browser diagnostics require a freshly built/copied demo bundle. Rollup embeds a SHA-256 fingerprint of `src/` plus the locked package and Rollup/TypeScript build inputs; benchmark/golden runners fail before diff --git a/test/bundle-freshness.test.mjs b/test/bundle-freshness.test.mjs index 1b4a1d05..a8771224 100644 --- a/test/bundle-freshness.test.mjs +++ b/test/bundle-freshness.test.mjs @@ -123,6 +123,14 @@ test('the smoke launcher enforces the gate on the repository root (#236)', async const source = readFileSync( new URL('../demo/serve.mjs', import.meta.url), 'utf8', ); - assert.match(source, /assertFreshDemoBundleUnlessAllowed\(page, REPO_ROOT\)/); + assert.match(source, /repoRoot = REPO_ROOT/); + assert.match(source, /assertFreshDemoBundleUnlessAllowed\(page, repoRoot\)/); assert.match(source, /const REPO_ROOT = dirname\(dirname\(/); }); + +test('comparative benchmarks pass the target repository root to the launcher', () => { + for (const file of ['benchmark_large_house.mjs', 'benchmark_glow.mjs']) { + const source = readFileSync(new URL(`../demo/${file}`, import.meta.url), 'utf8'); + assert.match(source, /resolve\(targetRoot, 'demo\/srv'\)[\s\S]{0,40}targetRoot/); + } +});