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.

test(view): explain wall-clock budgets [C7]

Corey Olson66f527877431
diff --git a/test/cockpit/fixture.test.js b/test/cockpit/fixture.test.js
index d238ca92..7807d324 100644
--- a/test/cockpit/fixture.test.js
+++ b/test/cockpit/fixture.test.js
@@ -230,7 +230,7 @@ setTimeout(() => {
const started = Date.now();
const chrome = await startSnapshotChrome(delayed, profile);
try {
- assert.ok(Date.now() - started > 10_000, 'the helper waits beyond its former ten-second limit');
+ assert.ok(Date.now() - started > 10_000, 'the helper waits beyond its former ten-second limit'); // budget: the stand-in publishes DevToolsActivePort after 10,100 ms.
assert.equal(chrome.port, '9333');
assert.equal(readFileSync(attempts, 'utf8'), '2', 'the failed first launch is retried exactly once');
} finally {
@@ -286,7 +286,7 @@ test('a Chrome wait whose condition throws while the next document loads keeps p
await chrome.waitFor("document.querySelector('#first')?.textContent === 'first page'");
await chrome.send('Page.navigate', { url: `${origin}/late` });
await chrome.waitFor("document.querySelector('#late').textContent.includes('the late body arrived')");
- await assert.rejects(chrome.waitFor("document.querySelector('#never').textContent === 'never'", 1000),
+ await assert.rejects(chrome.waitFor("document.querySelector('#never').textContent === 'never'", 1000), // budget: 1,000 ms is only a ceiling for an impossible browser condition.
/^Error: Browser condition did not arrive: .*#never.*; it last threw: TypeError: Cannot read properties of null/u);
assert.deepEqual(chrome.exceptions, [], 'a condition that throws is not a page exception');
await chrome.send('Page.navigate', { url: `${origin}/fault` });
diff --git a/test/cockpit/items.test.js b/test/cockpit/items.test.js
index 0af51563..32a365df 100644
--- a/test/cockpit/items.test.js
+++ b/test/cockpit/items.test.js
@@ -913,7 +913,7 @@ test('Pipeline view shows every stage, status counts, stage ages, detail links a
assert.ok(stage.age.length > 0, stage.stage + ': visible elapsed age');
assert.match(stage.age, /^\d+(m|h)$/, stage.stage + ': a visible elapsed time');
const elapsed = parseInt(stage.age, 10) * (stage.age.endsWith('h') ? 60 : 1);
- assert.ok(Math.abs(elapsed - (observedAt - Date.parse(since)) / 60_000) <= 1, stage.stage + ': elapsed time matches native fixture arrival');
+ assert.ok(Math.abs(elapsed - (observedAt - Date.parse(since)) / 60_000) <= 1, stage.stage + ': elapsed time matches native fixture arrival'); // budget: one minute is the display's measured-age rounding unit.
}
assert.equal(await chrome.stable("document.querySelector('#item-list').hidden"), true);
for (const width of [375, 1280]) {
diff --git a/test/cockpit/snapshot.test.js b/test/cockpit/snapshot.test.js
index 28492b32..b7c80b18 100644
--- a/test/cockpit/snapshot.test.js
+++ b/test/cockpit/snapshot.test.js
@@ -165,15 +165,32 @@ test('static export stays in its prefix and replays read-only in Chrome [A10,A3]
await browserPause(180);
assert.equal(await evaluate('snapshotReplay.index'), pausedIndex, 'a paused replay does not advance');
- await evaluate("const speed = document.querySelector('#replay-speed'); speed.value = '16'; speed.dispatchEvent(new Event('change', { bubbles: true }))");
+ await evaluate("(() => { const speed = document.querySelector('#replay-speed'); speed.value = '1'; speed.dispatchEvent(new Event('change', { bubbles: true })); })()");
+ assert.equal(await evaluate("document.querySelector('#replay-speed').value"), '1');
+ await chrome.click("document.querySelector('#replay-play')");
+ await chrome.waitFor('!snapshotReplay.playing', 30_000); // budget: hang-only ceiling for the complete 1x replay.
+ assert.equal(await evaluate('snapshotReplay.playing'), false, 'the 1x replay reaches its end');
+ const normalStart = 0;
+ assert.ok(normalStart + 4 < initial.total, 'at least four events remain to measure 1x playback');
+ const normalStartedAt = Date.now();
+ await chrome.click("document.querySelector('#replay-play')");
+ await chrome.waitFor(`snapshotReplay.index >= ${normalStart + 4}`, 10_000); // budget: hang-only ceiling for the measured four-event sample.
+ const normalFourEventMs = Date.now() - normalStartedAt;
+ assert.ok(normalFourEventMs > 0, '1x playback advances four events in measurable time');
+ await chrome.waitFor('!snapshotReplay.playing', 30_000); // budget: hang-only ceiling for the complete 1x replay.
+ assert.equal(await evaluate('snapshotReplay.playing'), false, 'the 1x replay reaches its end');
+
+ await evaluate("(() => { const speed = document.querySelector('#replay-speed'); speed.value = '16'; speed.dispatchEvent(new Event('change', { bubbles: true })); })()");
assert.equal(await evaluate("document.querySelector('#replay-speed').value"), '16');
- const speedStart = await evaluate('snapshotReplay.index');
+ const speedStart = 0; // Play from the completed 1x run restarts at the first event.
assert.ok(speedStart + 4 < initial.total, 'at least four events remain to measure 16x playback');
const speedStartedAt = Date.now();
await chrome.click("document.querySelector('#replay-play')");
- await chrome.waitFor(`snapshotReplay.index >= ${speedStart + 4}`, 2_000);
- assert.ok(Date.now() - speedStartedAt < 2_000, '16x advances four replay events within two seconds');
- await chrome.waitFor('!snapshotReplay.playing', 20_000);
+ await chrome.waitFor(`snapshotReplay.index >= ${speedStart + 4}`, 10_000); // budget: hang-only ceiling for the measured four-event sample.
+ const speedFourEventMs = Date.now() - speedStartedAt;
+ assert.ok(speedFourEventMs * 4 < normalFourEventMs,
+ `16x advances four events at least four times faster than measured 1x (${speedFourEventMs}ms vs ${normalFourEventMs}ms)`);
+ await chrome.waitFor('!snapshotReplay.playing', 30_000); // budget: hang-only ceiling for the complete 16x replay.
assert.equal(await evaluate('snapshotReplay.playing'), false, 'the replay reaches its end');
const renderedStates = JSON.parse(await evaluate('JSON.stringify(window.__replayObserved.map((entry) => entry.status))'));
const distinctStates = renderedStates.filter((state, index) => index === 0 || state !== renderedStates[index - 1]);