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): a held capture waits out the view's live updates [N26,C7]
Corey Olson199bcf2e370e
diff --git a/test/cockpit/demo.test.js b/test/cockpit/demo.test.jsindex 2131f0d0..a82cd66a 100644--- a/test/cockpit/demo.test.js+++ b/test/cockpit/demo.test.js@@ -5,7 +5,7 @@ import { request } from 'node:http';import { tmpdir } from 'node:os';import { join } from 'node:path';import { test } from 'node:test';-import { tapTarget, SPEC, machine, project, startView, boardOf, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, press } from './fixture.js';+import { tapTarget, SPEC, machine, project, startView, boardOf, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, press, allowLiveHold, holdLive } from './fixture.js';import { assertFirstStateDelay } from './stable.js';/** Stage real chip clones and retain their node identities to diagnose a redraw between browser evaluations. */@@ -956,13 +956,10 @@ test('a finished lane hold does not scroll after the next press is aimed [N26,C7try {chrome = await openSnapshotChrome(executable, 'about:blank', profile);await chrome.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });- await chrome.send('Page.addScriptToEvaluateOnNewDocument', { source: `- const nativeInterval = window.setInterval.bind(window);- /** Keep this one real refresh under test control; every HTTP response and render remains real. */- window.setInterval = (callback, delay, ...args) => delay === 3000 ? 0 : nativeInterval(callback, delay, ...args);- ` });+ // Keep this one real refresh under test control; every HTTP response and render remains real (#622).+ await allowLiveHold(chrome);await chrome.send('Page.navigate', { url: view.link.href });- await chrome.waitFor('data?.project?.items.some(item => item.title === "Hold control")');+ await holdLive(chrome, 'data?.project?.items.some(item => item.title === "Hold control")');await press(chrome, 'document.querySelector("[data-tab=shouts]")');await chrome.stable(`(() => {const originalRefresh = refresh;diff --git a/test/cockpit/fixture.js b/test/cockpit/fixture.jsindex 423bb8a1..db87dfc5 100644--- a/test/cockpit/fixture.js+++ b/test/cockpit/fixture.js@@ -1036,6 +1036,40 @@ async function tabBar(chrome) {return { client: await chrome.stable('document.documentElement.clientWidth'), layouts };}+/**+ * Let a test hold the view's own live updates while it observes one capture (#622). Since #545 the page re-reads the+ * board on its own three ways: the event-stream catch-up, the fallback read while the stream is down, and the relay's+ * timed read. Held, the catch-up and every timed read that calls refresh() wait; a refresh() the test calls, or an+ * action makes, still reads the board, and every response stays real. Call before the page loads.+ */+async function allowLiveHold(chrome) {+ await chrome.send('Page.addScriptToEvaluateOnNewDocument', { source: `(() => {+ const nativeInterval = window.setInterval.bind(window);+ window.__liveHold = { held: false, skipped: 0 };+ /** A timed read of the board waits while the hold is on; any other interval runs as it would. */+ window.setInterval = (callback, delay, ...args) => typeof callback === 'function' && /\\brefresh\\(/.test(String(callback))+ ? nativeInterval(() => { if (window.__liveHold.held) window.__liveHold.skipped += 1; else callback(); }, delay, ...args)+ : nativeInterval(callback, delay, ...args);+ /** Hold now, but only while no read is out, so no read already started lands after the hold. */+ window.__holdLive = () => {+ if (window.__liveHold.held) return true;+ if (catching || refreshStarted !== refreshDrawn.generation) return false;+ const live = catchUp;+ catchUp = () => { if (window.__liveHold.held) window.__liveHold.skipped += 1; else live(); };+ window.__liveHold.held = true;+ return true;+ };+ })()` });+}++/**+ * Wait until the page shows what ready says and no read is out, and hold its live updates in that same evaluation,+ * so no refresh lands between "ready" and the hold. The page must have been loaded after allowLiveHold.+ */+async function holdLive(chrome, ready, timeoutMs) {+ await chrome.waitFor(`(${ready}) && window.__holdLive()`, timeoutMs);+}+/** Serve a folder under a path prefix, as a static host does, recording each request and its status. */async function serveFolder(folder, prefix) {const requests = [];@@ -1089,4 +1123,4 @@ async function searchFor(chrome, words, timeoutMs) {}}-export { BIN, scratch, chooseFilter, tapTarget, SPEC, machine, project, build, sendBack, fetchReason, fetchView, fetchLive, startView, styleOf, element, ageNodes, target, settle, storage, daysOn, openPage, projectRows, productEntries, timelineRows, agentEntries, drawing, textBoxes, meet, accept, needEntries, itemRow, boardId, boardOf, assertObservationAges, withoutObservationAges, assertObservationsEqual, shoutNameText, chromeExecutable, browserPause, startSnapshotChrome, openSnapshotChrome, stopOwnedChrome, closeSnapshotChrome, watchSpecDecisionWait, earlier, shoutsAt, press, tapTouch, pickProject, travel, pressedInto, settled, roadmapRow, showing, readRoadmap, openRoadmapParts, tabBar, serveFolder, proofShot, searchFor };+export { BIN, scratch, chooseFilter, tapTarget, SPEC, machine, project, build, sendBack, fetchReason, fetchView, fetchLive, startView, styleOf, element, ageNodes, target, settle, storage, daysOn, openPage, projectRows, productEntries, timelineRows, agentEntries, drawing, textBoxes, meet, accept, needEntries, itemRow, boardId, boardOf, assertObservationAges, withoutObservationAges, assertObservationsEqual, shoutNameText, chromeExecutable, browserPause, startSnapshotChrome, openSnapshotChrome, stopOwnedChrome, closeSnapshotChrome, watchSpecDecisionWait, earlier, shoutsAt, press, tapTouch, pickProject, travel, pressedInto, settled, roadmapRow, showing, readRoadmap, openRoadmapParts, tabBar, serveFolder, proofShot, searchFor, allowLiveHold, holdLive };diff --git a/test/cockpit/search.test.js b/test/cockpit/search.test.jsindex 581d3fcd..e99829d0 100644--- a/test/cockpit/search.test.js+++ b/test/cockpit/search.test.js@@ -5,7 +5,7 @@ import { chmodSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'nodimport { tmpdir } from 'node:os';import { join } from 'node:path';import { test } from 'node:test';-import { SPEC, machine, project, startView, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, searchFor, press } from './fixture.js';+import { SPEC, machine, project, startView, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, searchFor, press, allowLiveHold, holdLive } from './fixture.js';/** Capture the current search page and its last real board-state request without exposing the session key. */async function searchSetupState(chrome) {@@ -143,14 +143,11 @@ test('spec rows keep newest-first order across a capture that moves [N26]', { tilet chrome;try {chrome = await openSnapshotChrome(executable, 'about:blank', profile);- // Keep this controlled observation until an explicit real refresh; no API response is substituted.- await chrome.send('Page.addScriptToEvaluateOnNewDocument', { source: `- const nativeInterval = window.setInterval.bind(window);- /** Hold only the automatic board poll while the test observes one complete real response. */- window.setInterval = (callback, delay, ...args) => delay === 3000 ? 0 : nativeInterval(callback, delay, ...args);- ` });+ // Keep this controlled observation until an explicit real refresh; no API response is substituted. The view's own+ // live updates (the stream's catch-up, the fallback read) wait from the moment the board is ready (#622).+ await allowLiveHold(chrome);await chrome.send('Page.navigate', { url: view.link.href });- await chrome.waitFor("data?.project?.spec.some(row => row.id === 'G3') && data.project.practice.some(row => row.id === 'R1')");+ await holdLive(chrome, "data?.project?.spec.some(row => row.id === 'G3') && data.project.practice.some(row => row.id === 'R1')");// A new HEAD invalidates the age cache; R2 is already a visible working edit, as in the CI shape.writeFileSync(join(alpha.repo, 'ways.md'), r1 + r2);writeFileSync(join(alpha.repo, 'capture.txt'), 'The next state captures this commit.\n');