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
chore(relay): compose size notices with excluded boards [H5,H17]
Corey Olson4f5961496e92
diff --cc relay/browser-client.jsindex 41154d2a,1cd46693..8e729385--- a/relay/browser-client.js+++ b/relay/browser-client.js@@@ -13,7 -13,7 +13,8 @@@ import { browserJSON, withBrowserDeadliimport { phoneApprovalStatus, placePhoneApprovals, forgetPhoneApprovals } from './browser-approval-card.js';import { phoneSnapshotPages } from './browser-pages.js';import { createPhoneHistory } from './browser-history.js';+import { readUploadSize } from './browser-upload-status.js';+ import { deviceExcludedBoards } from './browser-devices.js';const CHECKPOINT_WAIT_MS = 15_000;const KEYS = 'pullboard.relay.keys.v1';@@@ -114,7 -114,8 +115,9 @@@ export async function createTransport(const approvedBoards = new Set();let pendingLinks = [];let pendingLinksFailure = '';+ let sizeProblems = new Map();+ let exclusions = [];+ let exclusionsFailure = '';let warnings = [];let failure = '';let failureBoard = null;@@@ -225,7 -226,7 +228,7 @@@entry.key = null;}paired.clear();- available = []; waitingBoards.clear(); sizeProblems.clear(); pendingLinks = []; pendingLinksFailure = ''; warnings = []; pair = null;- available = []; waitingBoards.clear(); pendingLinks = []; pendingLinksFailure = ''; exclusions = []; exclusionsFailure = ''; warnings = []; pair = null;++ available = []; waitingBoards.clear(); sizeProblems.clear(); pendingLinks = []; pendingLinksFailure = ''; exclusions = []; exclusionsFailure = ''; warnings = []; pair = null;for (const id of Object.keys(keys)) delete keys[id];document.querySelector('main')?.replaceChildren();if (error?.code !== 'DEVICE_REVOKED') { location.replace('/'); return; }@@@ -261,8 -262,8 +264,8 @@@try { state = storedOwnedRequestState(localStorage, key, entry.state?.personRequests); } catch { /* Missing device storage can only hide this device's own notice. */ }ownedRequestIds.set(id, state.owned);}- const lines = noticeLines({ available, paired, ownedRequestIds, waitingBoards, sizeProblems, approvedBoards, pendingLinks, warnings,- failure: failure || pendingLinksFailure });- const lines = noticeLines({ available, paired, ownedRequestIds, waitingBoards, approvedBoards, pendingLinks, warnings, exclusions,++ const lines = noticeLines({ available, paired, ownedRequestIds, waitingBoards, sizeProblems, approvedBoards, pendingLinks, warnings, exclusions,+ failure: failure || pendingLinksFailure || exclusionsFailure });for (const text of lines) {const paragraph = document.createElement('p');paragraph.textContent = text;@@@ -277,7 -278,7 +280,7 @@@// 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);- const step = emptyBoardStep({ available, waitingBoards, sizeProblems, approvedBoards, loaded: inventoryLoaded, browserPaired, failure });- const step = emptyBoardStep({ available, waitingBoards, approvedBoards, loaded: inventoryLoaded, browserPaired, failure, exclusions });++ const step = emptyBoardStep({ available, waitingBoards, sizeProblems, approvedBoards, loaded: inventoryLoaded, browserPaired, failure, exclusions });showRelayScreen(root, phoneWaiting || paired.size === 0 ? 'share' : null,phoneWaiting && (failure || waitingBoards.size || warnings.some(value => ['ACCOUNT_STORAGE_WARNING', 'ACCOUNT_STORAGE_LIMIT'].includes(value?.code))) ? lines.join(' ') : '', step);placePhoneApprovals(document);diff --cc relay/browser-notice.jsindex 256caeec,6b48c92a..c0d4f014--- a/relay/browser-notice.js+++ b/relay/browser-notice.js@@@ -32,7 -33,7 +33,7 @@@ export function storedOwnedRequestState}/** Build truthful device notices from authorized boards and their decrypted pending requests. */- export function noticeLines({ available, paired, ownedRequestIds = new Map(), waitingBoards = new Map(), sizeProblems = new Map(), approvedBoards = new Set(), pendingLinks = [], warnings = [], failure = '' }) {-export function noticeLines({ available, paired, ownedRequestIds = new Map(), waitingBoards = new Map(), approvedBoards = new Set(), pendingLinks = [], warnings = [], failure = '', exclusions = [] }) {++export function noticeLines({ available, paired, ownedRequestIds = new Map(), waitingBoards = new Map(), sizeProblems = new Map(), approvedBoards = new Set(), pendingLinks = [], warnings = [], failure = '', exclusions = [] }) {const lines = [];const waiting = [...paired.entries()].reduce((count, [id, entry]) => {const owned = ownedRequestIds.get(id) ?? new Set();@@@ -98,12 -94,13 +100,15 @@@ export const RELAY_SCREEN_WORDS = Objec});/** Select guidance from observed inventory and key delivery, never infer why a computer has not uploaded. */- export function emptyBoardStep({ available = [], waitingBoards = new Map(), sizeProblems = new Map(), approvedBoards = new Set(), loaded = false, browserPaired = false, failure = '' } = {}) {-export function emptyBoardStep({ available = [], waitingBoards = new Map(), approvedBoards = new Set(), loaded = false, browserPaired = false, failure = '', exclusions = [] } = {}) {++export function emptyBoardStep({ available = [], waitingBoards = new Map(), sizeProblems = new Map(), approvedBoards = new Set(), loaded = false, browserPaired = false, failure = '', exclusions = [] } = {}) {const pair = { command: 'pullboard relay pair --new-browser', 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 (sizeProblems.size) return { title: 'Board too big to share', say: [...sizeProblems.values()].map(uploadSizeLine).join(' '),+ command: '', ask: 'Help me upgrade my relay for bounded snapshots.', small: 'Local work remains available on the computer.', waiting: 'Board exceeds the relay limit' };+ if (!available.length && exclusions.length) return { title: 'Boards excluded from sharing',+ say: excludedNoticeLines(exclusions).join(' '), command: 'pullboard relay on', ask: 'Help me include my excluded boards.',+ small: 'On the named computer, open a terminal in each excluded board and run this command.', waiting: 'Waiting for you to include a board' };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',diff --cc src/relay-upload-pause.jsindex 34cda5a0,34cda5a0..f3379d96--- a/src/relay-upload-pause.js+++ b/src/relay-upload-pause.js@@@ -52,3 -52,3 +52,13 @@@ export function clearUploadPauseNoticesconst cache = createRelayPageCache(state);try { cache.clearNotices(); } finally { cache.close(); }}++++/** Keep a permanent refusal only as a bounded, credential-free diagnostic. */++export function safePauseMessage(error) {++ const message = String(error.relayMessage ?? error.message ?? 'the relay refused the baseline upload')++ .replace(/https?:\/\/[^\s]+/gu, '[relay]')++ .replace(/\b(?:Bearer\s+)?(?:ps|pa|pm|pg)_[A-Za-z0-9_-]{20,}\b/gu, '[credential]')++ .replace(/[\r\n\t\x00-\x1f\x7f]+/gu, ' ')++ .replace(/\s+/gu, ' ').trim();++ return message.slice(0, 240) || 'the relay refused the baseline upload';++}diff --cc src/relay.jsindex 60f9b160,f6f46f44..23b1e2c1--- a/src/relay.js+++ b/src/relay.js@@@ -1,11 -1,9 +1,15 @@@+import {+ formatSnapshotLimit,+ reportedSnapshotSize,+ snapshotSize,+} from './relay-snapshot-size.js';+export { formatSnapshotLimit };import { beginCommandPhase } from './command-phase.js';import { recordedMoveRefusal } from './recorded-move.js';+ import {+ publishExcludedBoards,+ publishOffExclusions,+ } from './relay-excluded.js';import {recoverySummary,unlinkedRelayStatus,@@@ -16,6 -14,6 +20,7 @@@ importclearUploadPauseNotices,firstUploadPauseNotice,permanentUploadRefusal,++ safePauseMessage,uploadPauseType,uploadRetryReady,} from './relay-upload-pause.js';@@@ -481,15 -472,23 +486,6 @@@ export function pendingSnapshotSize(rooreturn snapshotSize(loadLink(linkFile(root)));}-/** Format a shared status line for an oversized sealed snapshot. */-export function formatSnapshotLimit(problem, { paused = false } = {}) {- const size = `${(problem.sealedBytes / 1_000_000).toFixed(1)} MB`;- const limit = `${(problem.limit / 1_000_000).toFixed(1)} MB`;- if (paused) return `relay paused for ${problem.board}: snapshot ${size} over the relay limit ${limit}; it resumes when the relay supports bounded snapshots`;- return `relay snapshot for ${problem.board}: sealed snapshot ${size} over the relay limit ${limit}`;-}---/** Keep a permanent refusal only as a bounded, credential-free diagnostic. */--function safePauseMessage(error) {-- const message = String(error.relayMessage ?? error.message ?? 'the relay refused the baseline upload')-- .replace(/https?:\/\/[^\s]+/gu, '[relay]')-- .replace(/\b(?:Bearer\s+)?(?:ps|pa|pm|pg)_[A-Za-z0-9_-]{20,}\b/gu, '[credential]')-- .replace(/[\r\n\t\x00-\x1f\x7f]+/gu, ' ')-- .replace(/\s+/gu, ' ').trim();-- return message.slice(0, 240) || 'the relay refused the baseline upload';--}/** Whether the CLI command will make an ordered move whose refusal should be reported at dispatch. */function orderedMoveCommand(io) {diff --cc test/hosted-shapes.test.jsindex 8576b2b1,86650375..1434e9c6--- a/test/hosted-shapes.test.js+++ b/test/hosted-shapes.test.js@@@ -978,61 -977,74 +978,129 @@@ test('a forced hosted cell failure captassert.match(state.noBoardsYet.text, /No boards yet/u, 'capture records the empty-state text even when hidden');});+test('a board over the size limit is named with its size and the limit, beside a healthy board too [H5,H17]', {+ timeout: 180_000, // budget: real enrollment, refused upload, healthy sibling and bounded-snapshot recovery.+}, async t => {+ assert.ok(hostedEngines().find(engine => engine.name === 'chromium')?.available, 'real Chrome is required');+ const engine = await openEngine('chromium');+ const contexts = [];+ t.after(async () => {+ for (const context of contexts) await context.close();+ await engine.close();+ });+ const box = await relayClientFixture(t);+ box.env.PULLBOARD_MACHINE_HOME = box.env.PULLBOARD_HOME;+ box.legacySnapshotApi(true);+ box.limitSnapshots(128);+ const front = await hostedFront(box.origin);+ t.after(() => front.close());+ const paired = await engine.newContext();+ contexts.push(paired);+ const session = await freshSession(box);+ let page;+ await relayOnAll(box, async link => {+ page = await paired.newPage({ route: front.route(session, null) });+ await page.navigate(link);+ });+ await page.close();+ const link = linkOf(box, box.root);+ const refusal = box.sizeRefusals().find(value => value.board === link.id);+ assert.ok(refusal && refusal.sealedBytes > refusal.limit, 'the configured relay refused an actually oversized upload');+ const local = JSON.parse(readFileSync(join(box.root, '.git', 'pullboard', 'relay.json'), 'utf8'));+ assert.equal(local.baselinePause.status, 400, 'the native command received the permanent upload refusal');+ assert.equal(Buffer.from(local.snapshot.sealed, 'base64url').byteLength, refusal.sealedBytes,+ 'the retained snapshot is exactly the upload measured by the relay');+ const alone = await visit(paired, { route: front.route(session, null), phone: true }, false);+ assert.match(alone.words, /fixture\/repository[^.]*too (?:big|large)/iu, 'name the size blocker rather than a missing first copy');+ assert.ok(alone.words.includes(refusal.sealedBytes + ' bytes'), 'show the measured sealed size');+ assert.ok(alone.words.includes(refusal.limit + ' bytes'), 'show the limit reported by this relay');+ assert.match(alone.words, /upgrade[^.]*relay[^.]*bounded snapshots/iu, 'offer the step that removes the actual limit');++ box.limitSnapshots(null);+ const healthy = await siblingProject(box, 'healthy-sibling', 'fixture/healthy-sibling');+ const healthyLane = Object.keys(JSON.parse(readFileSync(join(healthy, 'pullboard.json'), 'utf8')).lanes)[0];+ assert.equal((await box.cliAt(healthy, 'add', healthyLane, BOARD_ITEM)).code, 0,+ 'the healthy board has the real item required by the unchanged visibility probe');+ assert.equal((await box.cliAt(healthy, 'relay', 'on', '--url', box.origin)).code, 0);+ const mixed = await visit(paired, { route: front.route(session, null), phone: true }, true);+ assert.equal(mixed.board, true, 'the healthy sibling remains readable');+ assert.match(mixed.words, /fixture\/repository[^.]*too (?:big|large)/iu, 'keep the size blocker beside the healthy board');+ assert.ok(mixed.words.includes(refusal.sealedBytes + ' bytes') && mixed.words.includes(refusal.limit + ' bytes'));+ box.legacySnapshotApi(false);+ assert.equal((await box.cli('status')).code, 0, 'the offered bounded-snapshot upgrade actually resumes publication');+ const recovered = await visit(paired, { route: front.route(session, null), phone: true }, true);+ assert.equal(recovered.board, true);+ assert.doesNotMatch(recovered.words, /too (?:big|large)|128 bytes/iu, 'a successful snapshot clears its stale size notice');+});++ test('an excluded board is named as excluded with the step that includes it [H5,H17]', {+ timeout: 180_000, // budget: two real relay setups, one native enrollment and fresh browser visits.+ }, async t => {+ assert.ok(hostedEngines().find(engine => engine.name === 'chromium')?.available, 'real Chrome is required');+ const engine = await openEngine('chromium');+ const contexts = [];+ t.after(async () => {+ // Dispose targets while CDP is live, before shutting down the shared browser.+ for (const context of contexts) await context.close();+ await engine.close();+ });+ const built = await buildBoards(t, 'excluded', [engine]);+ const fresh = await engine.newContext();+ contexts.push(fresh);+ const unpaired = await visit(fresh, {+ route: built.front.route(built.unpairedSession, null), phone: true,+ bootstrap: storedScript('fresh', { boards: [] }),+ }, false);+ assert.equal(unpaired.board, false, 'exclusion never links or discloses the board');+ assert.match(unpaired.words, /1 board excluded/iu, 'a fresh browser sees the actual exclusion count');+ assert.doesNotMatch(unpaired.words, /fixture\/repository/u, 'a browser without a device wrap sees no excluded name');+ assert.ok(unpaired.commands.some(command => /pullboard relay on(?:\s|$)/u.test(command)+ && !/--all/u.test(command)), 'the command includes a board that the completed --all skipped');+ assert.equal(unpaired.commands.some(command => /pullboard relay on --all/u.test(command)), false);++ 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 paired = await engine.newContext();+ contexts.push(paired);+ const session = await freshSession(box);+ let pairingPage;+ await relayOnAll(box, async link => {+ pairingPage = await paired.newPage({ route: front.route(session, null) });+ await pairingPage.navigate(link);+ });+ assert.ok(await pairingPage.poll(`(${READ_SCREEN}).board`, 8_000), 'the genuine enrolled browser opens the healthy board');+ await pairingPage.close();+ const excluded = await siblingProject(box, 'excluded-project', 'fixture/excluded-board');+ assert.equal((await box.cliAt(excluded, 'relay', 'off')).code, 0);+ const metadata = await fetch(box.origin + '/api/v1/devices/exclusions', { headers: { cookie: 'pb_session=' + session } });+ assert.equal(metadata.status, 200);+ const publicInventory = await metadata.json();+ assert.equal(publicInventory.exclusions.length, 1);+ assert.equal(publicInventory.exclusions[0].count, 1);+ assert.ok(publicInventory.exclusions[0].label.trim(), 'only a bounded machine label is public');+ assert.doesNotMatch(JSON.stringify(publicInventory), /fixture\/excluded-board|excluded-project/u,+ 'the relay public inventory contains neither repository names nor local paths');+ const unwrapped = await visit(fresh, { route: front.route(session, null), phone: true }, false);+ assert.doesNotMatch(unwrapped.words, /fixture\/excluded-board/u,+ 'an existing phone-approval notice cannot disclose an excluded name to an unwrapped browser');+ const named = await visit(paired, { route: front.route(session, null), phone: true }, true);+ assert.equal(named.board, true, 'the healthy board remains readable beside the exclusion');+ assert.match(named.words, /fixture\/excluded-board[^.]*excluded/iu, 'only the device-wrapped browser decrypts the excluded name');+ assert.match(named.words, /pullboard relay on/u, 'the named exclusion carries its include command');+ assert.equal((await box.cliAt(excluded, 'relay', 'on', '--url', box.origin)).code, 0,+ 'the offered ordinary command actually includes the excluded board');+ const cleared = await fetch(box.origin + '/api/v1/devices/exclusions', { headers: { cookie: 'pb_session=' + session } });+ assert.equal(cleared.status, 200);+ assert.deepEqual((await cleared.json()).exclusions, [], 'including the board clears its published exclusion');+ assert.equal((await box.cliAt(excluded, 'relay', 'off')).code, 0,+ 'off also publishes from the removed board’s own machine credential');+ const removed = await fetch(box.origin + '/api/v1/devices/exclusions', { headers: { cookie: 'pb_session=' + session } });+ assert.equal(removed.status, 200);+ assert.equal((await removed.json()).exclusions[0]?.count, 1, 'a linked board’s removal publishes without setup or its forgotten board key');+ });+test('a board awaiting a phone approval is mentioned on a non-phone paired browser [H5]', {timeout: 180_000,}, async (t) => {