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
fix(relay): show the real board access blocker [H5,H17]
Corey Olson0da8db5110de
diff --git a/relay/browser-client.js b/relay/browser-client.jsindex ebce0a31..7164fe81 100644--- a/relay/browser-client.js+++ b/relay/browser-client.js@@ -1,12 +1,12 @@/** Device-only relay transport: cookie authorization, local keys and authenticated ciphertext [H5,H15,H16,H17]. */-import { rememberDevicePairing, enrollPhone, deviceBoardKeys, installPhoneApprovals, forgetDevice } from './browser-devices.js';+import { rememberDevicePairing, enrollPhone, deviceBoardKeyState, installPhoneApprovals, forgetDevice } from './browser-devices.js';import { decodeBoardKey, encodeBoardKey, seal, unseal } from './seal.js';import { preparePersonRequest, validatePersonRequest } from './person-request.js';import { snapshotState, presentationState } from './model.js';import { ENGINE_VERSION } from './engine.js';import { Refused } from './refused.js';import { enqueueStream, followStream } from './browser-stream.js';-import { homeLineDismissed, homeScreenLine, noticeLines, nothingShared, rememberOwnedRequestId, showRelayScreen, storedOwnedRequestState } from './browser-notice.js';+import { emptyBoardStep, homeLineDismissed, homeScreenLine, noticeLines, rememberOwnedRequestId, showRelayScreen, storedOwnedRequestState } from './browser-notice.js';import { registerApp, requestPairingPersistence } from './install.js';import { browserJSON, withBrowserDeadline } from './browser-deadline.js';import { phoneApprovalStatus, placePhoneApprovals } from './browser-approval-card.js';@@ -102,6 +102,8 @@ export async function createTransport({ onUpdate = () => {}, onOpenBoard = () =>const keys = savedKeys && typeof savedKeys === 'object' && !Array.isArray(savedKeys) ? savedKeys : {};const paired = new Map();let available = [];+ let inventoryLoaded = false;+ let browserPaired = false;let waitingBoards = new Map();const approvedBoards = new Set();let warnings = [];@@ -181,8 +183,9 @@ export async function createTransport({ onUpdate = () => {}, onOpenBoard = () =>// A phone has no local-view screen to fall back to: keep its shell and the real reason until a board is readable.const root = document.documentElement;const phoneWaiting = root.dataset.relayDevice === 'phone' && (!rendered || paired.size === 0);- showRelayScreen(root, phoneWaiting || nothingShared({ paired, waitingBoards, failure }) ? 'share' : null,- phoneWaiting && (failure || waitingBoards.size) ? lines.join(' ') : '');+ const step = emptyBoardStep({ available, waitingBoards, approvedBoards, loaded: inventoryLoaded, browserPaired, failure });+ showRelayScreen(root, phoneWaiting || paired.size === 0 ? 'share' : null,+ phoneWaiting && (failure || waitingBoards.size) ? lines.join(' ') : '', step);placePhoneApprovals(document);}@@ -398,10 +401,15 @@ export async function createTransport({ onUpdate = () => {}, onOpenBoard = () =>async function listing() {const document = await documentAt('/api/v1/boards', denied);if (accessLost) throw accessError;- const receivedKeys = await deviceBoardKeys((path, options) => documentAt(path, denied, options));+ const device = await deviceBoardKeyState((path, options) => documentAt(path, denied, options));if (accessLost) throw accessError;- Object.assign(keys, stored(localStorage, KEYS, {}), receivedKeys);+ Object.assign(keys, stored(localStorage, KEYS, {}), device.keys);+ browserPaired = device.paired || Boolean(pair) || Object.values(keys).some(value => {+ try { decodeBoardKey(value); return true; } catch { return false; }+ });+ if (device.failure) { failure = device.failure; failureBoard = null; }available = document.boards.filter(board => BOARD.test(board.id) && typeof board.repository === 'string');+ inventoryLoaded = true;waitingBoards = new Map();warnings = document.warnings ?? [];const visible = new Set(available.map(board => board.id));@@ -584,8 +592,7 @@ export async function createTransport({ onUpdate = () => {}, onOpenBoard = () =>// A pairing link opened in another tab, as a scanned QR does, saves its key here: this page fills in by itself.addEventListener('storage', event => { if (event.key === KEYS && !accessLost) listing().then(onUpdate, notice); });addEventListener('pagehide', () => { for (const entry of paired.values()) entry.stream?.close(); });- // Signed in with no board key saved and no pairing on its way, the one-command screen shows at once, while the- // first listing is still on the network; the listing then fills the board in, or keeps this screen.+ // Keep the first screen while inventory is unknown; a pending read is not evidence that nothing is linked.let devicePairing = /(?:^#|&)device=/u.test(location.hash);try { devicePairing ||= sessionStorage.getItem('pullboard.relay.device-pair.v1') !== null; } catch { /* No storage: no saved pairing. */ }if (!pair && !devicePairing && !Object.keys(keys).length) showRelayScreen(document.documentElement, 'share');diff --git a/relay/browser-devices.js b/relay/browser-devices.jsindex 26ac5b5f..77e41855 100644--- a/relay/browser-devices.js+++ b/relay/browser-devices.js@@ -113,17 +113,17 @@ export async function enrollPhone(documentAt) {throw new Refused('DEVICE_PAIR_EXPIRED', 'Keep the Mac setup command open and run pullboard relay on --all for a fresh code.');}-/** Fetch only the signed-in account's grants and authenticate their context with the stored private key. */-export async function deviceBoardKeys(documentAt) {+/** Distinguish an enrolled browser with no grants from one that has never been paired to this account. */+export async function deviceBoardKeyState(documentAt) {let device;try { device = await deviceStorage(); }- catch (error) { if (error.code === 'DEVICE_STORAGE') return {}; throw error; }- if (!device) return {};+ catch (error) { if (error.code === 'DEVICE_STORAGE') return { keys: {}, paired: false, failure: error.message }; throw error; }+ if (!device) return { keys: {}, paired: false };const identity = await documentAt('/api/v1/devices/session');- if (identity.account !== device.account) return {};+ if (identity.account !== device.account) return { keys: {}, paired: false };let response;try { response = await documentAt('/api/v1/devices/' + device.deviceId + '/boards'); }- catch (error) { if (error.code === 'DEVICE_NOT_ENROLLED') return {}; throw error; }+ catch (error) { if (error.code === 'DEVICE_NOT_ENROLLED') return { keys: {}, paired: false }; throw error; }const keys = {};for (const row of response.wraps) {if (!/^[0-9a-f]{32}$/u.test(row.board ?? '') || row.engine !== ENGINE_VERSION || typeof row.wrapped !== 'string') {@@ -135,7 +135,12 @@ export async function deviceBoardKeys(documentAt) {keys[row.board] = encodeBoardKey(await withBrowserDeadline(() => unwrapDeviceBoardKey(device.privateKey, envelope,{ board: row.board, device: device.deviceId, engine: ENGINE_VERSION })));}- return keys;+ return { keys, paired: true };+}++/** Preserve the key-only adapter for callers that do not display the browser's pairing state. */+export async function deviceBoardKeys(documentAt) {+ return (await deviceBoardKeyState(documentAt)).keys;}/** Decode only bounded approval transport; keys and plaintext grants never enter device storage. */diff --git a/relay/browser-notice.js b/relay/browser-notice.jsindex 041ec20a..92e467e1 100644--- a/relay/browser-notice.js+++ b/relay/browser-notice.js@@ -79,6 +79,23 @@ export const RELAY_SCREEN_WORDS = Object.freeze({small: 'It shares every project with your account. Your boards show up here by themselves.', waiting: 'Waiting for your boards' }),});+/** Select guidance from observed inventory and key delivery, never infer why a computer has not uploaded. */+export function emptyBoardStep({ available = [], waitingBoards = new Map(), approvedBoards = new Set(), loaded = false, browserPaired = false, failure = '' } = {}) {+ const pair = { command: 'pullboard relay pair', ask: 'Help me pair this browser with my boards.',+ small: 'On the computer with the boards, run this, then open the link it prints here or scan its QR.' };+ if (!loaded) return { title: 'Checking your linked boards', say: failure || 'Waiting for this account’s board list.', command: '', ask: '', small: '', waiting: failure || 'Checking your boards' };+ if (approvedBoards.size) return { title: 'Finishing this pairing', say: 'Approved; waiting for the computer to send this browser its board keys.',+ command: '', ask: '', small: 'Keep the setup command open on the computer with the boards.', waiting: failure || 'Waiting for this browser’s keys' };+ if (waitingBoards.size) return { title: 'Waiting for the first board copy',+ say: [...waitingBoards.values()].join(', ') + ': its first copy has not reached the relay yet.', command: 'pullboard relay status',+ ask: 'Help me check why my board has not reached the relay.', small: 'Run this on the computer with the board to see why.', waiting: failure || 'Waiting for the first board copy' };+ if (!available.length) return { ...RELAY_SCREEN_WORDS.share,+ say: 'No linked boards are available for this account. ' + RELAY_SCREEN_WORDS.share.say,+ ...(failure ? { title: 'Could not check your boards', say: failure, command: '', ask: '', small: '', waiting: 'Open this page again to retry.' } : {}) };+ if (!browserPaired) return { ...pair, title: 'This browser is not paired', say: failure || 'Your account already has linked boards. Pair this browser to open them.', waiting: 'Waiting for this browser to be paired' };+ return { ...pair, title: 'Linked boards, none readable here', say: failure || 'The computer has not handed this browser keys for these boards yet.', waiting: 'Waiting for keys to your linked boards' };+}+const MARK = '<svg viewBox="0 0 64 64" aria-hidden="true"><path fill="currentColor" d="M8 7h35a6 6 0 0 1 6 6v7H8a5 5 0 0 1-5-5v-3a5 5 0 0 1 5-5Z"/><rect fill="var(--accent)" width="56" height="14" x="3" y="25" rx="5"/><path fill="currentColor" d="M8 43h35a6 6 0 0 1 6 6v8H8a5 5 0 0 1-5-5v-4a5 5 0 0 1 5-5Z"/></svg>';const GITHUB = '<svg viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>';const SPEECH = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12Z"/></svg>';@@ -100,12 +117,12 @@ export function relayScreenMarkup(name, signIn) {+ '<div class="relay-help">' + SPEECH + '<span>' + words.help + '<small>“' + words.ask + '”</small></span><button type="button" data-copy="' + words.ask + '">Copy</button></div>'+ '</div></section>';}- const words = RELAY_SCREEN_WORDS.share;+ const words = emptyBoardStep();return '<section id="relay-screen" aria-label="Pullboard"><div class="relay-panel" data-screen="share">' + head+ '<h1>' + words.title + '</h1><p class="relay-say">' + words.say + '</p>'- + '<div class="relay-box relay-command"><code><span aria-hidden="true">$ </span>' + words.command + '</code><button type="button" data-copy="' + words.command + '">Copy</button></div>'- + '<div class="relay-or">or</div>'- + '<div class="relay-box relay-agent">' + SPEECH + '<span>' + words.agent + '<small>“' + words.ask + '”</small></span><button type="button" data-copy="' + words.ask + '">Copy</button></div>'+ + '<div class="relay-box relay-command" hidden><code></code><button type="button" data-copy="">Copy</button></div>'+ + '<div class="relay-or" hidden>or</div>'+ + '<div class="relay-box relay-agent" hidden>' + SPEECH + '<span>Ask your agent<small></small></span><button type="button" data-copy="">Copy</button></div>'+ '<p class="relay-small">' + words.small + '</p>'+ '<p class="relay-live" role="status"><i aria-hidden="true"></i><span>' + words.waiting + '</span></p>'+ '</div></section>';@@ -123,12 +140,26 @@ export function nothingShared({ paired, waitingBoards, failure }) {* @param {HTMLElement} root - The document's root element.* @param {string|null} name - The first screen, or null when the board can show.* @param {string} [message] - Existing transport guidance to display instead of the default waiting line.+ * @param {object} [step] - Observed empty-board state; omitted while the first inventory is pending.*/-export function showRelayScreen(root, name, message = '') {+export function showRelayScreen(root, name, message = '', step = emptyBoardStep()) {if (name) root.dataset.relayScreen = name;else if (root.dataset.relayScreen === 'share') delete root.dataset.relayScreen;- const status = root.querySelector?.('#relay-screen .relay-live span');- if (status) status.textContent = message || RELAY_SCREEN_WORDS.share.waiting;+ const panel = root.querySelector?.('#relay-screen .relay-panel[data-screen="share"]');+ if (!panel) return;+ panel.querySelector('h1').textContent = step.title;+ panel.querySelector('.relay-say').textContent = step.say;+ panel.querySelector('.relay-small').textContent = step.small;+ const command = panel.querySelector('.relay-command');+ command.hidden = !step.command;+ command.querySelector('code').textContent = step.command ? '$ ' + step.command : '';+ command.querySelector('button').dataset.copy = step.command;+ const agent = panel.querySelector('.relay-agent');+ agent.hidden = !step.ask;+ agent.querySelector('small').textContent = step.ask ? '“' + step.ask + '”' : '';+ agent.querySelector('button').dataset.copy = step.ask;+ panel.querySelector('.relay-or').hidden = !step.ask;+ panel.querySelector('.relay-live span').textContent = message || step.waiting;}/** Copy a screen's sentence or command; a browser without the clipboard API copies from a selected field. */diff --git a/relay/browser-screens.css b/relay/browser-screens.cssindex 683438cc..fc61d327 100644--- a/relay/browser-screens.css+++ b/relay/browser-screens.css@@ -5,6 +5,7 @@* the view's tokens, so the theme the person picked applies here too.*/#relay-screen { display: none; }+#relay-screen [hidden] { display: none !important; }:root[data-relay-screen] body > :not(#relay-screen) { display: none !important; }:root[data-relay-screen="sign-in"] #relay-screen, :root[data-relay-screen="share"] #relay-screen {display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 32px 20px; background: var(--ground);diff --git a/test/relay-browser.test.js b/test/relay-browser.test.jsindex 17be803d..9426704c 100644--- a/test/relay-browser.test.js+++ b/test/relay-browser.test.js@@ -595,22 +595,23 @@ test('a phone not signed in sees one GitHub button and nothing about this computtest('signed in with nothing shared shows one command and waits [H5,H17]', {skip: !findChromeExecutable() && 'Chrome is not installed',}, async t => {- const box = await relayClientFixture(t);const marker = 'SHARED_WHILE_WAITING_757';- assert.equal((await box.cli('add', box.lane, marker)).code, 0);for (const device of ['a phone', 'another computer']) {+ // Each device starts with no linked boards; the preceding phone iteration really shares its board.+ const box = await relayClientFixture(t);+ assert.equal((await box.cli('add', box.lane, marker)).code, 0);const chrome = await startChrome();t.after(() => chrome.close());if (device === 'a phone') await asPhone(chrome);await personCookie(chrome, box);await chrome.navigate(box.origin);- await chrome.waitFor("document.documentElement.dataset.relayScreen === 'share'");+ await chrome.waitFor("document.documentElement.dataset.relayScreen === 'share' && document.querySelector('#relay-screen .relay-command button')?.dataset.copy === 'pullboard relay on --all'");const facts = await chrome.evaluate(SCREEN_FACTS);for (const words of ['One step on your computer', 'pullboard relay on --all', 'Ask your agent', 'Help me share my boards with my phone.', 'Waiting for your boards']) {assert.equal(facts.text.includes(words), true, device + ': the screen says ' + words);}assert.deepEqual(facts.actions, ['Copy', 'Copy'], device + ': Copy for the command and Copy for the agent sentence, and nothing to retry');- assert.doesNotMatch(facts.text.replace('pullboard relay on --all', ''), /\brelay\b|\blinked\b|local view|try again/iu, device + ': relay only inside the command');+ assert.doesNotMatch(facts.text.replace('pullboard relay on --all', ''), /\brelay\b|local view|try again/iu, device + ': relay only inside the command');assert.equal(facts.command, 60, device + ': the command box is 60 px tall');assert.equal(facts.agent, 60, device + ': the agent box is the same height');assert.deepEqual(facts.copies, ['Copy 60', 'Copy 60'], device + ': the command\'s Copy and the agent\'s Copy are 60 px tall');@@ -633,7 +634,7 @@ test('signed in with nothing shared shows one command and waits [H5,H17]', {}});-test('a signed-in phone shows the one-command screen while its first listing is on its way [H5,H17]', {+test('a signed-in phone waits for its first listing before prescribing a command [H5,H17]', {skip: !findChromeExecutable() && 'Chrome is not installed',}, async t => {const box = await relayClientFixture(t);@@ -658,11 +659,11 @@ test('a signed-in phone shows the one-command screen while its first listing isawait chrome.waitFor("window.held757?.length > 0 && document.documentElement.dataset.relayScreen === 'share'");const facts = await chrome.evaluate(SCREEN_FACTS);assert.equal(await chrome.evaluate('window.release757 === undefined && window.held757.length > 0'), true, 'the first listing is still on its way');- for (const words of ['One step on your computer', 'pullboard relay on --all', 'Waiting for your boards']) {+ for (const words of ['Checking your linked boards', 'Checking your boards']) {assert.equal(facts.text.includes(words), true, 'while the listing waits, the screen says ' + words);}assert.doesNotMatch(facts.text, /Pairing this browser|Projects/u, 'no pairing notice or project list while the listing waits');- assert.deepEqual(facts.copies, ['Copy 60', 'Copy 60'], 'both Copy buttons are 60 px tall while the listing waits');+ assert.equal(facts.text.includes('pullboard relay on --all'), false, 'a pending listing does not prove there are no linked boards');await chrome.evaluate('window.samePage757 = true; window.releaseListings757()');await chrome.waitFor("document.querySelector('#relay-notice') !== null && document.documentElement.dataset.relayScreen === 'share'");await box.link();diff --git a/test/relay-empty-phone-fixture.js b/test/relay-empty-phone-fixture.jsnew file mode 100644index 00000000..00dd2d1d--- /dev/null+++ b/test/relay-empty-phone-fixture.js@@ -0,0 +1,73 @@+/** Exercise empty hosted screens in a real, private phone browser without a user's account [H5,H17]. */+import { createServer } from 'node:http';+import { createRelayBrowserHandler } from '../relay/browser-page.js';+import { startChrome } from './relay-browser-fixture.js';++/** Serve only synthetic authorized metadata and keep the production browser transport and device storage. */+export async function emptyPhoneFixture(t, { linked = true, savedKey = false, enrolled = false, delayed = false, phone = true } = {}) {+ const board = { id: 'a'.repeat(32), repository: 'fixture/empty-project' };+ let releaseListing;+ const listingReady = delayed ? new Promise(resolve => { releaseListing = resolve; }) : Promise.resolve();+ const handle = createRelayBrowserHandler({ authenticate: async () => ({ kind: 'session' }) });+ const calls = [];+ const server = createServer(async (req, res) => {+ const path = new URL(req.url, 'http://localhost').pathname;+ calls.push(path);+ if (path === '/fixture') { res.writeHead(200, { 'content-type': 'text/html' }); res.end('<!doctype html><title>Private fixture</title>'); return; }+ if (path.startsWith('/api/')) {+ let body = { version: 1 };+ let status = 200;+ if (path === '/api/v1/boards') { await listingReady; body.boards = linked ? [board] : []; }+ else if (path === '/api/v1/devices/session') body.account = 'fixture-account';+ else if (/\/devices\/[^/]+\/boards$/u.test(path)) body.wraps = [];+ else if (/\/devices\/[^/]+\/approvals$/u.test(path)) body.approvals = [];+ else if (path.endsWith('/state')) { status = 404; body.error = { code: 'NO_SNAPSHOT', message: 'The first sealed copy has not arrived.' }; }+ else { status = 404; body.error = { code: 'NO_BOARD', message: 'This synthetic route has no board.' }; }+ res.writeHead(status, { 'content-type': 'application/json' }); res.end(JSON.stringify(body)); return;+ }+ if (!await handle(req, res)) { res.writeHead(404); res.end(); }+ });+ await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));+ t.after(async () => { releaseListing?.(); server.closeAllConnections(); await new Promise(resolve => server.close(resolve)); });+ const chrome = await startChrome();+ t.after(() => chrome.close());+ if (phone) {+ await chrome.send('Emulation.setDeviceMetricsOverride', { width: 390, height: 844, deviceScaleFactor: 1, mobile: true });+ await chrome.send('Emulation.setTouchEmulationEnabled', { enabled: true, maxTouchPoints: 5 });+ }+ await chrome.send('Page.addScriptToEvaluateOnNewDocument', { source: `const privateFetch = window.fetch;+window.fetch = (input, options) => {+ const url = new URL(typeof input === 'string' ? input : input.url, location.href);+ return ['http://127.0.0.1:4890', 'http://localhost:4890'].includes(url.origin)+ ? Promise.reject(new TypeError('This private phone has no local view')) : privateFetch(input, options);+};` });+ const origin = 'http://127.0.0.1:' + server.address().port;+ await chrome.navigate(origin + '/fixture');+ if (savedKey) await chrome.evaluate(`localStorage.setItem('pullboard.relay.keys.v1', JSON.stringify({ ['a'.repeat(32)]: btoa('x'.repeat(32)).replaceAll('=', '') }))`);+ if (enrolled) await chrome.evaluate(`(async () => {+ const { createDeviceKeys } = await import('/relay/device-keys.js');+ const device = { ...await createDeviceKeys(), account: 'fixture-account' };+ await new Promise((resolve, reject) => {+ const request = indexedDB.open('pullboard-relay-device-v1', 1);+ request.onupgradeneeded = () => request.result.createObjectStore('keys');+ request.onerror = () => reject(request.error);+ request.onsuccess = () => {+ const db = request.result; const transaction = db.transaction('keys', 'readwrite');+ transaction.objectStore('keys').put(device, 'device');+ transaction.oncomplete = () => { db.close(); resolve(); };+ transaction.onerror = () => { db.close(); reject(transaction.error); };+ };+ });+ })()`);+ await chrome.navigate(origin);+ return { chrome, calls, board, releaseListing };+}++/** Read only the visible first-screen guidance and copy actions; never return a stored key. */+export async function emptyPhoneScreen(chrome) {+ return chrome.evaluate(`(() => {+ const panel = document.querySelector('#relay-screen');+ return { text: panel?.innerText ?? '', commands: [...(panel?.querySelectorAll('button[data-copy]') ?? [])].filter(button => button.getClientRects().length).map(button => button.dataset.copy),+ visible: panel?.getClientRects().length > 0, screen: document.documentElement.dataset.relayScreen ?? null };+ })()`);+}diff --git a/test/relay-person-page.test.js b/test/relay-person-page.test.jsindex 49178001..a76d7f87 100644--- a/test/relay-person-page.test.js+++ b/test/relay-person-page.test.js@@ -10,9 +10,68 @@ import { findChromeExecutable, startChrome } from './relay-browser-fixture.js';import { relayClientFixture } from './relay-client-fixture.js';import { createRelayBrowserHandler } from '../relay/browser-page.js';import { runFixtureGit } from './fixture-child.js';+import { emptyPhoneFixture, emptyPhoneScreen } from './relay-empty-phone-fixture.js';const chromeOptions = { skip: !findChromeExecutable() && 'Chrome is not installed' };+test('a signed-in phone names its empty-board blocker and one next step [N26,H5,H17]', chromeOptions, async t => {+ await t.test('no linked board is claimed only after the authorized listing answers', async t => {+ const box = await emptyPhoneFixture(t, { linked: false, delayed: true });+ await box.chrome.waitFor("document.readyState === 'complete' && document.documentElement.dataset.relayDevice === 'phone'");+ const before = await emptyPhoneScreen(box.chrome);+ box.releaseListing();+ assert.equal(before.visible, true);+ assert.equal(before.text.includes('pullboard relay on --all'), false, 'an unanswered inventory cannot prove that nothing is linked');+ assert.deepEqual(before.commands, [], 'an unknown account offers no command to copy');+ await box.chrome.waitFor("document.querySelector('#relay-screen')?.innerText.includes('No linked boards')");+ const shown = await emptyPhoneScreen(box.chrome);+ assert.ok(shown.commands.includes('pullboard relay on --all'), 'sharing is appropriate only for the confirmed empty account');+ });+ await t.test('linked board and unpaired browser', async t => {+ const box = await emptyPhoneFixture(t);+ await box.chrome.waitFor("document.querySelector('#relay-notice')?.textContent.includes('fixture/empty-project')");+ const shown = await emptyPhoneScreen(box.chrome);+ assert.match(shown.text, /not paired/iu);+ assert.match(shown.text, /open.*link.*here/iu);+ assert.ok(shown.commands.includes('pullboard relay pair'));+ assert.equal(shown.text.includes('pullboard relay on --all'), false);+ });+ await t.test('known board key but no first copy', async t => {+ const box = await emptyPhoneFixture(t, { savedKey: true });+ await box.chrome.waitFor("document.querySelector('#relay-notice')?.textContent.includes('waiting for its first snapshot')");+ const shown = await emptyPhoneScreen(box.chrome);+ assert.match(shown.text, /fixture\/empty-project/u);+ assert.match(shown.text, /first (?:copy|snapshot)/iu);+ assert.ok(shown.commands.includes('pullboard relay status'));+ assert.equal(shown.text.includes('pullboard relay on --all'), false);+ });+ await t.test('paired browser has no keys for the linked boards', async t => {+ const box = await emptyPhoneFixture(t, { enrolled: true });+ await box.chrome.waitFor("document.querySelector('#relay-notice')?.textContent.includes('fixture/empty-project')");+ assert.ok(box.calls.some(path => /\/devices\/[^/]+\/boards$/u.test(path)), 'the browser actually authenticated its saved device and fetched its empty grants');+ const shown = await emptyPhoneScreen(box.chrome);+ assert.match(shown.text, /linked boards.*none.*read/iu);+ assert.match(shown.text, /keys/iu);+ assert.ok(shown.commands.includes('pullboard relay pair'));+ assert.equal(shown.text.includes('pullboard relay on --all'), false);+ });+});++test('a signed-in second computer names a linked board blocker without asking to share again [H5,H17]', chromeOptions, async t => {+ for (const [name, options, command] of [+ ['unpaired', {}, 'pullboard relay pair'],+ ['first copy missing', { savedKey: true }, 'pullboard relay status'],+ ['paired without grants', { enrolled: true }, 'pullboard relay pair'],+ ]) await t.test(name, async t => {+ const box = await emptyPhoneFixture(t, { ...options, phone: false });+ await box.chrome.waitFor("document.querySelector('#relay-notice')?.textContent.includes('fixture/empty-project')");+ const shown = await emptyPhoneScreen(box.chrome);+ assert.equal(shown.visible, true, 'the actual desktop person can read this guidance');+ assert.ok(shown.commands.includes(command));+ assert.equal(shown.text.includes('pullboard relay on --all'), false);+ });+});+/** Wait for a private native setup transition without repeating its command or weakening an assertion. */async function phoneSetupState(read, message) {const deadline = Date.now() + 20_000; // budget: declared hang ceiling for a private enrollment/approval metadata transition.@@ -205,7 +264,8 @@ test('a signed-in phone shows its first screen before a local probe can answer [})`);assert.equal(first.screen, 'share', 'a signed-in phone gets its screen before any asynchronous probe or board read');assert.equal(first.visible, true, 'the screen heading is painted, not merely present in hidden markup');- assert.match(first.text, /One step on your computer/u);+ assert.match(first.text, /Checking your linked boards/u);+ assert.doesNotMatch(first.text, /pullboard relay on --all/u, 'an unanswered inventory offers no sharing command');});test('a phone keeps its screen and the reason while a saved board fails or waits [N26,H5,H17]', chromeOptions, async t => {