From a665ef8ff1f54843b9dc769c2106b728b76922ef Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2026 07:39:01 +0100 Subject: [PATCH] Format the new consuming guidance browser check Use the matched offline frontend snapshot to format the newly added driver before its browser acceptance. The canonical dependency tree refused access and was not retried; only the authorised launch export was used. No guide, component, reading or safety changes. Contract-Neutral: Format the new browser driver only; no runtime, guidance, reading or safety contract delta. Change-source: pulse-maintainer --- .../browser-tests/guest-disk-docs-context.cjs | 120 ++++++++++++++---- 1 file changed, 92 insertions(+), 28 deletions(-) diff --git a/frontend-modern/browser-tests/guest-disk-docs-context.cjs b/frontend-modern/browser-tests/guest-disk-docs-context.cjs index 81f77a3303..a6537a1153 100644 --- a/frontend-modern/browser-tests/guest-disk-docs-context.cjs +++ b/frontend-modern/browser-tests/guest-disk-docs-context.cjs @@ -4,7 +4,9 @@ const fs = require('node:fs'); const crypto = require('node:crypto'); const assert = require('node:assert/strict'); const { chromium, webkit } = require('playwright'); -const { createPublicationFixtureServer } = require('/workspace/frontend-modern/browser-tests/publication-fixture-server.cjs'); +const { + createPublicationFixtureServer, +} = require('/workspace/frontend-modern/browser-tests/publication-fixture-server.cjs'); const root = '/workspace/frontend-modern'; const output = '/workspace/tmp/guest-disk-docs-context'; const origin = 'http://127.0.0.1:5331'; @@ -19,11 +21,17 @@ const hash = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex'); cases: [], captures: [], cleanup: { browser: false, server: false }, - limits: 'Current-source presentation and guidance with safe fixtures; not PR #2893, native recovery, installed use or release acceptance.', + limits: + 'Current-source presentation and guidance with safe fixtures; not PR #2893, native recovery, installed use or release acceptance.', }; let server, browser; try { - assert.equal(result.playwright, JSON.parse(fs.readFileSync('/workspace/tests/integration/package-lock.json')).packages['node_modules/@playwright/test'].version); + assert.equal( + result.playwright, + JSON.parse(fs.readFileSync('/workspace/tests/integration/package-lock.json')).packages[ + 'node_modules/@playwright/test' + ].version, + ); server = createPublicationFixtureServer(root, 5331, 'browser-tests/guest-reading-help.html'); result.compiled = server.binding; const docHash = hash(fs.readFileSync(root + '/public/docs/VM_DISK_MONITORING.md')); @@ -35,9 +43,11 @@ const hash = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex'); ['chromium-desktop', chromium, 1365], ['webkit-phone', webkit, 390], ]) { - browser = await engine.launch(engine === chromium - ? { headless: true, channel: 'chromium', args: ['--no-sandbox'] } - : { headless: true }); + browser = await engine.launch( + engine === chromium + ? { headless: true, channel: 'chromium', args: ['--no-sandbox'] } + : { headless: true }, + ); const context = await browser.newContext({ viewport: { width, height: 900 }, isMobile: width <= 768, @@ -46,56 +56,104 @@ const hash = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex'); }); const page = await context.newPage(); page.setDefaultTimeout(12000); - const record = { name, browser: browser.version(), width, errors: [], requests: [], docs: [] }; + const record = { + name, + browser: browser.version(), + width, + errors: [], + requests: [], + docs: [], + }; result.cases.push(record); page.on('pageerror', (error) => record.errors.push(error.message)); page.on('response', (response) => { if (new URL(response.url()).pathname === '/docs/VM_DISK_MONITORING.md') { - record.docs.push(response.body().then((body) => ({ status: response.status(), sha256: hash(body) }))); + record.docs.push( + response.body().then((body) => ({ status: response.status(), sha256: hash(body) })), + ); } }); await page.route('**/*', (route) => { - const request = route.request(), url = new URL(request.url()); - record.requests.push({ method: request.method(), path: url.pathname, external: url.origin !== origin }); - if (url.origin !== origin) return route.abort(); - if (url.pathname.startsWith('/api/')) return route.fulfill({ - status: 200, contentType: 'application/json', - body: JSON.stringify({ success: true, data: [], alerts: [], anomalies: [], config: null }), + const request = route.request(), + url = new URL(request.url()); + record.requests.push({ + method: request.method(), + path: url.pathname, + external: url.origin !== origin, }); + if (url.origin !== origin) return route.abort(); + if (url.pathname.startsWith('/api/')) + return route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ + success: true, + data: [], + alerts: [], + anomalies: [], + config: null, + }), + }); return route.continue(); }); await page.goto(origin, { waitUntil: 'domcontentloaded' }); await page.waitForFunction(() => window.__readingHelp); - const disclosure = page.locator('[data-guest-id="fixture-pve:pve-a:101"] [data-row-action]').first(); + const disclosure = page + .locator('[data-guest-id="fixture-pve:pve-a:101"] [data-row-action]') + .first(); if (width <= 768) await page.getByText('reading-guest', { exact: true }).tap(); - else { await disclosure.focus(); await page.keyboard.press('Enter'); } + else { + await disclosure.focus(); + await page.keyboard.press('Enter'); + } const drawer = page.getByRole('region', { name: 'Guest details' }); await drawer.waitFor({ state: 'visible' }); const details = drawer.getByTestId('guest-technical-details'); assert.match(await details.innerText(), /does not prove it is absent or stopped/); const guidance = details.getByRole('link', { name: 'Filesystem reading guidance' }); if (width <= 768) await guidance.tap(); - else { await guidance.focus(); await page.keyboard.press('Enter'); } - await page.locator('#a-missing-reading-is-not-an-installation-diagnosis').waitFor({ state: 'visible' }); - const contextLink = page.getByRole('link', { name: "Check the reading's context", exact: true }); + else { + await guidance.focus(); + await page.keyboard.press('Enter'); + } + await page + .locator('#a-missing-reading-is-not-an-installation-diagnosis') + .waitFor({ state: 'visible' }); + const contextLink = page.getByRole('link', { + name: "Check the reading's context", + exact: true, + }); if (width <= 768) await contextLink.tap(); - else { await contextLink.focus(); await page.keyboard.press('Enter'); } + else { + await contextLink.focus(); + await page.keyboard.press('Enter'); + } const heading = page.locator('#current-retained-and-unavailable-disk-readings'); await heading.waitFor({ state: 'visible' }); await heading.scrollIntoViewIfNeeded(); const text = (await page.locator('article').innerText()).replace(/\s+/g, ' '); for (const expected of [ - 'select the disk reading indicator', 'phone or with a keyboard', + 'select the disk reading indicator', + 'phone or with a keyboard', 'presence or absence of a caption does not establish freshness', "same guest's explanation before treating it as an agent setup problem", - 'unknown, not zero', 'not current free space', - 'not a monitoring-coverage check', 'does not prove that the QEMU-only path recovered', + 'unknown, not zero', + 'not current free space', + 'not a monitoring-coverage check', + 'does not prove that the QEMU-only path recovered', 'Do not bypass a guest-read pause or widen token access', - ]) assert.ok(text.includes(expected), `Missing rendered guidance: ${expected}`); + ]) + assert.ok(text.includes(expected), `Missing rendered guidance: ${expected}`); assert.doesNotMatch(text, /wider rows use Last known and Unavailable/); record.guide = { url: page.url(), heading: await heading.innerText(), checks: 9 }; - record.layout = await page.evaluate(() => ({ width: document.documentElement.clientWidth, scrollWidth: document.documentElement.scrollWidth })); - assert.ok(record.layout.scrollWidth <= record.layout.width + 1, JSON.stringify(record.layout)); + record.layout = await page.evaluate(() => ({ + width: document.documentElement.clientWidth, + scrollWidth: document.documentElement.scrollWidth, + })); + assert.ok( + record.layout.scrollWidth <= record.layout.width + 1, + JSON.stringify(record.layout), + ); const file = name + '-reading-context.png'; await page.screenshot({ path: output + '/' + file }); result.captures.push({ file, sha256: hash(fs.readFileSync(output + '/' + file)) }); @@ -103,7 +161,10 @@ const hash = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex'); assert.ok(record.docs.length > 0, 'Docs did not consume the changed producer'); for (const doc of record.docs) assert.deepEqual(doc, { status: 200, sha256: docHash }); assert.deepEqual(record.errors, []); - assert.equal(record.requests.filter((request) => !['GET', 'HEAD'].includes(request.method)).length, 0); + assert.equal( + record.requests.filter((request) => !['GET', 'HEAD'].includes(request.method)).length, + 0, + ); assert.equal(record.requests.filter((request) => request.external).length, 0); await context.close(); await browser.close(); @@ -121,4 +182,7 @@ const hash = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex'); result.cleanup.server = true; fs.writeFileSync(output + '/result.json', JSON.stringify(result, null, 2) + '\n'); } -})().catch((error) => { console.error(error); process.exitCode = 1; }); +})().catch((error) => { + console.error(error); + process.exitCode = 1; +});