Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
feat(test): every hosted shape runs in Chromium and WebKit [H5,H17,N26]
Corey Olson3ba099770a5c
diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.ymlindex aadc59bc..4adfefd7 100644--- a/.github/workflows/gate.yml+++ b/.github/workflows/gate.yml@@ -59,6 +59,22 @@ jobs:- run: node bin/pullboard.js spec check- run: npm test -- --shard=${{ matrix.shard }}/${{ matrix.shards }}+ hosted-shapes:+ name: hosted shapes (every way to open a board through pullboard.dev)+ if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'+ runs-on: ubuntu-latest+ # Hang ceiling for six board states in each available browser; WebKit runs only where a Playwright build exists.+ timeout-minutes: 45+ steps:+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0+ - uses: actions/setup-node@v4+ with:+ node-version: '24'+ - name: Run the matrix outside the gate+ run: npm run hosted-shapes+perf:name: view performance (3000 items, eight projects)if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'diff --git a/package.json b/package.jsonindex e7207055..e5893f46 100644--- a/package.json+++ b/package.json@@ -43,6 +43,7 @@"homepage": "https://pullboard.dev","scripts": {"test": "node bin/run-tests.js",- "gate": "node test/wall-clock-budgets.js && node bin/pullboard.js spec check && npm test"+ "gate": "node test/wall-clock-budgets.js && node bin/pullboard.js spec check && npm test",+ "hosted-shapes": "PULLBOARD_HOSTED_SHAPES=1 node bin/run-tests.js test/hosted-shapes.test.js"}}diff --git a/test/hosted-browsers.js b/test/hosted-browsers.jsnew file mode 100644index 00000000..3b77307d--- /dev/null+++ b/test/hosted-browsers.js@@ -0,0 +1,264 @@+/**+ * Real Chromium and real WebKit behind one small interface, for the hosted-shapes matrix [H5,H17,N26]. Each engine+ * opens isolated contexts (their own cookies and storage), and each page routes every request it makes through the+ * test: nothing reaches the real network. A route answers a request by continuing it to another URL (event streams+ * stay live), by fulfilling it with a body, or by failing it, as a refused connection does.+ */+import { readFileSync } from 'node:fs';+import { join } from 'node:path';+import {+ findChromeExecutable,+ startChrome,+} from './chrome-fixture.js';+import {+ findWebkitExecutable,+ startWebkit,+} from './webkit-fixture.js';++/** How long one browser command may take before the matrix names it as stuck. */+const COMMAND_MS = 15_000;++/** Wait a little without holding the event loop. */+function pause(ms) {+ return new Promise((resolvePause) => setTimeout(resolvePause, ms)); // budget: hang ceiling for one poll interval, no speed claim.+}++/**+ * The engines this machine can run, each with the reason it cannot when it cannot.+ *+ * @returns {{ name: 'chromium' | 'webkit', available: boolean, reason: string }[]}+ */+export function hostedEngines() {+ return [+ { name: 'chromium', available: Boolean(findChromeExecutable()), reason: 'Chrome is not installed; set PULLBOARD_CHROME' },+ { name: 'webkit', available: Boolean(findWebkitExecutable()), reason: 'no Playwright WebKit build on this machine; set PULLBOARD_WEBKIT to one' },+ ];+}++/**+ * Wrap a page's evaluate in the shared page API: a JSON value from a synchronous expression, and a poll for a truthy one.+ *+ * @param {(expression: string) => Promise<any>} evaluate+ */+function pageApi(evaluate) {+ return {+ evaluate,+ /** Poll an expression until it is truthy and return its value, or null at the deadline. */+ async poll(expression, timeoutMs) {+ const end = Date.now() + timeoutMs;+ do {+ try {+ const value = await evaluate(expression);+ if (value) return value;+ } catch { /* A document mid-navigation answers on the next poll. */ }+ await pause(30);+ } while (Date.now() < end);+ return null;+ },+ };+}++/**+ * Open Chromium with a browser-level DevTools connection, so each context is a real isolated browser context.+ *+ * @returns {Promise<{ name: 'chromium', newContext: () => Promise<object>, close: () => Promise<void> }>}+ */+async function openChromium() {+ const chrome = await startChrome({ commandTimeoutMs: COMMAND_MS });+ const [port, path] = readFileSync(join(chrome.profileDirectory, 'DevToolsActivePort'), 'utf8').split('\n');+ const socket = new WebSocket(`ws://127.0.0.1:${port}${path}`);+ await new Promise((opened, failed) => {+ socket.addEventListener('open', opened, { once: true });+ socket.addEventListener('error', () => failed(new Error('Chromium browser socket failed')), { once: true });+ });+ const pending = new Map();+ const sessions = new Map();+ let nextId = 0;+ socket.addEventListener('message', ({ data }) => {+ const message = JSON.parse(String(data));+ const waiting = message.id !== undefined ? pending.get(message.id) : null;+ if (waiting) {+ pending.delete(message.id);+ clearTimeout(waiting.timer);+ message.error ? waiting.reject(new Error(`Chromium ${waiting.method}: ${message.error.message}`)) : waiting.resolve(message.result ?? {});+ } else if (message.sessionId) sessions.get(message.sessionId)?.(message);+ });+ /** Send one command to the browser, or to one attached page session. */+ function send(method, params = {}, sessionId) {+ return new Promise((resolveSend, rejectSend) => {+ const id = ++nextId;+ const timer = setTimeout(() => { pending.delete(id); rejectSend(new Error(`Chromium ${method} did not answer within ${COMMAND_MS}ms`)); }, COMMAND_MS);+ pending.set(id, { resolve: resolveSend, reject: rejectSend, timer, method });+ socket.send(JSON.stringify({ id, method, params, ...(sessionId ? { sessionId } : {}) }));+ });+ }+ return {+ name: 'chromium',+ /** One isolated browser context: its own cookies, storage and IndexedDB. */+ async newContext() {+ const { browserContextId } = await send('Target.createBrowserContext', { disposeOnDetach: false });+ // The hosted page reads this computer's loopback addresses, which Chrome gates behind a local-network permission+ // a person grants once; versions name it differently.+ for (const permissions of [['loopbackNetwork', 'localNetwork', 'localNetworkAccess'], ['localNetworkAccess'], ['localNetwork']]) {+ try { await send('Browser.grantPermissions', { origin: 'https://app.pullboard.dev', permissions, browserContextId }); break; }+ catch { /* Try the next name this Chrome version knows. */ }+ }+ return {+ /**+ * Open a page in this context with every request routed by `route`.+ *+ * @param {{ route: (request: { url: string, method: string, headers: object }) => Promise<object>, phone?: boolean, bootstrap?: string }} options+ */+ async newPage({ route, phone = false, bootstrap = '' }) {+ const { targetId } = await send('Target.createTarget', { url: 'about:blank', browserContextId });+ const { sessionId } = await send('Target.attachToTarget', { targetId, flatten: true });+ const exceptions = [];+ sessions.set(sessionId, (message) => {+ if (message.method === 'Runtime.exceptionThrown') exceptions.push(message.params.exceptionDetails?.exception?.description ?? message.params.exceptionDetails?.text ?? 'exception');+ if (message.method !== 'Fetch.requestPaused') return;+ const { requestId, request } = message.params;+ void (async () => {+ const answer = await route({ url: request.url, method: request.method, headers: request.headers });+ if (answer.kind === 'continue') {+ await send('Fetch.continueRequest', { requestId, url: answer.url,+ headers: Object.entries(answer.headers).map(([name, value]) => ({ name, value })) }, sessionId);+ } else if (answer.kind === 'fulfill') {+ await send('Fetch.fulfillRequest', { requestId, responseCode: answer.status,+ responseHeaders: Object.entries(answer.headers).map(([name, value]) => ({ name, value })),+ body: Buffer.from(answer.body).toString('base64') }, sessionId);+ } else await send('Fetch.failRequest', { requestId, errorReason: 'ConnectionRefused' }, sessionId);+ })().catch(() => send('Fetch.failRequest', { requestId, errorReason: 'Failed' }, sessionId).catch(() => {}));+ });+ await send('Runtime.enable', {}, sessionId);+ await send('Page.enable', {}, sessionId);+ await send('Fetch.enable', { patterns: [{ urlPattern: '*', requestStage: 'Request' }] }, sessionId);+ if (phone) {+ await send('Emulation.setDeviceMetricsOverride', { width: 390, height: 844, deviceScaleFactor: 2, mobile: true }, sessionId);+ await send('Emulation.setTouchEmulationEnabled', { enabled: true, maxTouchPoints: 5 }, sessionId);+ }+ if (bootstrap) await send('Page.addScriptToEvaluateOnNewDocument', { source: bootstrap }, sessionId);+ /** Evaluate a synchronous expression and return its JSON value. */+ const evaluate = async (expression) => {+ const result = await send('Runtime.evaluate', { expression: `JSON.stringify((() => (${expression}))())`, returnByValue: true }, sessionId);+ if (result.exceptionDetails) throw new Error(result.exceptionDetails.exception?.description ?? 'page threw');+ return result.result?.value === undefined ? undefined : JSON.parse(result.result.value);+ };+ return {+ ...pageApi(evaluate),+ exceptions,+ navigate: (url) => send('Page.navigate', { url }, sessionId),+ async close() {+ sessions.delete(sessionId);+ await send('Target.closeTarget', { targetId }).catch(() => {});+ },+ };+ },+ close: () => send('Target.disposeBrowserContext', { browserContextId }).catch(() => {}),+ };+ },+ async close() {+ try { socket.close(); } catch { /* The socket already closed. */ }+ await chrome.close();+ },+ };+}++/** How long an event stream answered whole stays open before it is cut. */+const STREAM_CUT_MS = 1_500;++/**+ * Fetch a continued request in full for WebKit, keeping its method, headers and body.+ *+ * @param {string} url+ * @param {{ method: string, headers: object, postData?: string }} request+ */+async function answerWhole(url, request) {+ const headers = Object.fromEntries(Object.entries(request.headers).filter(([name]) => !['host', 'content-length', 'cookie'].includes(name.toLowerCase())));+ const stream = /event-stream/iu.test(headers.accept ?? headers.Accept ?? '');+ const controller = new AbortController();+ const response = await fetch(url, { method: request.method, headers, redirect: 'manual', signal: controller.signal,+ ...(request.postData === undefined ? {} : { body: Buffer.from(request.postData, 'base64') }) });+ const chunks = [];+ if (stream) {+ const reader = response.body.getReader();+ const cut = setTimeout(() => controller.abort(), STREAM_CUT_MS); // budget: how long one stream answer lasts before the page reconnects.+ try { for (let part = await reader.read(); !part.done; part = await reader.read()) chunks.push(Buffer.from(part.value)); }+ catch { /* The cut ends the stream. */ }+ finally { clearTimeout(cut); }+ } else chunks.push(Buffer.from(await response.arrayBuffer()));+ const answer = Object.fromEntries([...response.headers].filter(([name]) => !['content-length', 'content-encoding', 'connection', 'transfer-encoding', 'keep-alive', 'date'].includes(name)));+ return { kind: 'fulfill', status: response.status, headers: answer, body: Buffer.concat(chunks) };+}++/**+ * Open WebKit; each context is a Playwright browser context with its own storage.+ *+ * @returns {Promise<{ name: 'webkit', newContext: () => Promise<object>, close: () => Promise<void> }>}+ */+async function openWebkit() {+ const webkit = await startWebkit({ commandTimeoutMs: COMMAND_MS });+ return {+ name: 'webkit',+ /** One isolated browser context. WebKit makes contexts per page, so the first page creates it and later pages reuse its storage through a shared page. */+ async newContext() {+ const pages = [];+ let contextId = null;+ return {+ /**+ * Open a page in this context with every request routed by `route`.+ *+ * @param {{ route: (request: { url: string, method: string, headers: object }) => Promise<object>, phone?: boolean, bootstrap?: string }} options+ */+ async newPage({ route, phone = false, bootstrap = '' }) {+ const page = await webkit.newPage({ phone, context: contextId,+ prepare: async (target) => {+ await target('Network.enable');+ await target('Page.enable').catch(() => {});+ await target('Runtime.enable').catch(() => {});+ await target('Page.setTouchEmulationEnabled', { enabled: phone }).catch(() => {});+ if (bootstrap) await target('Page.setBootstrapScript', { source: bootstrap });+ await target('Network.setInterceptionEnabled', { enabled: true });+ await target('Network.addInterception', { url: '', stage: 'request' });+ },+ onMessage: (message, target) => {+ if (message.method !== 'Network.requestIntercepted') return;+ const { requestId, request } = message.params;+ void (async () => {+ let answer = await route({ url: request.url, method: request.method, headers: request.headers });+ // WebKit treats a rewritten URL as a cross-origin redirect, which a preflighted read may not follow, so a+ // continued request is answered whole here instead; an event stream is cut after a moment, and the page+ // reconnects as it would after any dropped stream.+ if (answer.kind === 'continue') answer = await answerWhole(answer.url, request);+ if (answer.kind === 'fulfill') {+ await target('Network.interceptRequestWithResponse', { requestId, content: Buffer.from(answer.body).toString('base64'), base64Encoded: true,+ mimeType: answer.headers['content-type']?.split(';')[0] ?? 'application/octet-stream', status: answer.status, statusText: 'OK', headers: answer.headers });+ } else if (answer.kind === 'fail') await target('Network.interceptRequestWithError', { requestId, errorType: 'General' });+ })().catch(() => target('Network.interceptRequestWithError', { requestId, errorType: 'General' }).catch(() => {}));+ } });+ contextId ??= page.browserContextId;+ pages.push(page);+ return {+ ...pageApi(page.evaluate),+ exceptions: page.exceptions,+ navigate: (url) => page.navigate(url),+ close: () => page.close({ keepContext: true }),+ };+ },+ async close() {+ for (const page of pages) await page.close().catch(() => {});+ if (contextId) await webkit.deleteContext(contextId).catch(() => {});+ },+ };+ },+ close: () => webkit.close(),+ };+}++/**+ * Open one engine by name.+ *+ * @param {'chromium' | 'webkit'} name+ */+export function openEngine(name) {+ return name === 'webkit' ? openWebkit() : openChromium();+}diff --git a/test/hosted-shapes-fixture.js b/test/hosted-shapes-fixture.jsnew file mode 100644index 00000000..c04cd457--- /dev/null+++ b/test/hosted-shapes-fixture.js@@ -0,0 +1,400 @@+/**+ * The hosted-shapes matrix [H5,H17,N26]: every way a person can open a board through pullboard.dev, built with the+ * real CLI, a real local relay, a real `pullboard view` and real browsers. This module owns the cells, the screen each+ * cell must reach, the board states (each a real relay account), the browsers' stored states, and the reader that+ * says what a page shows. test/hosted-shapes.test.js runs it.+ */+import assert from 'node:assert/strict';+import {+ existsSync,+ mkdirSync,+ readFileSync,+} from 'node:fs';+import { createServer } from 'node:http';+import { request } from 'node:http';+import {+ dirname,+ join,+} from 'node:path';+import { randomUUID } from 'node:crypto';+import { runFixtureGit } from './fixture-child.js';+import { startView } from './cockpit/fixture.js';++/** The hosted page's real origin; every browser request to it is routed to the owned relay. */+export const HOSTED = 'https://app.pullboard.dev';+/** Where the hosted page looks for this computer's own view. */+export const LOCAL = 'http://127.0.0.1:4890';+/** The bar every cell is held to: the board within this long, or its blocker named. */+export const BOARD_MS = 3_000;+/** How long a blocker screen may take to settle before the matrix reads it: a hang ceiling, not a speed claim. */+const SETTLE_MS = 8_000;++export const WHERE = ['board-view', 'board-no-view', 'other-computer', 'phone'];+export const ACCOUNT = ['signed-out', 'signed-in'];+export const BROWSER = ['paired', 'unpaired', 'revoked'];+export const BOARDS = ['none', 'excluded', 'healthy', 'oversize', 'approval', 'mixed'];+export const STORED = ['fresh', 'stale-pairing', 'stale-key'];++/** The board item every linked fixture board carries, so a shown board is the board itself, not a row label. */+export const BOARD_ITEM = 'private cleanup fixture item';++/** Words for each place, browser and board state, used in the header and in failure messages. */+const WORDS = {+ 'board-view': 'the computer with the boards, its view running',+ 'board-no-view': 'the computer with the boards, no view running',+ 'other-computer': 'another computer',+ phone: 'a phone',+ none: 'no board linked',+ excluded: 'its board excluded from relay on --all',+ healthy: 'one linked, healthy board',+ oversize: 'one linked board over the relay size limit',+ approval: 'one healthy board and one waiting for a phone approval',+ mixed: 'a healthy board, one over the size limit and one excluded',+};++/**+ * Every cell of the matrix, in a fixed order: where x account x browser x boards x stored.+ *+ * @returns {{ id: string, where: string, account: string, browser: string, boards: string, stored: string }[]}+ */+export function cells() {+ const out = [];+ for (const boards of BOARDS) for (const where of WHERE) for (const account of ACCOUNT) for (const browser of BROWSER) for (const stored of STORED) {+ out.push({ id: [where, account, browser, boards, stored].join('/'), where, account, browser, boards, stored });+ }+ return out;+}++/**+ * Why a cell cannot exist with real moves, or null when it can. Such a cell still runs, as the nearest state that+ * does exist (`runsAs`), and its landing screen is still checked.+ *+ * @param {{ browser: string, boards: string }} cell+ * @returns {{ reason: string, runsAs: { browser: string } } | null}+ */+export function impossibility(cell) {+ if (!['none', 'excluded'].includes(cell.boards)) return null;+ if (cell.browser === 'paired') return { reason: 'pairing hands a browser the key of a linked board; with no board linked there is no key to hold', runsAs: { browser: 'unpaired' } };+ if (cell.browser === 'revoked') return { reason: 'only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board', runsAs: { browser: 'unpaired' } };+ return null;+}++/** The setup steps the person has already taken in each board state, which no screen may offer again as the fix. */+export function stepsTaken(boards) {+ return boards === 'none' ? [] : ['pullboard relay on --all'];+}++/**+ * The screen a cell must reach. `board` means the board itself within BOARD_MS; otherwise `blocker` names what stands+ * in the way, `words` must appear on screen, and `step` says whether a command or control that clears it must show.+ *+ * @param {{ where: string, account: string, browser: string, boards: string, stored: string }} cell+ * @returns {{ board: boolean, blocker: string | null, words: RegExp | null, also: string | null }}+ */+export function expected(cell) {+ const browser = impossibility(cell)?.runsAs.browser ?? cell.browser;+ // The computer with the boards opens them from its own running view, whatever the relay holds.+ if (cell.where === 'board-view') return { board: true, blocker: null, words: null, also: null };+ if (cell.account === 'signed-out') return { board: false, blocker: 'sign-in', words: /sign in/iu, also: null };+ if (browser === 'revoked') return { board: false, blocker: 'removed', words: /removed/iu, also: null };+ if (cell.boards === 'none') return { board: false, blocker: 'not-linked', words: /no linked boards|one step/iu, also: null };+ if (cell.boards === 'excluded') return { board: false, blocker: 'excluded', words: /excluded|skipped/iu, also: null };+ if (browser === 'unpaired') return { board: false, blocker: 'unpaired', words: /not paired|pair this browser/iu, also: null };+ if (cell.stored === 'stale-key') return { board: false, blocker: 'stale-key', words: /saved key/iu, also: null };+ if (cell.boards === 'oversize') return { board: false, blocker: 'too-big', words: /size|too (?:big|large)|\bMB\b/iu, also: null };+ if (cell.boards === 'approval') return { board: true, blocker: null, words: null, also: 'approval' };+ if (cell.boards === 'mixed') return { board: true, blocker: null, words: null, also: 'too-big' };+ return { board: true, blocker: null, words: null, also: null };+}++/** One header line for a cell: its id and the screen it must reach. */+export function headerLine(cell) {+ const want = expected(cell);+ const screen = want.board ? `the board within ${BOARD_MS / 1000} s${want.also ? `, and names ${want.also}` : ''}` : `names ${want.blocker} and the one step that clears it`;+ const impossible = impossibility(cell);+ return ` * ${cell.id}: ${screen}${impossible ? ` (cannot exist: ${impossible.reason}; runs as ${impossible.runsAs.browser})` : ''}`;+}++/** Describe a board state in words. */+export function boardWords(boards) { return WORDS[boards]; }++/**+ * Sign a separate person session in through the stand-in's real OAuth, so each browser identity has its own.+ *+ * @param {{ origin: string }} box+ * @returns {Promise<string>} the pb_session token+ */+export async function freshSession(box) {+ const start = await fetch(box.origin + '/auth/github/start', { redirect: 'manual' });+ const binding = start.headers.getSetCookie().find((value) => value.startsWith('pb_oauth_binding=')).split(';')[0];+ const approved = await fetch(start.headers.get('location'), { redirect: 'manual' });+ const callback = await fetch(approved.headers.get('location'), { redirect: 'manual', headers: { cookie: binding } });+ assert.equal(callback.status, 303, 'the stand-in GitHub sign-in completes');+ return callback.headers.getSetCookie().find((value) => value.startsWith('pb_session=')).split(';')[0].slice('pb_session='.length);+}++/**+ * The owned front for one relay: it answers every hosted request a browser makes, as pullboard.dev does, with the+ * session of the cell that asked. A route sends a request here as /__cell/<id>/<path>; the front forwards it to the+ * relay with that cell's cookie, and answers for the hosted origin, like the production edge.+ *+ * @param {string} relayOrigin+ */+export async function hostedFront(relayOrigin) {+ const sessions = new Map();+ const server = createServer((req, res) => {+ const match = /^\/__cell\/([^/]+)(\/.*)$/u.exec(req.url ?? '');+ if (!match) { res.writeHead(404); return res.end(); }+ const session = sessions.get(match[1]);+ if (req.method === 'OPTIONS') {+ res.writeHead(204, { 'access-control-allow-origin': HOSTED, 'access-control-allow-credentials': 'true',+ 'access-control-allow-methods': 'GET, POST, PUT, DELETE, OPTIONS', 'access-control-allow-headers': req.headers['access-control-request-headers'] || 'content-type', vary: 'Origin' });+ return res.end();+ }+ const headers = Object.fromEntries(Object.entries(req.headers).filter(([name]) => !['host', 'connection', 'content-length', 'cookie'].includes(name.toLowerCase())));+ headers.origin = relayOrigin;+ if (session) headers.cookie = 'pb_session=' + session;+ const upstream = request(new URL(match[2], relayOrigin), { method: req.method, headers, agent: false }, (reply) => {+ const answer = Object.fromEntries(Object.entries(reply.headers).filter(([name]) => !['connection', 'transfer-encoding', 'keep-alive',+ 'access-control-allow-origin', 'access-control-allow-credentials', 'set-cookie'].includes(name.toLowerCase())));+ answer['access-control-allow-origin'] = HOSTED;+ answer['access-control-allow-credentials'] = 'true';+ res.writeHead(reply.statusCode || 502, answer);+ reply.pipe(res);+ });+ res.once('close', () => upstream.destroy());+ upstream.once('error', () => { if (!res.headersSent) res.writeHead(502); res.end(); });+ req.pipe(upstream);+ });+ await new Promise((ready, failed) => { server.once('error', failed); server.listen(0, '127.0.0.1', ready); });+ const base = 'http://127.0.0.1:' + server.address().port;+ return {+ /** Register one page's session (or none) and return its route. */+ route(session, viewBase) {+ const id = randomUUID();+ if (session) sessions.set(id, session);+ return async ({ url, headers }) => {+ const address = new URL(url);+ const owned = `${base}/__cell/${id}${address.pathname}${address.search}`;+ // API reads go on live, so event streams keep streaming; the page and its scripts are answered whole, as from+ // the hosted origin itself, since a browser loads a module only from its own origin.+ if (address.origin === HOSTED && address.pathname.startsWith('/api/')) return { kind: 'continue', url: owned, headers };+ if (address.origin === HOSTED) {+ const response = await fetch(owned, { headers: Object.fromEntries(Object.entries(headers).filter(([name]) => !['host', 'cookie'].includes(name.toLowerCase()))), redirect: 'manual' });+ const answer = Object.fromEntries([...response.headers].filter(([name]) => !['content-length', 'content-encoding', 'connection', 'transfer-encoding', 'keep-alive', 'date'].includes(name)));+ // The real view answers on 4890; this one has its own port, which it tells the page after connecting, so+ // the page may also reach that port, exactly as it may reach 4890.+ if (viewBase && answer['content-security-policy']) answer['content-security-policy'] = answer['content-security-policy'].replace(LOCAL, `${LOCAL} ${viewBase}`);+ return { kind: 'fulfill', status: response.status, headers: answer, body: Buffer.from(await response.arrayBuffer()) };+ }+ if (address.origin === LOCAL && viewBase) return { kind: 'continue', url: viewBase + address.pathname + address.search, headers };+ if (viewBase && address.origin === new URL(viewBase).origin) return { kind: 'continue', url, headers };+ // A view that is not running refuses the connection; nothing else is on the network.+ return { kind: 'fail' };+ };+ },+ async close() {+ server.closeAllConnections();+ await new Promise((done) => server.close(done));+ },+ };+}++/**+ * The page script that puts a browser's stored state in place before the page runs: a stale pairing link left from+ * an earlier visit, or a saved board key that no longer opens the board.+ *+ * @param {string} stored+ * @param {{ keys?: Record<string, string>, boards?: string[] }} known - the identity's own saved keys, and the listed board ids+ */+export function storedScript(stored, { keys = null, boards = [] } = {}) {+ const lines = [];+ if (keys) lines.push(`localStorage.setItem('pullboard.relay.keys.v1', ${JSON.stringify(JSON.stringify(keys))});`);+ if (stored === 'stale-pairing') {+ lines.push(`sessionStorage.setItem('pullboard.relay.device-pair.v1', ${JSON.stringify(JSON.stringify({ code: 'A'.repeat(22) + '.' + 'B'.repeat(43), expires: 1 }))});`);+ }+ if (stored === 'stale-key') {+ const stale = Object.fromEntries(boards.map((board) => [board, 'A'.repeat(43)]));+ lines.push(`localStorage.setItem('pullboard.relay.keys.v1', ${JSON.stringify(JSON.stringify(stale))});`);+ }+ // Only the first document of a visit sets storage, so the page's own later writes stand.+ return lines.length ? `if (!sessionStorage.getItem('__shapes')) { sessionStorage.setItem('__shapes', '1'); ${lines.join(' ')} }` : '';+}++/**+ * What the page shows a person now: whether the board is drawn, and the words and commands on every visible screen+ * part. It reads only what is visible, so a screen hidden under another never counts.+ */+export const READ_SCREEN = `(() => {+ const seen = (node) => { if (!node) return false; const rect = node.getBoundingClientRect(); const style = getComputedStyle(node);+ return rect.width > 0 && rect.height > 0 && style.visibility !== 'hidden' && style.display !== 'none'; };+ const text = (node) => seen(node) ? (node.innerText || '').replace(/\\s+/g, ' ').trim() : '';+ const parts = ['#relay-screen', '#local-note', '#relay-notice', '#relay-removed', '#phone-approvals', '.first'].map((sel) => text(document.querySelector(sel))).filter(Boolean);+ const commands = [...document.querySelectorAll('code')].filter(seen).map((node) => node.textContent.replace(/^\\$\\s*/, '').trim()).filter((value) => value.startsWith('pullboard '));+ const signIn = [...document.querySelectorAll('a, button')].some((node) => seen(node) && /sign in with github/i.test(node.textContent));+ const chain = document.querySelector('#chain');+ return { board: seen(chain) && chain.textContent.includes(${JSON.stringify(BOARD_ITEM)}),+ approval: [...document.querySelectorAll('.phone-approval button')].some(seen),+ screen: document.documentElement.dataset.relayScreen || '', note: document.querySelector('#local-note')?.dataset.state || '',+ words: parts.join(' | ').slice(0, 1500), commands: [...new Set(commands)], signIn };+})()`;++/**+ * Judge what a page showed against the cell's screen. Returns null when it holds, else the reason it does not.+ *+ * @param {object} cell+ * @param {{ board: boolean, approval: boolean, words: string, commands: string[], signIn: boolean, ms: number }} seen+ * @param {string[]} [ineffective] - commands this run executed and found not to clear the cell's blocker+ */+export function judge(cell, seen, ineffective = []) {+ const want = expected(cell);+ const taken = stepsTaken(cell.boards);+ const repeated = seen.commands.filter((command) => taken.includes(command));+ const useless = seen.commands.filter((command) => ineffective.includes(command));+ if (want.board) {+ if (!seen.board) return `the board did not show within ${BOARD_MS} ms`;+ if (seen.ms > BOARD_MS) return `the board took ${seen.ms} ms`;+ if (want.also === 'approval' && !seen.approval && !/waiting for (?:a |your )?phone|approv/iu.test(seen.words)) return 'the board showed, but not the board waiting for a phone approval';+ if (want.also === 'too-big' && !/size|too (?:big|large)|\bMB\b/iu.test(seen.words)) return 'the board showed, but the board over the size limit is not named';+ return null;+ }+ if (seen.board) return `showed the board, but ${want.blocker} should stop it`;+ if (!want.words.test(seen.words)) return `does not name ${want.blocker}`;+ if (repeated.length) return `offers ${repeated.join(', ')}, a step already taken`;+ if (useless.length && useless.length === seen.commands.length) return `offers ${useless.join(', ')}, which was run and did not clear it`;+ if (want.blocker === 'sign-in' ? !seen.signIn : !seen.commands.length && !/sign in|pairing link/iu.test(seen.words)) return `names ${want.blocker} but no step that clears it`;+ return null;+}++/**+ * Open one cell's page, wait for its screen and read it.+ *+ * @param {{ newPage: Function }} context - the identity's browser context+ * @param {object} options - route, phone, bootstrap+ * @param {boolean} wantsBoard - wait for the board rather than a settled blocker+ */+export async function visit(context, { route, phone, bootstrap }, wantsBoard) {+ const page = await context.newPage({ route, phone, bootstrap });+ try {+ const started = Date.now();+ await page.navigate(HOSTED + '/');+ if (wantsBoard) {+ const shown = await page.poll(`(${READ_SCREEN}).board`, BOARD_MS + 2_000);+ const seen = await page.evaluate(READ_SCREEN);+ return { ...seen, ms: shown ? Date.now() - started : null, exceptions: page.exceptions.length };+ }+ // A blocker screen settles when it has stopped changing for half a second and is not still checking.+ let last = '';+ let since = Date.now();+ let seen = null;+ while (Date.now() - started < SETTLE_MS) {+ try { seen = await page.evaluate(READ_SCREEN); } catch { seen = null; }+ const key = JSON.stringify(seen);+ if (key !== last) { last = key; since = Date.now(); }+ // A blank page has not settled: a person cannot act on nothing, so it is read again until the ceiling.+ else if (Date.now() - since >= 500 && seen && (seen.board || seen.words || seen.signIn) && !/checking|finding your boards|connecting/iu.test(seen.words)) break;+ await new Promise((later) => setTimeout(later, 50)); // budget: poll interval while the screen settles, no speed claim.+ }+ return { ...(seen ?? { board: false, approval: false, words: '', commands: [], signIn: false }), ms: Date.now() - started, exceptions: page.exceptions.length };+ } finally { await page.close(); }+}++/**+ * Make another real project on the same computer, as a person would: a clone with an origin, then pullboard init.+ *+ * @param {object} box - the relay fixture+ * @param {string} name+ * @param {string} repository - owner/name on the stand-in GitHub+ */+export async function siblingProject(box, name, repository) {+ const root = join(dirname(box.root), name);+ mkdirSync(root);+ for (const args of [['init', '-q', '-b', 'main'], ['-c', 'commit.gpgsign=false', 'commit', '--allow-empty', '-q', '-m', 'fixture base'],+ ['remote', 'add', 'origin', `[email protected]:${repository}.git`]]) runFixtureGit(args, { cwd: root, env: box.env, encoding: 'utf8' });+ // The stand-in GitHub grants access by repository name, as the approval fixtures do.+ const granted = repository.split('/').at(-1);+ if (!box.providerState.repositories.includes(granted)) box.providerState.repositories.push(granted);+ assert.equal((await box.cliAt(root, 'init')).code, 0, `${name} initializes`);+ return root;+}++/**+ * Run the real foreground relay on --all and, when it offers a first-device pairing, pair the given browser page+ * through it: the same link a person opens from the terminal.+ *+ * @param {object} box+ * @param {(link: string) => Promise<void>} [openLink] - opens the printed pairing link in a browser+ * @returns {Promise<object>} the command's JSON result+ */+export async function relayOnAll(box, openLink) {+ const machineFile = join(box.env.PULLBOARD_HOME, 'relay-machine/state.json');+ // A pairing an earlier run left behind is not this run's; only a new locator is.+ const earlier = existsSync(machineFile) ? JSON.parse(readFileSync(machineFile, 'utf8')).pending?.locator ?? null : null;+ const run = box.startCli(['relay', 'on', '--all', '--url', box.origin]);+ if (openLink) {+ const end = Date.now() + 60_000;+ let pending = null;+ while (!pending && Date.now() < end) {+ if (run.child.exitCode !== null) break;+ if (existsSync(machineFile)) {+ const offered = JSON.parse(readFileSync(machineFile, 'utf8')).pending;+ if (offered && offered.locator !== earlier) pending = offered;+ }+ if (!pending) await new Promise((later) => setTimeout(later, 50)); // budget: poll interval for the published pairing, under a 60 s hang ceiling.+ }+ assert.ok(pending, 'relay on --all offers this browser its pairing link');+ await openLink(`${HOSTED}/#device=${pending.locator}.${pending.secret}`);+ }+ const result = await run.closed;+ assert.equal(result.code, 0, `relay on --all completes: ${result.stderr.slice(-400)} ${result.stdout.slice(-600)}`);+ return JSON.parse(result.stdout);+}++/**+ * Revoke one enrolled browser the way a person does: pullboard relay revoke, through a fresh provider sign-in.+ *+ * @param {object} box+ * @param {string} deviceId+ */+export async function revokeDevice(box, deviceId) {+ const authorized = box.providerState.deviceAuthorized;+ box.providerState.deviceAuthorized = false;+ try {+ const revoke = box.startCli(['relay', 'revoke', deviceId]);+ await revoke.waitForOutput('Sign in with GitHub: open ');+ box.providerState.deviceAuthorized = true;+ const result = await revoke.closed;+ assert.equal(result.code, 0, 'relay revoke completes');+ } finally { box.providerState.deviceAuthorized = authorized; }+}++/** The devices this computer has enrolled. */+export function enrolledDevices(box) {+ return JSON.parse(readFileSync(join(box.env.PULLBOARD_HOME, 'relay-machine/state.json'), 'utf8')).devices.map((device) => device.deviceId);+}++/** Start this computer's real view, the one the hosted page finds on 127.0.0.1:4890. */+export function boardView(box) {+ return startView({ dir: box.root, env: box.env });+}++/**+ * Run the step an unpaired browser is offered, `pullboard relay pair`, and open the link it prints in a fresh signed-in+ * browser, as the page tells the person to: true when the board then opens, so the step really clears the blocker.+ *+ * @param {object} box+ * @param {{ newContext: Function }} engine+ * @param {object} front+ * @param {string} session+ */+export async function relayPairClears(box, engine, front, session) {+ const result = await box.cli('relay', 'pair');+ assert.equal(result.code, 0, 'relay pair prints its pairing link');+ const printed = new URL(result.document.link);+ const context = await engine.newContext();+ try {+ const page = await context.newPage({ route: front.route(session, null) });+ await page.navigate(HOSTED + '/' + printed.hash);+ return Boolean(await page.poll(`(${READ_SCREEN}).board`, 8_000));+ } finally { await context.close(); }+}diff --git a/test/hosted-shapes.test.js b/test/hosted-shapes.test.jsnew file mode 100644index 00000000..8ca8634b--- /dev/null+++ b/test/hosted-shapes.test.js@@ -0,0 +1,696 @@+/**+ * Every shape of opening a board through pullboard.dev, in real Chromium and real WebKit [H5,H17,N26].+ *+ * Each cell is one of: where the browser is (the computer with the boards, its view running or not; another+ * computer; a phone) x the account (signed out, signed in) x this browser (paired, not paired, revoked) x the+ * boards (none linked, excluded, healthy, over the size limit, waiting for a phone approval, mixed) x what the+ * browser has stored (fresh, a stale pairing link, a stale board key). Each runs with the real CLI, a real local+ * relay, a real `pullboard view` and real browsers, and must show the board within 3 s, or name its exact blocker+ * and the one step that clears it, never a step the person already took. A cell that fails is a filed defect,+ * listed in KNOWN_DEFECTS with its item; the matrix fails on any other failing cell, and on a listed cell that now+ * passes, so the list stays true. Every cell and the screen it must reach:+ *+ * CELLS-START+ * board-view/signed-out/paired/none/fresh: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-out/paired/none/stale-pairing: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-out/paired/none/stale-key: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-out/unpaired/none/fresh: the board within 3 s+ * board-view/signed-out/unpaired/none/stale-pairing: the board within 3 s+ * board-view/signed-out/unpaired/none/stale-key: the board within 3 s+ * board-view/signed-out/revoked/none/fresh: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-out/revoked/none/stale-pairing: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-out/revoked/none/stale-key: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-in/paired/none/fresh: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-in/paired/none/stale-pairing: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-in/paired/none/stale-key: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-in/unpaired/none/fresh: the board within 3 s+ * board-view/signed-in/unpaired/none/stale-pairing: the board within 3 s+ * board-view/signed-in/unpaired/none/stale-key: the board within 3 s+ * board-view/signed-in/revoked/none/fresh: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-in/revoked/none/stale-pairing: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-in/revoked/none/stale-key: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-out/paired/none/fresh: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-out/paired/none/stale-pairing: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-out/paired/none/stale-key: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-out/unpaired/none/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/none/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/none/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/none/fresh: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-out/revoked/none/stale-pairing: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-out/revoked/none/stale-key: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-in/paired/none/fresh: names not-linked and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-in/paired/none/stale-pairing: names not-linked and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-in/paired/none/stale-key: names not-linked and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-in/unpaired/none/fresh: names not-linked and the one step that clears it+ * board-no-view/signed-in/unpaired/none/stale-pairing: names not-linked and the one step that clears it+ * board-no-view/signed-in/unpaired/none/stale-key: names not-linked and the one step that clears it+ * board-no-view/signed-in/revoked/none/fresh: names not-linked and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-in/revoked/none/stale-pairing: names not-linked and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-in/revoked/none/stale-key: names not-linked and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-out/paired/none/fresh: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-out/paired/none/stale-pairing: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-out/paired/none/stale-key: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-out/unpaired/none/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/none/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/none/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/none/fresh: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-out/revoked/none/stale-pairing: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-out/revoked/none/stale-key: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-in/paired/none/fresh: names not-linked and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-in/paired/none/stale-pairing: names not-linked and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-in/paired/none/stale-key: names not-linked and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-in/unpaired/none/fresh: names not-linked and the one step that clears it+ * other-computer/signed-in/unpaired/none/stale-pairing: names not-linked and the one step that clears it+ * other-computer/signed-in/unpaired/none/stale-key: names not-linked and the one step that clears it+ * other-computer/signed-in/revoked/none/fresh: names not-linked and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-in/revoked/none/stale-pairing: names not-linked and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-in/revoked/none/stale-key: names not-linked and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-out/paired/none/fresh: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-out/paired/none/stale-pairing: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-out/paired/none/stale-key: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-out/unpaired/none/fresh: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/none/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/none/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/revoked/none/fresh: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-out/revoked/none/stale-pairing: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-out/revoked/none/stale-key: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-in/paired/none/fresh: names not-linked and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-in/paired/none/stale-pairing: names not-linked and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-in/paired/none/stale-key: names not-linked and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-in/unpaired/none/fresh: names not-linked and the one step that clears it+ * phone/signed-in/unpaired/none/stale-pairing: names not-linked and the one step that clears it+ * phone/signed-in/unpaired/none/stale-key: names not-linked and the one step that clears it+ * phone/signed-in/revoked/none/fresh: names not-linked and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-in/revoked/none/stale-pairing: names not-linked and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-in/revoked/none/stale-key: names not-linked and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-out/paired/excluded/fresh: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-out/paired/excluded/stale-pairing: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-out/paired/excluded/stale-key: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-out/unpaired/excluded/fresh: the board within 3 s+ * board-view/signed-out/unpaired/excluded/stale-pairing: the board within 3 s+ * board-view/signed-out/unpaired/excluded/stale-key: the board within 3 s+ * board-view/signed-out/revoked/excluded/fresh: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-out/revoked/excluded/stale-pairing: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-out/revoked/excluded/stale-key: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-in/paired/excluded/fresh: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-in/paired/excluded/stale-pairing: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-in/paired/excluded/stale-key: the board within 3 s (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-view/signed-in/unpaired/excluded/fresh: the board within 3 s+ * board-view/signed-in/unpaired/excluded/stale-pairing: the board within 3 s+ * board-view/signed-in/unpaired/excluded/stale-key: the board within 3 s+ * board-view/signed-in/revoked/excluded/fresh: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-in/revoked/excluded/stale-pairing: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-in/revoked/excluded/stale-key: the board within 3 s (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-out/paired/excluded/fresh: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-out/paired/excluded/stale-pairing: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-out/paired/excluded/stale-key: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-out/unpaired/excluded/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/excluded/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/excluded/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/excluded/fresh: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-out/revoked/excluded/stale-pairing: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-out/revoked/excluded/stale-key: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-in/paired/excluded/fresh: names excluded and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-in/paired/excluded/stale-pairing: names excluded and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-in/paired/excluded/stale-key: names excluded and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * board-no-view/signed-in/unpaired/excluded/fresh: names excluded and the one step that clears it+ * board-no-view/signed-in/unpaired/excluded/stale-pairing: names excluded and the one step that clears it+ * board-no-view/signed-in/unpaired/excluded/stale-key: names excluded and the one step that clears it+ * board-no-view/signed-in/revoked/excluded/fresh: names excluded and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-in/revoked/excluded/stale-pairing: names excluded and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-no-view/signed-in/revoked/excluded/stale-key: names excluded and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-out/paired/excluded/fresh: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-out/paired/excluded/stale-pairing: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-out/paired/excluded/stale-key: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-out/unpaired/excluded/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/excluded/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/excluded/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/excluded/fresh: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-out/revoked/excluded/stale-pairing: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-out/revoked/excluded/stale-key: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-in/paired/excluded/fresh: names excluded and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-in/paired/excluded/stale-pairing: names excluded and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-in/paired/excluded/stale-key: names excluded and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * other-computer/signed-in/unpaired/excluded/fresh: names excluded and the one step that clears it+ * other-computer/signed-in/unpaired/excluded/stale-pairing: names excluded and the one step that clears it+ * other-computer/signed-in/unpaired/excluded/stale-key: names excluded and the one step that clears it+ * other-computer/signed-in/revoked/excluded/fresh: names excluded and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-in/revoked/excluded/stale-pairing: names excluded and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * other-computer/signed-in/revoked/excluded/stale-key: names excluded and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-out/paired/excluded/fresh: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-out/paired/excluded/stale-pairing: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-out/paired/excluded/stale-key: names sign-in and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-out/unpaired/excluded/fresh: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/excluded/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/excluded/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/revoked/excluded/fresh: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-out/revoked/excluded/stale-pairing: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-out/revoked/excluded/stale-key: names sign-in and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-in/paired/excluded/fresh: names excluded and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-in/paired/excluded/stale-pairing: names excluded and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-in/paired/excluded/stale-key: names excluded and the one step that clears it (cannot exist: pairing hands a browser the key of a linked board; with no board linked there is no key to hold; runs as unpaired)+ * phone/signed-in/unpaired/excluded/fresh: names excluded and the one step that clears it+ * phone/signed-in/unpaired/excluded/stale-pairing: names excluded and the one step that clears it+ * phone/signed-in/unpaired/excluded/stale-key: names excluded and the one step that clears it+ * phone/signed-in/revoked/excluded/fresh: names excluded and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-in/revoked/excluded/stale-pairing: names excluded and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * phone/signed-in/revoked/excluded/stale-key: names excluded and the one step that clears it (cannot exist: only an enrolled browser can be revoked, and relay on --all enrolls one only while it links a board; runs as unpaired)+ * board-view/signed-out/paired/healthy/fresh: the board within 3 s+ * board-view/signed-out/paired/healthy/stale-pairing: the board within 3 s+ * board-view/signed-out/paired/healthy/stale-key: the board within 3 s+ * board-view/signed-out/unpaired/healthy/fresh: the board within 3 s+ * board-view/signed-out/unpaired/healthy/stale-pairing: the board within 3 s+ * board-view/signed-out/unpaired/healthy/stale-key: the board within 3 s+ * board-view/signed-out/revoked/healthy/fresh: the board within 3 s+ * board-view/signed-out/revoked/healthy/stale-pairing: the board within 3 s+ * board-view/signed-out/revoked/healthy/stale-key: the board within 3 s+ * board-view/signed-in/paired/healthy/fresh: the board within 3 s+ * board-view/signed-in/paired/healthy/stale-pairing: the board within 3 s+ * board-view/signed-in/paired/healthy/stale-key: the board within 3 s+ * board-view/signed-in/unpaired/healthy/fresh: the board within 3 s+ * board-view/signed-in/unpaired/healthy/stale-pairing: the board within 3 s+ * board-view/signed-in/unpaired/healthy/stale-key: the board within 3 s+ * board-view/signed-in/revoked/healthy/fresh: the board within 3 s+ * board-view/signed-in/revoked/healthy/stale-pairing: the board within 3 s+ * board-view/signed-in/revoked/healthy/stale-key: the board within 3 s+ * board-no-view/signed-out/paired/healthy/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/paired/healthy/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/paired/healthy/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/healthy/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/healthy/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/healthy/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/healthy/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/healthy/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/healthy/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-in/paired/healthy/fresh: the board within 3 s+ * board-no-view/signed-in/paired/healthy/stale-pairing: the board within 3 s+ * board-no-view/signed-in/paired/healthy/stale-key: names stale-key and the one step that clears it+ * board-no-view/signed-in/unpaired/healthy/fresh: names unpaired and the one step that clears it+ * board-no-view/signed-in/unpaired/healthy/stale-pairing: names unpaired and the one step that clears it+ * board-no-view/signed-in/unpaired/healthy/stale-key: names unpaired and the one step that clears it+ * board-no-view/signed-in/revoked/healthy/fresh: names removed and the one step that clears it+ * board-no-view/signed-in/revoked/healthy/stale-pairing: names removed and the one step that clears it+ * board-no-view/signed-in/revoked/healthy/stale-key: names removed and the one step that clears it+ * other-computer/signed-out/paired/healthy/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/paired/healthy/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/paired/healthy/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/healthy/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/healthy/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/healthy/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/healthy/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/healthy/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/healthy/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-in/paired/healthy/fresh: the board within 3 s+ * other-computer/signed-in/paired/healthy/stale-pairing: the board within 3 s+ * other-computer/signed-in/paired/healthy/stale-key: names stale-key and the one step that clears it+ * other-computer/signed-in/unpaired/healthy/fresh: names unpaired and the one step that clears it+ * other-computer/signed-in/unpaired/healthy/stale-pairing: names unpaired and the one step that clears it+ * other-computer/signed-in/unpaired/healthy/stale-key: names unpaired and the one step that clears it+ * other-computer/signed-in/revoked/healthy/fresh: names removed and the one step that clears it+ * other-computer/signed-in/revoked/healthy/stale-pairing: names removed and the one step that clears it+ * other-computer/signed-in/revoked/healthy/stale-key: names removed and the one step that clears it+ * phone/signed-out/paired/healthy/fresh: names sign-in and the one step that clears it+ * phone/signed-out/paired/healthy/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/paired/healthy/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/healthy/fresh: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/healthy/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/healthy/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/revoked/healthy/fresh: names sign-in and the one step that clears it+ * phone/signed-out/revoked/healthy/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/revoked/healthy/stale-key: names sign-in and the one step that clears it+ * phone/signed-in/paired/healthy/fresh: the board within 3 s+ * phone/signed-in/paired/healthy/stale-pairing: the board within 3 s+ * phone/signed-in/paired/healthy/stale-key: names stale-key and the one step that clears it+ * phone/signed-in/unpaired/healthy/fresh: names unpaired and the one step that clears it+ * phone/signed-in/unpaired/healthy/stale-pairing: names unpaired and the one step that clears it+ * phone/signed-in/unpaired/healthy/stale-key: names unpaired and the one step that clears it+ * phone/signed-in/revoked/healthy/fresh: names removed and the one step that clears it+ * phone/signed-in/revoked/healthy/stale-pairing: names removed and the one step that clears it+ * phone/signed-in/revoked/healthy/stale-key: names removed and the one step that clears it+ * board-view/signed-out/paired/oversize/fresh: the board within 3 s+ * board-view/signed-out/paired/oversize/stale-pairing: the board within 3 s+ * board-view/signed-out/paired/oversize/stale-key: the board within 3 s+ * board-view/signed-out/unpaired/oversize/fresh: the board within 3 s+ * board-view/signed-out/unpaired/oversize/stale-pairing: the board within 3 s+ * board-view/signed-out/unpaired/oversize/stale-key: the board within 3 s+ * board-view/signed-out/revoked/oversize/fresh: the board within 3 s+ * board-view/signed-out/revoked/oversize/stale-pairing: the board within 3 s+ * board-view/signed-out/revoked/oversize/stale-key: the board within 3 s+ * board-view/signed-in/paired/oversize/fresh: the board within 3 s+ * board-view/signed-in/paired/oversize/stale-pairing: the board within 3 s+ * board-view/signed-in/paired/oversize/stale-key: the board within 3 s+ * board-view/signed-in/unpaired/oversize/fresh: the board within 3 s+ * board-view/signed-in/unpaired/oversize/stale-pairing: the board within 3 s+ * board-view/signed-in/unpaired/oversize/stale-key: the board within 3 s+ * board-view/signed-in/revoked/oversize/fresh: the board within 3 s+ * board-view/signed-in/revoked/oversize/stale-pairing: the board within 3 s+ * board-view/signed-in/revoked/oversize/stale-key: the board within 3 s+ * board-no-view/signed-out/paired/oversize/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/paired/oversize/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/paired/oversize/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/oversize/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/oversize/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/oversize/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/oversize/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/oversize/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/oversize/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-in/paired/oversize/fresh: names too-big and the one step that clears it+ * board-no-view/signed-in/paired/oversize/stale-pairing: names too-big and the one step that clears it+ * board-no-view/signed-in/paired/oversize/stale-key: names stale-key and the one step that clears it+ * board-no-view/signed-in/unpaired/oversize/fresh: names unpaired and the one step that clears it+ * board-no-view/signed-in/unpaired/oversize/stale-pairing: names unpaired and the one step that clears it+ * board-no-view/signed-in/unpaired/oversize/stale-key: names unpaired and the one step that clears it+ * board-no-view/signed-in/revoked/oversize/fresh: names removed and the one step that clears it+ * board-no-view/signed-in/revoked/oversize/stale-pairing: names removed and the one step that clears it+ * board-no-view/signed-in/revoked/oversize/stale-key: names removed and the one step that clears it+ * other-computer/signed-out/paired/oversize/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/paired/oversize/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/paired/oversize/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/oversize/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/oversize/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/oversize/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/oversize/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/oversize/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/oversize/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-in/paired/oversize/fresh: names too-big and the one step that clears it+ * other-computer/signed-in/paired/oversize/stale-pairing: names too-big and the one step that clears it+ * other-computer/signed-in/paired/oversize/stale-key: names stale-key and the one step that clears it+ * other-computer/signed-in/unpaired/oversize/fresh: names unpaired and the one step that clears it+ * other-computer/signed-in/unpaired/oversize/stale-pairing: names unpaired and the one step that clears it+ * other-computer/signed-in/unpaired/oversize/stale-key: names unpaired and the one step that clears it+ * other-computer/signed-in/revoked/oversize/fresh: names removed and the one step that clears it+ * other-computer/signed-in/revoked/oversize/stale-pairing: names removed and the one step that clears it+ * other-computer/signed-in/revoked/oversize/stale-key: names removed and the one step that clears it+ * phone/signed-out/paired/oversize/fresh: names sign-in and the one step that clears it+ * phone/signed-out/paired/oversize/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/paired/oversize/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/oversize/fresh: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/oversize/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/oversize/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/revoked/oversize/fresh: names sign-in and the one step that clears it+ * phone/signed-out/revoked/oversize/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/revoked/oversize/stale-key: names sign-in and the one step that clears it+ * phone/signed-in/paired/oversize/fresh: names too-big and the one step that clears it+ * phone/signed-in/paired/oversize/stale-pairing: names too-big and the one step that clears it+ * phone/signed-in/paired/oversize/stale-key: names stale-key and the one step that clears it+ * phone/signed-in/unpaired/oversize/fresh: names unpaired and the one step that clears it+ * phone/signed-in/unpaired/oversize/stale-pairing: names unpaired and the one step that clears it+ * phone/signed-in/unpaired/oversize/stale-key: names unpaired and the one step that clears it+ * phone/signed-in/revoked/oversize/fresh: names removed and the one step that clears it+ * phone/signed-in/revoked/oversize/stale-pairing: names removed and the one step that clears it+ * phone/signed-in/revoked/oversize/stale-key: names removed and the one step that clears it+ * board-view/signed-out/paired/approval/fresh: the board within 3 s+ * board-view/signed-out/paired/approval/stale-pairing: the board within 3 s+ * board-view/signed-out/paired/approval/stale-key: the board within 3 s+ * board-view/signed-out/unpaired/approval/fresh: the board within 3 s+ * board-view/signed-out/unpaired/approval/stale-pairing: the board within 3 s+ * board-view/signed-out/unpaired/approval/stale-key: the board within 3 s+ * board-view/signed-out/revoked/approval/fresh: the board within 3 s+ * board-view/signed-out/revoked/approval/stale-pairing: the board within 3 s+ * board-view/signed-out/revoked/approval/stale-key: the board within 3 s+ * board-view/signed-in/paired/approval/fresh: the board within 3 s+ * board-view/signed-in/paired/approval/stale-pairing: the board within 3 s+ * board-view/signed-in/paired/approval/stale-key: the board within 3 s+ * board-view/signed-in/unpaired/approval/fresh: the board within 3 s+ * board-view/signed-in/unpaired/approval/stale-pairing: the board within 3 s+ * board-view/signed-in/unpaired/approval/stale-key: the board within 3 s+ * board-view/signed-in/revoked/approval/fresh: the board within 3 s+ * board-view/signed-in/revoked/approval/stale-pairing: the board within 3 s+ * board-view/signed-in/revoked/approval/stale-key: the board within 3 s+ * board-no-view/signed-out/paired/approval/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/paired/approval/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/paired/approval/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/approval/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/approval/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/approval/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/approval/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/approval/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/approval/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-in/paired/approval/fresh: the board within 3 s, and names approval+ * board-no-view/signed-in/paired/approval/stale-pairing: the board within 3 s, and names approval+ * board-no-view/signed-in/paired/approval/stale-key: names stale-key and the one step that clears it+ * board-no-view/signed-in/unpaired/approval/fresh: names unpaired and the one step that clears it+ * board-no-view/signed-in/unpaired/approval/stale-pairing: names unpaired and the one step that clears it+ * board-no-view/signed-in/unpaired/approval/stale-key: names unpaired and the one step that clears it+ * board-no-view/signed-in/revoked/approval/fresh: names removed and the one step that clears it+ * board-no-view/signed-in/revoked/approval/stale-pairing: names removed and the one step that clears it+ * board-no-view/signed-in/revoked/approval/stale-key: names removed and the one step that clears it+ * other-computer/signed-out/paired/approval/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/paired/approval/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/paired/approval/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/approval/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/approval/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/approval/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/approval/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/approval/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/approval/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-in/paired/approval/fresh: the board within 3 s, and names approval+ * other-computer/signed-in/paired/approval/stale-pairing: the board within 3 s, and names approval+ * other-computer/signed-in/paired/approval/stale-key: names stale-key and the one step that clears it+ * other-computer/signed-in/unpaired/approval/fresh: names unpaired and the one step that clears it+ * other-computer/signed-in/unpaired/approval/stale-pairing: names unpaired and the one step that clears it+ * other-computer/signed-in/unpaired/approval/stale-key: names unpaired and the one step that clears it+ * other-computer/signed-in/revoked/approval/fresh: names removed and the one step that clears it+ * other-computer/signed-in/revoked/approval/stale-pairing: names removed and the one step that clears it+ * other-computer/signed-in/revoked/approval/stale-key: names removed and the one step that clears it+ * phone/signed-out/paired/approval/fresh: names sign-in and the one step that clears it+ * phone/signed-out/paired/approval/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/paired/approval/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/approval/fresh: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/approval/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/approval/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/revoked/approval/fresh: names sign-in and the one step that clears it+ * phone/signed-out/revoked/approval/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/revoked/approval/stale-key: names sign-in and the one step that clears it+ * phone/signed-in/paired/approval/fresh: the board within 3 s, and names approval+ * phone/signed-in/paired/approval/stale-pairing: the board within 3 s, and names approval+ * phone/signed-in/paired/approval/stale-key: names stale-key and the one step that clears it+ * phone/signed-in/unpaired/approval/fresh: names unpaired and the one step that clears it+ * phone/signed-in/unpaired/approval/stale-pairing: names unpaired and the one step that clears it+ * phone/signed-in/unpaired/approval/stale-key: names unpaired and the one step that clears it+ * phone/signed-in/revoked/approval/fresh: names removed and the one step that clears it+ * phone/signed-in/revoked/approval/stale-pairing: names removed and the one step that clears it+ * phone/signed-in/revoked/approval/stale-key: names removed and the one step that clears it+ * board-view/signed-out/paired/mixed/fresh: the board within 3 s+ * board-view/signed-out/paired/mixed/stale-pairing: the board within 3 s+ * board-view/signed-out/paired/mixed/stale-key: the board within 3 s+ * board-view/signed-out/unpaired/mixed/fresh: the board within 3 s+ * board-view/signed-out/unpaired/mixed/stale-pairing: the board within 3 s+ * board-view/signed-out/unpaired/mixed/stale-key: the board within 3 s+ * board-view/signed-out/revoked/mixed/fresh: the board within 3 s+ * board-view/signed-out/revoked/mixed/stale-pairing: the board within 3 s+ * board-view/signed-out/revoked/mixed/stale-key: the board within 3 s+ * board-view/signed-in/paired/mixed/fresh: the board within 3 s+ * board-view/signed-in/paired/mixed/stale-pairing: the board within 3 s+ * board-view/signed-in/paired/mixed/stale-key: the board within 3 s+ * board-view/signed-in/unpaired/mixed/fresh: the board within 3 s+ * board-view/signed-in/unpaired/mixed/stale-pairing: the board within 3 s+ * board-view/signed-in/unpaired/mixed/stale-key: the board within 3 s+ * board-view/signed-in/revoked/mixed/fresh: the board within 3 s+ * board-view/signed-in/revoked/mixed/stale-pairing: the board within 3 s+ * board-view/signed-in/revoked/mixed/stale-key: the board within 3 s+ * board-no-view/signed-out/paired/mixed/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/paired/mixed/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/paired/mixed/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/mixed/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/mixed/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/unpaired/mixed/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/mixed/fresh: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/mixed/stale-pairing: names sign-in and the one step that clears it+ * board-no-view/signed-out/revoked/mixed/stale-key: names sign-in and the one step that clears it+ * board-no-view/signed-in/paired/mixed/fresh: the board within 3 s, and names too-big+ * board-no-view/signed-in/paired/mixed/stale-pairing: the board within 3 s, and names too-big+ * board-no-view/signed-in/paired/mixed/stale-key: names stale-key and the one step that clears it+ * board-no-view/signed-in/unpaired/mixed/fresh: names unpaired and the one step that clears it+ * board-no-view/signed-in/unpaired/mixed/stale-pairing: names unpaired and the one step that clears it+ * board-no-view/signed-in/unpaired/mixed/stale-key: names unpaired and the one step that clears it+ * board-no-view/signed-in/revoked/mixed/fresh: names removed and the one step that clears it+ * board-no-view/signed-in/revoked/mixed/stale-pairing: names removed and the one step that clears it+ * board-no-view/signed-in/revoked/mixed/stale-key: names removed and the one step that clears it+ * other-computer/signed-out/paired/mixed/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/paired/mixed/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/paired/mixed/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/mixed/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/mixed/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/unpaired/mixed/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/mixed/fresh: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/mixed/stale-pairing: names sign-in and the one step that clears it+ * other-computer/signed-out/revoked/mixed/stale-key: names sign-in and the one step that clears it+ * other-computer/signed-in/paired/mixed/fresh: the board within 3 s, and names too-big+ * other-computer/signed-in/paired/mixed/stale-pairing: the board within 3 s, and names too-big+ * other-computer/signed-in/paired/mixed/stale-key: names stale-key and the one step that clears it+ * other-computer/signed-in/unpaired/mixed/fresh: names unpaired and the one step that clears it+ * other-computer/signed-in/unpaired/mixed/stale-pairing: names unpaired and the one step that clears it+ * other-computer/signed-in/unpaired/mixed/stale-key: names unpaired and the one step that clears it+ * other-computer/signed-in/revoked/mixed/fresh: names removed and the one step that clears it+ * other-computer/signed-in/revoked/mixed/stale-pairing: names removed and the one step that clears it+ * other-computer/signed-in/revoked/mixed/stale-key: names removed and the one step that clears it+ * phone/signed-out/paired/mixed/fresh: names sign-in and the one step that clears it+ * phone/signed-out/paired/mixed/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/paired/mixed/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/mixed/fresh: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/mixed/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/unpaired/mixed/stale-key: names sign-in and the one step that clears it+ * phone/signed-out/revoked/mixed/fresh: names sign-in and the one step that clears it+ * phone/signed-out/revoked/mixed/stale-pairing: names sign-in and the one step that clears it+ * phone/signed-out/revoked/mixed/stale-key: names sign-in and the one step that clears it+ * phone/signed-in/paired/mixed/fresh: the board within 3 s, and names too-big+ * phone/signed-in/paired/mixed/stale-pairing: the board within 3 s, and names too-big+ * phone/signed-in/paired/mixed/stale-key: names stale-key and the one step that clears it+ * phone/signed-in/unpaired/mixed/fresh: names unpaired and the one step that clears it+ * phone/signed-in/unpaired/mixed/stale-pairing: names unpaired and the one step that clears it+ * phone/signed-in/unpaired/mixed/stale-key: names unpaired and the one step that clears it+ * phone/signed-in/revoked/mixed/fresh: names removed and the one step that clears it+ * phone/signed-in/revoked/mixed/stale-pairing: names removed and the one step that clears it+ * phone/signed-in/revoked/mixed/stale-key: names removed and the one step that clears it+ * CELLS-END+ */+import assert from 'node:assert/strict';+import { readFileSync } from 'node:fs';+import { join } from 'node:path';+import { test } from 'node:test';+import { relayClientFixture } from './relay-client-fixture.js';+import { enrollProtocolPhone } from './relay-device-enrollment-fixture.js';+import { hostedEngines } from './hosted-browsers.js';+import { openEngine } from './hosted-browsers.js';+import {+ BOARDS,+ READ_SCREEN,+ STORED,+ boardView,+ cells,+ enrolledDevices,+ expected,+ freshSession,+ headerLine,+ hostedFront,+ impossibility,+ judge,+ relayOnAll,+ relayPairClears,+ revokeDevice,+ siblingProject,+ storedScript,+ visit,+} from './hosted-shapes-fixture.js';++/**+ * Each failing cell's cause: one filed defect per cause, listing every cell it covers as engine:cell. A fix removes+ * its cause, and the matrix then requires those cells to pass; a listed cell that passes fails the run, so the lists+ * stay true.+ */+const CAUSES = [];++/** The filed defect that covers one failing cell, or undefined. */+function causeOf(key) {+ return CAUSES.find((cause) => cause.cells.includes(key));+}++/**+ * The matrix takes many minutes, so it runs as its own job (hosted-shapes in .github/workflows/gate.yml), never in+ * the landing gate or a submit's affected tests: only with this variable set.+ */+const OWN_JOB = process.env.PULLBOARD_HOSTED_SHAPES === '1';++/** How many unpaired cells one engine runs at once; each is its own browser context. */+const PARALLEL = 4;++/** The board ids and keys a linked project holds on this computer. */+function linkOf(box, root) {+ const state = JSON.parse(readFileSync(join(root, '.git', 'pullboard', 'relay.json'), 'utf8'));+ return { id: state.board, key: readFileSync(join(box.env.PULLBOARD_HOME, 'relay-keys', state.board + '.key'), 'utf8').trim() };+}++/**+ * Build one board state as a person would reach it, on its own relay account, and enroll then revoke one browser+ * per engine on the way, so the revoked identities are real.+ *+ * @param {import('node:test').TestContext} t+ * @param {string} boards+ * @param {{ name: string, context: object }[]} revokedIdentities - one browser context per engine, to be revoked+ * @param {object} front - the hosted front for this relay, created by the caller once the relay exists+ */+async function buildBoards(t, boards, engines) {+ const box = await relayClientFixture(t);+ box.env.PULLBOARD_MACHINE_HOME = box.env.PULLBOARD_HOME;+ const front = await hostedFront(box.origin);+ t.after(() => front.close());+ const revoked = {};+ const linked = [];+ /** Enroll this engine's revoked identity through the real relay on --all, then revoke it with relay revoke. */+ const enrollAndRevoke = async () => {+ for (const engine of engines) {+ const context = await engine.newContext();+ const session = await freshSession(box);+ let page;+ try {+ await relayOnAll(box, async (link) => {+ page = await context.newPage({ route: front.route(session, null) });+ await page.navigate(link);+ });+ } catch (error) {+ const seen = page ? await page.evaluate(READ_SCREEN).catch(() => null) : null;+ error.message += ` (enrolling ${engine.name}; its page showed ${JSON.stringify(seen)})`;+ throw error;+ }+ // relay on --all returns only once this browser enrolled and received its board keys.+ await page.close();+ const [device] = enrolledDevices(box);+ await revokeDevice(box, device);+ revoked[engine.name] = { context, session };+ }+ };+ if (boards === 'excluded') {+ assert.equal((await box.cli('relay', 'off')).code, 0, 'relay off excludes the board');+ await relayOnAll(box);+ }+ if (boards === 'healthy') { await enrollAndRevoke(); linked.push(linkOf(box, box.root)); }+ if (boards === 'oversize') {+ box.legacySnapshotApi('bad-route');+ box.rejectSnapshots({ status: 400, code: 'BAD_REQUEST', message: 'the body exceeds 14000000 bytes; send a smaller snapshot' });+ await enrollAndRevoke();+ linked.push(linkOf(box, box.root));+ }+ if (boards === 'approval') {+ await enrollAndRevoke();+ linked.push(linkOf(box, box.root));+ // The owner's own phone holds the approval card; the browsers under test are other browsers.+ await enrollProtocolPhone(box);+ const waiting = await siblingProject(box, 'notes', 'fixture/notes');+ const machine = JSON.parse(readFileSync(join(box.env.PULLBOARD_HOME, 'relay-machine/state.json'), 'utf8'));+ assert.ok(machine.approvals.some((entry) => entry.root === waiting && entry.published), 'the new project waits for a phone approval');+ }+ if (boards === 'mixed') {+ const big = await siblingProject(box, 'big', 'fixture/big');+ const skipped = await siblingProject(box, 'skipped', 'fixture/skipped');+ assert.equal((await box.cliAt(skipped, 'relay', 'off')).code, 0, 'one project is excluded');+ await enrollAndRevoke();+ box.legacySnapshotApi('bad-route');+ box.rejectSnapshots({ status: 400, code: 'BAD_REQUEST', message: 'the body exceeds 14000000 bytes; send a smaller snapshot' });+ assert.equal((await box.cliAt(big, 'relay', 'on', '--url', box.origin)).code, 0, 'the big project links, paused for size');+ linked.push(linkOf(box, box.root), linkOf(box, big));+ }+ const view = await boardView(box);+ t.after(() => view.stop());+ return { box, front, view, revoked, linked, unpairedSession: await freshSession(box), pairedSession: await freshSession(box) };+}++/** Run every cell of one board state in one engine; returns the failures as cell id -> reason, with timings. */+async function runCells(engine, built, boardCells, report, ineffective) {+ const { front, view, revoked, linked } = built;+ const keys = Object.fromEntries(linked.map(({ id, key }) => [id, key]));+ const boardIds = linked.map(({ id }) => id);+ const failures = {};+ /** Visit one cell in the given identity's context. */+ const one = async (cell, context, session) => {+ const want = expected(cell);+ const browser = impossibility(cell)?.runsAs.browser ?? cell.browser;+ const bootstrap = storedScript(cell.stored, { keys: browser === 'paired' ? keys : null, boards: boardIds });+ const route = front.route(cell.account === 'signed-in' ? session : null, cell.where === 'board-view' ? view.base : null);+ let seen;+ try { seen = await visit(context, { route, phone: cell.where === 'phone', bootstrap }, want.board); }+ catch (error) { seen = { board: false, approval: false, words: 'visit failed: ' + error.message, commands: [], signIn: false, ms: null }; }+ const problem = judge(cell, seen, ineffective);+ report.push({ engine: engine.name, cell: cell.id, ok: !problem, problem, ms: seen.ms, words: seen.words.slice(0, 300), commands: seen.commands });+ if (problem) failures[cell.id] = problem;+ };+ const unpaired = boardCells.filter((cell) => (impossibility(cell)?.runsAs.browser ?? cell.browser) === 'unpaired');+ for (let at = 0; at < unpaired.length; at += PARALLEL) {+ await Promise.all(unpaired.slice(at, at + PARALLEL).map(async (cell) => {+ const context = await engine.newContext();+ try { await one(cell, context, built.unpairedSession); } finally { await context.close(); }+ }));+ }+ // A paired browser keeps its keys in its own storage, so each stored state gets its own paired context, and the+ // cells within one run in turn; the revoked browser is the one enrolled browser, so its cells run in turn too.+ const pairedCells = boardCells.filter((entry) => !impossibility(entry) && entry.browser === 'paired');+ const revokedRun = (async () => {+ for (const cell of boardCells.filter((entry) => !impossibility(entry) && entry.browser === 'revoked')) {+ await one(cell, revoked[engine.name].context, revoked[engine.name].session);+ }+ })();+ await Promise.all(STORED.map(async (stored) => {+ const paired = await engine.newContext();+ try { for (const cell of pairedCells.filter((entry) => entry.stored === stored)) await one(cell, paired, built.pairedSession); }+ finally { await paired.close(); }+ }));+ await revokedRun;+ return failures;+}++test('every listed cause is a filed item covering real cells, each cell once [H5,C7]', () => {+ const all = new Set(cells().flatMap((cell) => ['chromium', 'webkit'].map((engine) => `${engine}:${cell.id}`)));+ const seen = new Set();+ for (const cause of CAUSES) {+ assert.ok(Number.isSafeInteger(cause.item) && cause.item > 0 && cause.cause, 'each cause names its filed item and why');+ for (const key of cause.cells) {+ assert.ok(all.has(key), `${key} is a cell of the matrix`);+ assert.equal(seen.has(key), false, `${key} has one cause`);+ seen.add(key);+ }+ }+});++test('the header lists every cell and the screen it must reach [H5,H17,N26]', () => {+ const source = readFileSync(new URL(import.meta.url), 'utf8');+ const listed = source.slice(source.indexOf(' * CELLS-START\n') + ' * CELLS-START\n'.length, source.indexOf(' * CELLS-END'));+ assert.equal(cells().length, 4 * 2 * 3 * 6 * 3, 'the matrix is every combination');+ assert.equal(listed, cells().map(headerLine).join('\n') + '\n', 'the header lists every cell with its screen; regenerate it from headerLine when the matrix changes');+});++test('the matrix runs as its own job, outside the landing gate [H5,C7]', () => {+ const workflow = readFileSync(new URL('../.github/workflows/gate.yml', import.meta.url), 'utf8');+ const job = workflow.match(/\n hosted-shapes:\n([\s\S]*?)\n [a-z-]+:\n/u)?.[1];+ assert.ok(job, 'gate.yml has a hosted-shapes job beside the gate’s test jobs');+ assert.match(job, /if: github\.ref == 'refs\/heads\/main' && github\.event_name != 'pull_request'/u);+ assert.match(job, /run: npm run hosted-shapes/u);+ assert.equal(workflow.match(/npm run hosted-shapes|PULLBOARD_HOSTED_SHAPES|hosted-shapes\.test\.js/gu).length, 1, 'no other job runs the matrix');+ const scripts = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).scripts;+ assert.equal(scripts['hosted-shapes'], 'PULLBOARD_HOSTED_SHAPES=1 node bin/run-tests.js test/hosted-shapes.test.js', 'one script runs the matrix as its own job');+ assert.equal(/hosted-shapes|PULLBOARD_HOSTED_SHAPES/u.test(scripts.gate + scripts.test), false, 'the gate and npm test never set it');+});++for (const boards of BOARDS) {+ test(`every shape opens or names its blocker: ${boards} [H5,H17,N26]`, {+ timeout: 900_000, // budget: hang ceiling for one board state's setup and both engines' cells.+ skip: !OWN_JOB && 'the matrix runs as its own job: set PULLBOARD_HOSTED_SHAPES=1, as the hosted-shapes job does',+ }, async (t) => {+ const available = hostedEngines().filter((engine) => engine.available);+ for (const engine of hostedEngines().filter((entry) => !entry.available)) t.diagnostic(`${engine.name} column skipped: ${engine.reason}`);+ if (!available.length) return t.skip('no browser on this machine');+ const engines = [];+ for (const { name } of available) engines.push(await openEngine(name));+ t.after(async () => { for (const engine of engines) await engine.close(); });+ const started = Date.now();+ const built = await buildBoards(t, boards, engines);+ t.diagnostic(`${boards}: setup ${Date.now() - started} ms`);+ const boardCells = cells().filter((cell) => cell.boards === boards);+ // The pairing step the page offers an unpaired browser, run once for real in the first engine: pairing is the+ // CLI's and the relay's, not the browser's. If it does not open the board, offering it does not clear the blocker.+ const clears = built.linked.length ? await relayPairClears(built.box, engines[0], built.front, built.unpairedSession) : null;+ t.diagnostic(`${boards}: pullboard relay pair ${clears === null ? 'not offered' : clears ? 'opens the board' : 'does not open the board'}`);+ const ineffective = clears === false ? ['pullboard relay pair'] : [];+ const report = [];+ const unexpected = [];+ // The engines run side by side: separate browsers and contexts, one relay and one view.+ const results = await Promise.all(engines.map(async (engine) => {+ const ran = Date.now();+ const failures = await runCells(engine, built, boardCells, report, ineffective);+ t.diagnostic(`${boards} ${engine.name}: ${boardCells.length} cells in ${Date.now() - ran} ms, ${Object.keys(failures).length} failing`);+ return { engine, failures };+ }));+ for (const { engine, failures } of results) {+ for (const cell of boardCells) {+ const key = `${engine.name}:${cell.id}`;+ const cause = causeOf(key);+ if (failures[cell.id] && !cause) unexpected.push(`${key}: ${failures[cell.id]}`);+ if (!failures[cell.id] && cause) unexpected.push(`${key} now passes; remove it from #${cause.item}'s cells`);+ }+ }+ if (process.env.PULLBOARD_SHAPES_REPORT) {+ const { appendFileSync } = await import('node:fs');+ for (const row of report) appendFileSync(process.env.PULLBOARD_SHAPES_REPORT, JSON.stringify({ boards, ...row }) + '\n');+ }+ assert.deepEqual(unexpected, [], 'every cell shows its board or names its blocker, or is a filed defect');+ });+}diff --git a/test/webkit-fixture.js b/test/webkit-fixture.jsnew file mode 100644index 00000000..1e4a0525--- /dev/null+++ b/test/webkit-fixture.js@@ -0,0 +1,216 @@+/**+ * A real WebKit for browser tests, with no package [H5,C7]. It drives the WebKit build Playwright keeps in its browser+ * cache (Playwright.app on macOS) over that build's own inspector pipe: JSON messages separated by NUL bytes on file+ * descriptors 3 (to the browser) and 4 (from it). Nothing here downloads a browser; a machine without such a build gets+ * null from findWebkitExecutable, and a test names that reason when it skips its WebKit column.+ */+import { spawn } from 'node:child_process';+import {+ existsSync,+ mkdtempSync,+ readdirSync,+ rmSync,+} from 'node:fs';+import {+ tmpdir,+ userInfo,+} from 'node:os';+import {+ dirname,+ join,+} from 'node:path';+import { requireBrowserSlot } from './chrome-fixture.js';++/** How long one protocol command may take before the fixture names it as stuck. */+const COMMAND_TIMEOUT_MS = 15_000;++/**+ * The WebKit executable to drive: PULLBOARD_WEBKIT when set, else the newest Playwright WebKit build in this user's+ * browser cache on macOS, else null.+ *+ * @returns {string | null}+ */+export function findWebkitExecutable() {+ if (process.env.PULLBOARD_WEBKIT) return existsSync(process.env.PULLBOARD_WEBKIT) ? process.env.PULLBOARD_WEBKIT : null;+ if (process.platform !== 'darwin') return null;+ // The account's own home, not $HOME, which a test runner may point at a private folder.+ const cache = join(userInfo().homedir, 'Library', 'Caches', 'ms-playwright');+ let builds = [];+ try { builds = readdirSync(cache).filter((name) => /^webkit-\d+$/u.test(name)); } catch { return null; }+ builds.sort((left, right) => Number(right.slice(7)) - Number(left.slice(7)));+ for (const build of builds) {+ const executable = join(cache, build, 'Playwright.app', 'Contents', 'MacOS', 'Playwright');+ if (existsSync(executable)) return executable;+ }+ return null;+}++/** Wait a little without holding the event loop. */+function pause(ms) {+ return new Promise((resolvePause) => setTimeout(resolvePause, ms)); // budget: hang ceiling for one poll interval, no speed claim.+}++/**+ * Start a headless WebKit with its own profile folder.+ *+ * @param {{ executable?: string, commandTimeoutMs?: number }} [options]+ * @returns {Promise<{ newPage: (options?: { cookies?: object[], proxyServer?: string }) => Promise<object>, close: () => Promise<void>, stderr: () => string }>}+ */+export async function startWebkit({ executable = findWebkitExecutable(), commandTimeoutMs = COMMAND_TIMEOUT_MS } = {}) {+ requireBrowserSlot();+ if (!executable) throw new Error('WebKit was not found; set PULLBOARD_WEBKIT to a Playwright WebKit build.');+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-webkit-'));+ const frameworks = dirname(dirname(dirname(dirname(executable))));+ const child = spawn(executable, ['--inspector-pipe', '--headless', '--no-startup-window', `--user-data-dir=${profile}`], {+ // WebKit keeps a CryptoKey in IndexedDB only by wrapping it with a master key from the account's keychain, which+ // lives under the real home; a test runner's private HOME has none, and the store then refuses the key.+ detached: true, env: { ...process.env, HOME: userInfo().homedir, DYLD_FRAMEWORK_PATH: frameworks, DYLD_LIBRARY_PATH: frameworks },+ stdio: ['ignore', 'ignore', 'pipe', 'pipe', 'pipe'],+ });+ let stderr = '';+ child.stderr.setEncoding('utf8').on('data', (chunk) => { stderr = (stderr + chunk).slice(-8_000); });+ const exited = new Promise((resolveExit) => child.once('close', resolveExit));+ const toBrowser = child.stdio[3];+ const fromBrowser = child.stdio[4];+ const pending = new Map();+ const listeners = new Set();+ let nextId = 0;+ let buffer = '';+ fromBrowser.setEncoding('utf8').on('data', (chunk) => {+ buffer += chunk;+ for (let end = buffer.indexOf('\0'); end >= 0; end = buffer.indexOf('\0')) {+ const message = JSON.parse(buffer.slice(0, end));+ buffer = buffer.slice(end + 1);+ const waiting = message.id !== undefined ? pending.get(message.id) : null;+ if (waiting) {+ pending.delete(message.id);+ clearTimeout(waiting.timer);+ if (message.error) waiting.reject(new Error(`WebKit ${waiting.method}: ${message.error.message ?? 'refused'}`));+ else waiting.resolve(message.result ?? {});+ } else for (const listener of listeners) listener(message);+ }+ });+ /** Send one browser-level command, optionally addressed to a page proxy. */+ function send(method, params = {}, pageProxyId) {+ return new Promise((resolveSend, rejectSend) => {+ const id = ++nextId;+ const timer = setTimeout(() => { pending.delete(id); rejectSend(new Error(`WebKit ${method} did not answer within ${commandTimeoutMs}ms`)); }, commandTimeoutMs);+ pending.set(id, { resolve: resolveSend, reject: rejectSend, timer, method });+ toBrowser.write(JSON.stringify({ id, method, params, ...(pageProxyId ? { pageProxyId } : {}) }) + '\0');+ });+ }+ await send('Playwright.enable');++ /**+ * Open one page in a fresh browser context: its own cookies and storage, so each matrix cell starts from exactly+ * the state it names.+ *+ * `prepare(send)` runs on every page target before it starts, including the new target a cross-site navigation+ * makes, so interception and the bootstrap script hold on every document; `onMessage` sees each target event.+ *+ * @param {{ cookies?: object[], proxyServer?: string, prepare?: (send: (method: string, params?: object) => Promise<any>) => Promise<void>, onMessage?: (message: object, send: (method: string, params?: object) => Promise<any>) => void, phone?: boolean }} [options]+ */+ async function newPage({ cookies = [], proxyServer, prepare, onMessage, phone = false, context = null } = {}) {+ // A page joins an existing context when given one, so it shares that context's storage and IndexedDB.+ const { browserContextId } = context ? { browserContextId: context } : await send('Playwright.createContext', proxyServer ? { proxyServer } : {});+ if (proxyServer) await send('Playwright.setIgnoreCertificateErrors', { browserContextId, ignore: true });+ if (cookies.length) await send('Playwright.setCookies', { browserContextId, cookies });+ let targetId = null;+ let pageProxyId = null;+ let innerId = 0;+ const innerPending = new Map();+ const exceptions = [];+ const listener = (message) => {+ if (pageProxyId && message.pageProxyId !== pageProxyId) return;+ if (message.method === 'Target.targetCreated' && message.params.targetInfo.type === 'page') {+ const created = message.params.targetInfo;+ const proxy = message.pageProxyId;+ void (async () => {+ try { if (prepare) await prepare((method, params) => toTarget(created.targetId, proxy, method, params)); }+ catch (error) { exceptions.push({ setup: error.message }); }+ // The first target counts as ready only once prepared, so no request of the first navigation escapes it.+ if (!created.isProvisional) targetId = created.targetId;+ if (created.isPaused) await send('Target.resume', { targetId: created.targetId }, proxy).catch(() => {});+ })();+ } else if (message.method === 'Target.didCommitProvisionalTarget') {+ targetId = message.params.newTargetId;+ } else if (message.method === 'Target.dispatchMessageFromTarget') {+ const inner = JSON.parse(message.params.message);+ const waiting = inner.id !== undefined ? innerPending.get(inner.id) : null;+ if (waiting) { innerPending.delete(inner.id); waiting(inner); }+ else if (onMessage && inner.method) onMessage(inner, (method, params) => toTarget(message.params.targetId, message.pageProxyId, method, params));+ if (waiting) return;+ if (inner.method === 'Runtime.exceptionThrown' || inner.method === 'Console.messageAdded' && inner.params?.message?.level === 'error') exceptions.push(inner.params);+ }+ };+ /** Send one command to a named target of this page and wait for its answer. */+ function toTarget(target, proxy, method, params = {}) {+ return new Promise((resolveTarget, rejectTarget) => {+ const id = ++innerId;+ const timer = setTimeout(() => { innerPending.delete(id); rejectTarget(new Error(`WebKit page ${method} did not answer within ${commandTimeoutMs}ms`)); }, commandTimeoutMs);+ innerPending.set(id, (inner) => { clearTimeout(timer); inner.error ? rejectTarget(new Error(`WebKit page ${method}: ${inner.error.message}`)) : resolveTarget(inner.result); });+ send('Target.sendMessageToTarget', { targetId: target, message: JSON.stringify({ id, method, params }) }, proxy).catch((error) => { clearTimeout(timer); innerPending.delete(id); rejectTarget(error); });+ });+ }+ listeners.add(listener);+ ({ pageProxyId } = await send('Playwright.createPage', { browserContextId }));+ if (phone) {+ await send('Emulation.setDeviceMetricsOverride', { width: 390, height: 844, fixedLayout: false, deviceScaleFactor: 2 }, pageProxyId);+ await send('Page.setTouchEmulationEnabled', { enabled: true }, pageProxyId).catch(() => {});+ }+ const deadline = Date.now() + commandTimeoutMs;+ while (!targetId && Date.now() < deadline) await pause(10);+ if (!targetId) throw new Error('WebKit created no page target');+ /** Send one command to the page's current target and wait for its answer. */+ function page(method, params = {}) { return toTarget(targetId, pageProxyId, method, params); }+ /** Evaluate an expression in the page and return its JSON value. */+ async function evaluate(expression) {+ const result = await page('Runtime.evaluate', { expression: `JSON.stringify((() => (${expression}))())`, returnByValue: true });+ if (result.wasThrown) throw new Error(`WebKit page threw: ${result.result?.description ?? 'an exception'}`);+ return result.result?.value === undefined ? undefined : JSON.parse(result.result.value);+ }+ /** Poll an expression until it is truthy, then return its value; a navigation in flight is retried. */+ async function waitFor(expression, timeoutMs = commandTimeoutMs) {+ const end = Date.now() + timeoutMs;+ let last = null;+ while (Date.now() < end) {+ try {+ const value = await evaluate(expression);+ if (value) return value;+ } catch (error) { last = error; }+ await pause(25);+ }+ throw new Error(`WebKit condition did not hold within ${timeoutMs}ms: ${expression.slice(0, 160)}${last ? ` (${last.message})` : ''}`);+ }+ return {+ browserContextId,+ exceptions,+ navigate: (url) => send('Playwright.navigate', { url, pageProxyId }),+ evaluate,+ waitFor,+ cookies: async () => (await send('Playwright.getAllCookies', { browserContextId })).cookies,+ /** Close the page; its context goes too unless it is kept for other pages. */+ async close({ keepContext = false } = {}) {+ listeners.delete(listener);+ try { await send('Playwright.closePage', { pageProxyId }); } catch { /* The page already closed. */ }+ if (!keepContext) { try { await send('Playwright.deleteContext', { browserContextId }); } catch { /* The context already closed. */ } }+ },+ };+ }++ let closed = false;+ return {+ newPage,+ /** Remove one browser context and everything stored in it. */+ deleteContext: (browserContextId) => send('Playwright.deleteContext', { browserContextId }),+ stderr: () => stderr,+ async close() {+ if (closed) return;+ closed = true;+ try { await send('Playwright.close'); } catch { /* The browser already stopped. */ }+ const stopped = await Promise.race([exited.then(() => true), pause(3_000).then(() => false)]); // budget: hang ceiling for WebKit shutdown.+ if (!stopped) { try { process.kill(-child.pid, 'SIGKILL'); } catch { /* The group already exited. */ } await exited; }+ rmSync(profile, { recursive: true, force: true });+ },+ };+}