Skip to content

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.

fix(view): linked-board reads declare the relay engine [N26,H5,H18]

Corey Olson1d12f8a1a5fc
diff --git a/src/cockpit.js b/src/cockpit.js
index 7f358aef..86d843e0 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -985,13 +985,20 @@ async function jsonRequest(path, body, base, headers, cache) {
return json;
}
+let relayEngine = null;
+/** The account's linked boards: a same-origin read that declares the relay's engine, as every relay request does. */
+async function linkedList() {
+ relayEngine ??= await import('/relay/engine.js').then((engine) => String(engine.ENGINE_VERSION), () => '');
+ return jsonRequest('/api/v1/boards', undefined, '', relayEngine ? { 'x-pullboard-engine': relayEngine } : {}, 'no-store');
+}
+
/**
* Whether the signed-in person's linked boards name one this machine's list lacks: only then does the page need the
* decrypting relay client. The metadata is a same-origin cookie-authenticated read, with none of this machine's local
* credential.
*/
async function linkedBoardMissing(localIds) {
- const linked = await jsonRequest('/api/v1/boards', undefined, '', {}, 'no-store');
+ const linked = await linkedList();
return Boolean(linked.boards?.some(board => typeof board.id === 'string' && /^[0-9a-f]{32}$/.test(board.id) && typeof board.repository === 'string' && !localIds.has(board.id)));
}
@@ -1055,7 +1062,7 @@ async function hostedListed(boards) {
// An empty local view can still leave linked boards on another computer waiting for this browser to pair.
if (!hosted.relaySession || !['', 'not-running', 'no-linked', 'unpaired'].includes(shown)) return;
let linked;
- try { linked = await jsonRequest('/api/v1/boards', undefined, '', {}, 'no-store'); } catch { return; /* the relay's banner says why */ }
+ try { linked = await linkedList(); } catch { return; /* the relay's banner says why */ }
const names = (linked.boards || []).filter((board) => typeof board.repository === 'string').map((board) => board.repository);
localNote(names.length ? 'unpaired' : 'no-linked', { linked: names });
}
diff --git a/test/cockpit/local-origin.test.js b/test/cockpit/local-origin.test.js
index b731ed9e..1fbda21b 100644
--- a/test/cockpit/local-origin.test.js
+++ b/test/cockpit/local-origin.test.js
@@ -323,7 +323,7 @@ test('a signed-in local view with linked metadata and no paired transport says h
await chrome.send('Page.navigate', { url: HOSTED + '/' });
// Wait for all independent authorities to finish, then make the state assertion directly. The condition does not
// wait for an unpaired label; loading must finish before the semantic assertion, including the final metadata read.
- await chrome.waitFor(`location.origin === 'https://app.pullboard.dev' && sessionStorage.getItem('pullboard.local.session') && (window.__749fetches || []).some((x) => x.origin === ${JSON.stringify(view.base)} && x.path === '/api/v1/boards' && x.status === 200) && (window.__749fetches || []).some((x) => x.origin === 'https://app.pullboard.dev' && x.path === '/api/v1/boards' && x.status === 200) && window.__749transportListCalls >= 1 && !document.body.classList.contains('loading')`, 30_000); // budget: local discovery, round trip, local list, linked metadata, and empty paired transport.
+ await chrome.waitFor(`location.origin === 'https://app.pullboard.dev' && sessionStorage.getItem('pullboard.local.session') && (window.__749fetches || []).some((x) => x.origin === ${JSON.stringify(view.base)} && x.path === '/api/v1/boards' && x.status === 200) && (window.__749fetches || []).some((x) => x.origin === 'https://app.pullboard.dev' && x.path === '/api/v1/boards' && x.status === 200) && window.__749transportListCalls >= 1 && !document.body.classList.contains('loading')`, 30_000); // budget: hang ceiling for local discovery, the round trip, the local list, linked metadata and the empty paired list.
const seen = JSON.parse(await chrome.stable(`JSON.stringify({
state: document.querySelector('#local-note')?.dataset.state ?? null,
hidden: document.querySelector('#local-note')?.hidden ?? true,