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
test(view): journey routing moves to its own module [N40]
Corey Olson01957db15095
diff --git a/test/cockpit/journey-routes.js b/test/cockpit/journey-routes.jsnew file mode 100644index 00000000..4491866f--- /dev/null+++ b/test/cockpit/journey-routes.js@@ -0,0 +1,157 @@+/**+ * The hosted journeys' browser routing (#935): which owned server answers each request the journey's Chrome makes, and+ * which failed interceptions are reads the journey itself orphaned by navigating. Shared by test/journeys.test.js and+ * the routing control in test/cockpit/journey-routes.test.js.+ */+import assert from 'node:assert/strict';+import { fetchLive } from './fixture.js';++export const JOURNEY_HOSTED = 'https://app.pullboard.dev';+export const JOURNEY_LOCAL = 'http://127.0.0.1:4890';++/** Normalize only resource identifiers in API paths before retaining bounded fixture diagnostics. */+export function journeyApiPathKind(pathname) {+ const names = new Set(['api', 'v1', 'boards', 'state', 'events', 'moves', 'items', 'shouts', 'answers', 'devices', 'session', 'enrollments', 'approvals', 'requests', 'keys']);+ return pathname.split('/').map(part => !part || names.has(part) ? part : ':id').join('/');+}++/**+ * The headers a hosted request is forwarded with. Chrome can pause a request before its network stack attaches+ * cookies, so the paused headers may lack pb_session (#835; chromium-bidi met the same, wpt PR 63104): a missing+ * Cookie header is restored from Chrome's jar for the request's URL. With the CI condition armed, an API request's+ * paused Cookie header is dropped first: on CI the page loaded signed in, then its API reads answered 401. Each API pause records which case it was, never a value.+ *+ * @param {object} chrome - The browser B connection.+ * @param {{url: string, headers: object}} asked - The paused request.+ * @param {{cookieless?: boolean}|null} condition - The CI stand-in, if any.+ * @param {object[]} pauses - Bounded record of API pauses: path kind and 'paused', 'restored' or 'none'.+ */+export async function journeyForwardHeaders(chrome, asked, condition, pauses) {+ const address = new URL(asked.url);+ const api = address.pathname.startsWith('/api/');+ let headers = Object.entries(asked.headers).filter(([name]) => !['host', 'content-length'].includes(name.toLowerCase()));+ if (condition?.cookieless && api) headers = headers.filter(([name]) => name.toLowerCase() !== 'cookie');+ const paused = headers.some(([name]) => name.toLowerCase() === 'cookie');+ let restored = false;+ if (!paused) {+ const { cookies } = await chrome.send('Network.getCookies', { urls: [asked.url] });+ if (cookies.length > 0) { headers.push(['Cookie', cookies.map(({ name, value }) => name + '=' + value).join('; ')]); restored = true; }+ }+ if (api && pauses.length < 128) {+ pauses.push({ pathKind: journeyApiPathKind(address.pathname), cookie: paused ? 'paused' : restored ? 'restored' : 'none' });+ }+ return headers;+}++/**+ * Whether a retired interception (Invalid InterceptionId) is an API read this journey orphaned by navigating the page+ * away (#935). The old document keeps reading until the new one commits, and Chrome then retires its paused requests+ * without a loadingFailed. Only an /api/ request that paused before a main-frame commit the harness's own navigation+ * caused qualifies; anything else is a real routing failure.+ *+ * @param {string} url - The paused request's URL.+ * @param {number} pausedAt - When it paused (performance.now()).+ * @param {number[]} commits - Main-frame commits seen after the harness's first navigation (performance.now()).+ */+export function journeyNavigationOrphan(url, pausedAt, commits) {+ return new URL(url).pathname.startsWith('/api/') && commits.some((committedAt) => committedAt > pausedAt);+}++/**+ * Fulfill only the hosted document/assets; rewrite live API and local requests to owned HTTP servers. With `slow`+ * armed, the next discovery read of this machine's view answers only after `slow.ms`, once: the CI condition (#786),+ * where a macOS runner's first local answer outlasted the page's three-second wait. Off unless a test arms it.+ *+ * @param {{armed: boolean, ms: number, cookieless?: boolean}|null} [slow] - The stand-in for a slow first discovery answer.+ * @param {object[]} [pauses] - Receives each hosted API pause's cookie case (see journeyForwardHeaders).+ * @returns {Promise<(() => Promise<void>) & {navigate: (url: string) => Promise<void>}>} The stop check, and the only way this journey navigates the page.+ */+export async function routeJourneyOrigins(chrome, site, view, slow = null, pauses = []) {+ const failures = [];+ const orphaned = [];+ const retired = [];+ const commits = [];+ const tasks = [];+ let navigatedAt = -Infinity;+ const listener = ({ data }) => {+ const message = JSON.parse(String(data));+ // A main-frame commit after the harness navigated replaces the document whose paused reads Chrome then retires.+ if (message.method === 'Page.frameNavigated' && !message.params.frame?.parentId && Number.isFinite(navigatedAt)) commits.push(performance.now());+ if (message.method !== 'Fetch.requestPaused') return;+ const pausedAt = performance.now();+ tasks.push((async () => {+ const { requestId, request: asked } = message.params;+ const address = new URL(asked.url);+ if (address.origin === JOURNEY_HOSTED && address.pathname.startsWith('/api/')) {+ // Every hosted API request goes on to the owned site, as live streams always did. Answering one by hand raced+ // the browser for paged object reads, which then failed at Fetch.fulfillRequest with Invalid InterceptionId (#935).+ const headers = (await journeyForwardHeaders(chrome, asked, slow, pauses)).map(([name, value]) => ({ name, value }));+ await chrome.send('Fetch.continueRequest', {+ requestId, url: site.base + address.pathname + address.search, headers,+ });+ return;+ }+ if (address.origin === JOURNEY_LOCAL) {+ if (slow?.armed && address.pathname === '/local/protocol') {+ slow.armed = false;+ await new Promise((later) => setTimeout(later, slow.ms)); // budget: the stand-in's one slow answer, longer than the page's 3 s wait; no throughput claim.+ // By now the page has stopped waiting and Chrome has dropped the request, so the late answer has nowhere to go.+ try { await chrome.send('Fetch.continueRequest', { requestId, url: view.base + address.pathname + address.search }); } catch { /* the request the page gave up on */ }+ return;+ }+ await chrome.send('Fetch.continueRequest', { requestId, url: view.base + address.pathname + address.search });+ return;+ }+ if (address.origin !== JOURNEY_HOSTED) throw new Error('unexpected fixture browser origin');+ const headers = Object.fromEntries(await journeyForwardHeaders(chrome, asked, slow, pauses));+ const response = await fetchLive(site.base + address.pathname + address.search, {+ method: asked.method, headers, redirect: 'manual',+ ...(asked.postData === undefined ? {} : { body: asked.postData }),+ signal: AbortSignal.timeout(10_000),+ });+ const body = Buffer.from(await response.arrayBuffer());+ await chrome.send('Fetch.fulfillRequest', {+ requestId,+ responseCode: response.status,+ responseHeaders: [...response.headers]+ .filter(([name]) => !['content-length', 'connection', 'transfer-encoding', 'keep-alive', 'date'].includes(name.toLowerCase()))+ .map(([name, value]) => ({ name, value })),+ body: body.toString('base64'),+ });+ })().catch(async (error) => {+ // A request paused before this harness navigated the page away is dropped with its document, and Chrome+ // retires its interception without a loadingFailed. Only that case is set aside; every other error stays a failure (#935).+ // Name the request without its query or ids, and when it paused against the last navigation, so a failure is diagnosable.+ const asked = new URL(message.params.request.url);+ const kind = asked.pathname.startsWith('/api/') ? journeyApiPathKind(asked.pathname) : asked.origin === JOURNEY_LOCAL ? 'local' : 'page';+ const since = Number.isFinite(navigatedAt) ? Math.round(pausedAt - navigatedAt) + ' ms after the last navigation' : 'before any navigation';+ const failure = `${error.message} (${message.params.request.method} ${kind}, ${message.params.resourceType}, paused ${since})`;+ // A retired interception is judged at stop, once every document commit is known: the commit can arrive after the error.+ if (/Invalid InterceptionId/u.test(error.message)) retired.push({ url: message.params.request.url, pausedAt, kind, failure });+ else failures.push(failure);+ try { await chrome.send('Fetch.failRequest', { requestId: message.params.requestId, errorReason: 'Failed' }); } catch { /* Chrome may already have closed. */ }+ }));+ };+ chrome.socket.addEventListener('message', listener);+ await chrome.send('Fetch.enable', { patterns: [+ { urlPattern: JOURNEY_HOSTED + '/*', requestStage: 'Request' },+ { urlPattern: JOURNEY_LOCAL + '/*', requestStage: 'Request' },+ ] });+ /** Stop routing and require that no request failed, other than API reads this harness's own navigation orphaned. */+ const stop = async () => {+ chrome.socket.removeEventListener('message', listener);+ await Promise.all(tasks);+ await chrome.send('Fetch.disable');+ for (const entry of retired) {+ if (journeyNavigationOrphan(entry.url, entry.pausedAt, commits)) { if (orphaned.length < 64) orphaned.push(entry.kind); }+ else failures.push(entry.failure);+ }+ assert.deepEqual(failures, [], `owned hosted and loopback HTTP routes finish without cancelling event streams (orphaned by navigation: ${JSON.stringify(orphaned)})`);+ };+ /** Navigate the page, marking the moment so requests already paused for the old document are known as orphaned. */+ stop.navigate = async (url) => {+ navigatedAt = performance.now();+ await chrome.send('Page.navigate', { url });+ };+ return stop;+}diff --git a/test/cockpit/journey-routes.test.js b/test/cockpit/journey-routes.test.jsnew file mode 100644index 00000000..13540e7f--- /dev/null+++ b/test/cockpit/journey-routes.test.js@@ -0,0 +1,41 @@+/** The hosted journeys' routing sets aside only the reads its own navigation orphaned [N40,N26]. */+import assert from 'node:assert/strict';+import { test } from 'node:test';+import {+ JOURNEY_HOSTED,+ journeyNavigationOrphan,+ routeJourneyOrigins,+} from './journey-routes.js';++/** A stand-in Chrome whose every Fetch.continueRequest answers Invalid InterceptionId, as a retired interception does. */+function retiredInterceptionChrome() {+ const socket = new EventTarget();+ const send = async (method) => {+ if (method === 'Network.getCookies') return { cookies: [] };+ if (method === 'Fetch.continueRequest') throw new Error('{"code":-32602,"message":"Invalid InterceptionId."}');+ // The new document commits as Chrome reports it: a main-frame frameNavigated after the navigation was asked for.+ if (method === 'Page.navigate') queueMicrotask(() => socket.dispatchEvent(new MessageEvent('message', { data: JSON.stringify({ method: 'Page.frameNavigated', params: { frame: { id: 'main' } } }) })));+ return {};+ };+ const pause = (id) => socket.dispatchEvent(new MessageEvent('message', { data: JSON.stringify({ method: 'Fetch.requestPaused',+ params: { requestId: id, resourceType: 'XHR', request: { url: JOURNEY_HOSTED + '/api/v2/boards/b/objects/' + id, method: 'GET', headers: {} } } }) }));+ return { socket, send, pause };+}++test('only an API read paused before the journey\'s navigation commits is set aside as orphaned [N40,N26]', async () => {+ const site = { base: 'http://127.0.0.1:9' };+ const before = retiredInterceptionChrome();+ const orphanRoute = await routeJourneyOrigins(before, site, site);+ before.pause('paused-before');+ await orphanRoute.navigate('about:blank');+ await orphanRoute();+ // The control: the same retired interception, paused after the new document committed, is a routing failure the journey reports.+ const after = retiredInterceptionChrome();+ const failingRoute = await routeJourneyOrigins(after, site, site);+ await failingRoute.navigate('about:blank');+ after.pause('paused-after');+ await assert.rejects(failingRoute(), (error) => /Invalid InterceptionId/u.test(error.message) && /orphaned by navigation: \[\]/u.test(error.message));+ assert.equal(journeyNavigationOrphan(JOURNEY_HOSTED + '/index.html', 1, [2]), false, 'a page asset is never an orphan');+ assert.equal(journeyNavigationOrphan(JOURNEY_HOSTED + '/api/v1/boards', 3, [2]), false, 'a read that paused after the commit is not an orphan');+ assert.equal(journeyNavigationOrphan(JOURNEY_HOSTED + '/api/v1/boards', 1, []), false, 'without a commit nothing is an orphan');+});diff --git a/test/journeys.test.js b/test/journeys.test.jsindex 93cd5fa9..3400a4ea 100644--- a/test/journeys.test.js+++ b/test/journeys.test.js@@ -13,10 +13,14 @@ import { startFixtureChild } from './fixture-child.js';import { apiStatus } from '../src/api-http.js';import { NEXT_STEPS } from '../src/next-steps.js';import { chromeHealth, networkServicePids } from './cockpit/chrome-health.js';+import {+ JOURNEY_HOSTED,+ JOURNEY_LOCAL,+ journeyApiPathKind,+ routeJourneyOrigins,+} from './cockpit/journey-routes.js';import { machine, project, startView, fetchLive, openSnapshotChrome, closeSnapshotChrome, press, pickProject, chromeExecutable, boardOf } from './cockpit/fixture.js';-const JOURNEY_HOSTED = 'https://app.pullboard.dev';-const JOURNEY_LOCAL = 'http://127.0.0.1:4890';const JOURNEY_BOARD_NAMES = ['fixture/repository', 'local-machine-b'];const CLI = resolve(import.meta.dirname, '../bin/pullboard.js');@@ -65,12 +69,6 @@ async function stopRelayAll(run) {await run.done.catch(() => {});}-/** Normalize only resource identifiers in API paths before retaining bounded fixture diagnostics. */-function journeyApiPathKind(pathname) {- const names = new Set(['api', 'v1', 'boards', 'state', 'events', 'moves', 'items', 'shouts', 'answers', 'devices', 'session', 'enrollments', 'approvals', 'requests', 'keys']);- return pathname.split('/').map(part => !part || names.has(part) ? part : ':id').join('/');-}-/** Keep only the two fixture board names this journey owns; never report arbitrary client names. */function journeyFixtureBoardNames(names) {const allowed = new Set(JOURNEY_BOARD_NAMES);@@ -550,39 +548,6 @@ test('auth trace retains a completed refusal while its body delivery is pending}});-/** A stand-in Chrome whose every Fetch.continueRequest answers Invalid InterceptionId, as a retired interception does. */-function retiredInterceptionChrome() {- const socket = new EventTarget();- const send = async (method) => {- if (method === 'Network.getCookies') return { cookies: [] };- if (method === 'Fetch.continueRequest') throw new Error('{"code":-32602,"message":"Invalid InterceptionId."}');- // The new document commits as Chrome reports it: a main-frame frameNavigated after the navigation was asked for.- if (method === 'Page.navigate') queueMicrotask(() => socket.dispatchEvent(new MessageEvent('message', { data: JSON.stringify({ method: 'Page.frameNavigated', params: { frame: { id: 'main' } } }) })));- return {};- };- const pause = (id) => socket.dispatchEvent(new MessageEvent('message', { data: JSON.stringify({ method: 'Fetch.requestPaused',- params: { requestId: id, resourceType: 'XHR', request: { url: JOURNEY_HOSTED + '/api/v2/boards/b/objects/' + id, method: 'GET', headers: {} } } }) }));- return { socket, send, pause };-}--test('only an API read paused before the journey\'s navigation commits is set aside as orphaned [N40,N26]', async () => {- const site = { base: 'http://127.0.0.1:9' };- const before = retiredInterceptionChrome();- const orphanRoute = await routeJourneyOrigins(before, site, site);- before.pause('paused-before');- await orphanRoute.navigate('about:blank');- await orphanRoute();- // The control: the same retired interception, paused after the new document committed, is a routing failure the journey reports.- const after = retiredInterceptionChrome();- const failingRoute = await routeJourneyOrigins(after, site, site);- await failingRoute.navigate('about:blank');- after.pause('paused-after');- await assert.rejects(failingRoute(), (error) => /Invalid InterceptionId/u.test(error.message) && /orphaned by navigation: \[\]/u.test(error.message));- assert.equal(journeyNavigationOrphan(JOURNEY_HOSTED + '/index.html', 1, [2]), false, 'a page asset is never an orphan');- assert.equal(journeyNavigationOrphan(JOURNEY_HOSTED + '/api/v1/boards', 3, [2]), false, 'a read that paused after the commit is not an orphan');- assert.equal(journeyNavigationOrphan(JOURNEY_HOSTED + '/api/v1/boards', 1, []), false, 'without a commit nothing is an orphan');-});-test('auth refusal protocol bodies decode without exposing invalid payloads [N40]', () => {const value = JSON.stringify({ error: { code: 'AUTH_REQUIRED', message: 'this credential is expired or revoked' } });const expected = { code: 'AUTH_REQUIRED', kind: 'session-expired-or-revoked' };@@ -801,147 +766,6 @@ async function journeyRelaySite(box, localOrigin) {return { server, base: 'http://127.0.0.1:' + server.address().port, apiObservations: () => apiObservations.map(value => ({ ...value })) };}-/**- * The headers a hosted request is forwarded with. Chrome can pause a request before its network stack attaches- * cookies, so the paused headers may lack pb_session (#835; chromium-bidi met the same, wpt PR 63104): a missing- * Cookie header is restored from Chrome's jar for the request's URL. With the CI condition armed, an API request's- * paused Cookie header is dropped first: on CI the page loaded signed in, then its API reads answered 401. Each API pause records which case it was, never a value.- *- * @param {object} chrome - The browser B connection.- * @param {{url: string, headers: object}} asked - The paused request.- * @param {{cookieless?: boolean}|null} condition - The CI stand-in, if any.- * @param {object[]} pauses - Bounded record of API pauses: path kind and 'paused', 'restored' or 'none'.- */-async function journeyForwardHeaders(chrome, asked, condition, pauses) {- const address = new URL(asked.url);- const api = address.pathname.startsWith('/api/');- let headers = Object.entries(asked.headers).filter(([name]) => !['host', 'content-length'].includes(name.toLowerCase()));- if (condition?.cookieless && api) headers = headers.filter(([name]) => name.toLowerCase() !== 'cookie');- const paused = headers.some(([name]) => name.toLowerCase() === 'cookie');- let restored = false;- if (!paused) {- const { cookies } = await chrome.send('Network.getCookies', { urls: [asked.url] });- if (cookies.length > 0) { headers.push(['Cookie', cookies.map(({ name, value }) => name + '=' + value).join('; ')]); restored = true; }- }- if (api && pauses.length < 128) {- pauses.push({ pathKind: journeyApiPathKind(address.pathname), cookie: paused ? 'paused' : restored ? 'restored' : 'none' });- }- return headers;-}--/**- * Whether a retired interception (Invalid InterceptionId) is an API read this journey orphaned by navigating the page- * away (#935). The old document keeps reading until the new one commits, and Chrome then retires its paused requests- * without a loadingFailed. Only an /api/ request that paused before a main-frame commit the harness's own navigation- * caused qualifies; anything else is a real routing failure.- *- * @param {string} url - The paused request's URL.- * @param {number} pausedAt - When it paused (performance.now()).- * @param {number[]} commits - Main-frame commits seen after the harness's first navigation (performance.now()).- */-function journeyNavigationOrphan(url, pausedAt, commits) {- return new URL(url).pathname.startsWith('/api/') && commits.some((committedAt) => committedAt > pausedAt);-}--/**- * Fulfill only the hosted document/assets; rewrite live API and local requests to owned HTTP servers. With `slow`- * armed, the next discovery read of this machine's view answers only after `slow.ms`, once: the CI condition (#786),- * where a macOS runner's first local answer outlasted the page's three-second wait. Off unless a test arms it.- *- * @param {{armed: boolean, ms: number, cookieless?: boolean}|null} [slow] - The stand-in for a slow first discovery answer.- * @param {object[]} [pauses] - Receives each hosted API pause's cookie case (see journeyForwardHeaders).- * @returns {Promise<(() => Promise<void>) & {navigate: (url: string) => Promise<void>}>} The stop check, and the only way this journey navigates the page.- */-async function routeJourneyOrigins(chrome, site, view, slow = null, pauses = []) {- const failures = [];- const orphaned = [];- const retired = [];- const commits = [];- const tasks = [];- let navigatedAt = -Infinity;- const listener = ({ data }) => {- const message = JSON.parse(String(data));- // A main-frame commit after the harness navigated replaces the document whose paused reads Chrome then retires.- if (message.method === 'Page.frameNavigated' && !message.params.frame?.parentId && Number.isFinite(navigatedAt)) commits.push(performance.now());- if (message.method !== 'Fetch.requestPaused') return;- const pausedAt = performance.now();- tasks.push((async () => {- const { requestId, request: asked } = message.params;- const address = new URL(asked.url);- if (address.origin === JOURNEY_HOSTED && address.pathname.startsWith('/api/')) {- // Every hosted API request goes on to the owned site, as live streams always did. Answering one by hand raced- // the browser for paged object reads, which then failed at Fetch.fulfillRequest with Invalid InterceptionId (#935).- const headers = (await journeyForwardHeaders(chrome, asked, slow, pauses)).map(([name, value]) => ({ name, value }));- await chrome.send('Fetch.continueRequest', {- requestId, url: site.base + address.pathname + address.search, headers,- });- return;- }- if (address.origin === JOURNEY_LOCAL) {- if (slow?.armed && address.pathname === '/local/protocol') {- slow.armed = false;- await new Promise((later) => setTimeout(later, slow.ms)); // budget: the stand-in's one slow answer, longer than the page's 3 s wait; no throughput claim.- // By now the page has stopped waiting and Chrome has dropped the request, so the late answer has nowhere to go.- try { await chrome.send('Fetch.continueRequest', { requestId, url: view.base + address.pathname + address.search }); } catch { /* the request the page gave up on */ }- return;- }- await chrome.send('Fetch.continueRequest', { requestId, url: view.base + address.pathname + address.search });- return;- }- if (address.origin !== JOURNEY_HOSTED) throw new Error('unexpected fixture browser origin');- const headers = Object.fromEntries(await journeyForwardHeaders(chrome, asked, slow, pauses));- const response = await fetchLive(site.base + address.pathname + address.search, {- method: asked.method, headers, redirect: 'manual',- ...(asked.postData === undefined ? {} : { body: asked.postData }),- signal: AbortSignal.timeout(10_000),- });- const body = Buffer.from(await response.arrayBuffer());- await chrome.send('Fetch.fulfillRequest', {- requestId,- responseCode: response.status,- responseHeaders: [...response.headers]- .filter(([name]) => !['content-length', 'connection', 'transfer-encoding', 'keep-alive', 'date'].includes(name.toLowerCase()))- .map(([name, value]) => ({ name, value })),- body: body.toString('base64'),- });- })().catch(async (error) => {- // A request paused before this harness navigated the page away is dropped with its document, and Chrome- // retires its interception without a loadingFailed. Only that case is set aside; every other error stays a failure (#935).- // Name the request without its query or ids, and when it paused against the last navigation, so a failure is diagnosable.- const asked = new URL(message.params.request.url);- const kind = asked.pathname.startsWith('/api/') ? journeyApiPathKind(asked.pathname) : asked.origin === JOURNEY_LOCAL ? 'local' : 'page';- const since = Number.isFinite(navigatedAt) ? Math.round(pausedAt - navigatedAt) + ' ms after the last navigation' : 'before any navigation';- const failure = `${error.message} (${message.params.request.method} ${kind}, ${message.params.resourceType}, paused ${since})`;- // A retired interception is judged at stop, once every document commit is known: the commit can arrive after the error.- if (/Invalid InterceptionId/u.test(error.message)) retired.push({ url: message.params.request.url, pausedAt, kind, failure });- else failures.push(failure);- try { await chrome.send('Fetch.failRequest', { requestId: message.params.requestId, errorReason: 'Failed' }); } catch { /* Chrome may already have closed. */ }- }));- };- chrome.socket.addEventListener('message', listener);- await chrome.send('Fetch.enable', { patterns: [- { urlPattern: JOURNEY_HOSTED + '/*', requestStage: 'Request' },- { urlPattern: JOURNEY_LOCAL + '/*', requestStage: 'Request' },- ] });- /** Stop routing and require that no request failed, other than API reads this harness's own navigation orphaned. */- const stop = async () => {- chrome.socket.removeEventListener('message', listener);- await Promise.all(tasks);- await chrome.send('Fetch.disable');- for (const entry of retired) {- if (journeyNavigationOrphan(entry.url, entry.pausedAt, commits)) { if (orphaned.length < 64) orphaned.push(entry.kind); }- else failures.push(entry.failure);- }- assert.deepEqual(failures, [], `owned hosted and loopback HTTP routes finish without cancelling event streams (orphaned by navigation: ${JSON.stringify(orphaned)})`);- };- /** Navigate the page, marking the moment so requests already paused for the old document are known as orphaned. */- stop.navigate = async (url) => {- navigatedAt = performance.now();- await chrome.send('Page.navigate', { url });- };- return stop;-}-/*** The two-home hosted journey: machine A links a board through the relay, and machine B's browser at pullboard.dev* lists it beside B's own local board. With `slow`, B's first discovery read on that last visit answers late.