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(cockpit): reconcile landed view contracts [N26,A10]
Corey Olsonbc718da55e4a
diff --git a/test/cockpit/activity.test.js b/test/cockpit/activity.test.jsindex 91f70b40..3e7fd96e 100644--- a/test/cockpit/activity.test.js+++ b/test/cockpit/activity.test.js@@ -130,15 +130,17 @@ test("the history is a timeline of the item's states [N26]", async () => {assert.deepEqual(done.map((row) => [row.dot, row.event]), [['tl-open', 'add coordinator (unknown)'],['tl-claimed', 'claim web-1 (Test Model)'],+ ['tl-claimed tl-quiet', 'proof-run web-1 (Test Model)'],['tl-submitted', 'submit web-1 (Test Model)'],['tl-open tl-back', 'reject coordinator (unknown)'],['tl-claimed', 'claim web-1 (Test Model)'],+ ['tl-claimed tl-quiet', 'proof-run web-1 (Test Model)'],['tl-submitted', 'submit web-1 (Test Model)'],['tl-verified', 'accept coordinator (unknown)'],['tl-verified tl-quiet', 'merged coordinator (unknown)'],], 'a dot per event in the colour of the state it led to; a merge moves nothing');- assert.deepEqual(done.map((row) => row.stay.replace(/ for .*/, ' for')), ['open for', 'claimed for', 'submitted for', 'sent back for', 'claimed for', 'submitted for', verifiedIsFinal ? '' : 'verified for', ''], 'each stay until the next move; a final state has none and a quiet merge stays untimed');- assert.ok(done.slice(0, 6).every((row) => / for (under a minute|\d+m)$/.test(row.stay)), done.map((row) => row.stay).join(', '));+ assert.deepEqual(done.map((row) => row.stay.replace(/ for .*/, ' for')), ['open for', 'claimed for', '', 'submitted for', 'sent back for', 'claimed for', '', 'submitted for', verifiedIsFinal ? '' : 'verified for', ''], 'each stay until the next move; a final state has none and quiet proof receipts and merge stay untimed');+ assert.ok(done.filter(row => !row.dot.includes('tl-quiet')).slice(0, 6).every((row) => / for (under a minute|\d+m)$/.test(row.stay)), done.map((row) => row.stay).join(', '));assert.ok(done.every((row) => /^\d\d:\d\d$/.test(row.time)), 'every event keeps its time');await page.click({ go: 'item:2' });@@ -395,7 +397,7 @@ test('times say which day they were [N26]', async () => {assert.ok(bare(times(later.show('activity'))), 'activity rows keep the clock time');assert.deepEqual(ages(later.show('feed')).map(([age, clock]) => [age, new RegExp(`^${date} \\d\\d:\\d\\d$`).test(clock)]), [['2d ago', true]], 'a shout says how long ago, with its date and time on hover');const history = times(later.show('detail'));- assert.ok(history.length === 3 && history.every((time) => new RegExp(`^${date} \\d\\d:\\d\\d$`).test(time)), `the history dates each move: ${history}`);+ assert.ok(history.length === 4 && history.every((time) => new RegExp(`^${date} \\d\\d:\\d\\d$`).test(time)), `the history dates every move including its proof receipt: ${history}`);// A heading wherever the day changes, and only there.const at = (day, hour) => new Date(2026, 9, day, hour).toISOString();diff --git a/test/cockpit/detail.test.js b/test/cockpit/detail.test.jsindex ba1256db..86ccd284 100644--- a/test/cockpit/detail.test.js+++ b/test/cockpit/detail.test.js@@ -99,7 +99,7 @@ test('opening an item loads its detail on demand [N26,A2]', { timeout: 150_000 }await chrome.waitFor("view.item === 2 && !document.querySelector('#detail [aria-busy]') && !!document.querySelector('#detail .tl')");const farewell = await chrome.stable(DETAIL);assert.equal(farewell.criterion, 'The farewell mentions the zeppelin.');- assert.deepEqual(farewell.moves, ['add', 'claim', 'submit']);+ assert.deepEqual(farewell.moves, ['add', 'claim', 'proof-run', 'submit']);assert.deepEqual(itemReads(await chrome.stable('window.__pbReads')), ['items?q=zeppelin', 'items/2'], 'opening an item makes exactly one detail request');// The verified item opens with its criterion, check, brief, verdicts and thread from one more request.@@ -116,7 +116,7 @@ test('opening an item loads its detail on demand [N26,A2]', { timeout: 150_000 }check: ['true', 'green'],brief: 'Keep the greeting short.',verdicts: [['REJECT', 'the first greeting needs a correction'], ['ACCEPT', 'the page shows it']],- moves: ['add', 'claim', 'submit', 'reject', 'claim', 'submit', 'accept'],+ moves: ['add', 'claim', 'proof-run', 'submit', 'reject', 'claim', 'proof-run', 'submit', 'accept'],facts: ['The corrected greeting renders offline.'],}, 'the detail carries what the summary leaves out');assert.deepEqual(itemReads(await chrome.stable('window.__pbReads')), ['items?q=zeppelin', 'items/2', 'items/1']);diff --git a/test/cockpit/fixture.js b/test/cockpit/fixture.jsindex 245729ef..5ffaa67c 100644--- a/test/cockpit/fixture.js+++ b/test/cockpit/fixture.js@@ -542,7 +542,7 @@ function drawing(svg) {})),routes: [...svg.matchAll(/<g><title>([^<]*)<\/title><path class="edge([^"]*)" d="([^"]*)"[^>]*\/>((?:<text class="tag[^"]*"[^>]*>[^<]*<\/text>)*)<\/g>/g)].map((match) => ({title: match[1],- pair: /^\w+, (\w+) to (\w+),/.exec(match[1]).slice(1).join('>'),+ pair: /^[\w-]+, (\w+) to (\w+),/.exec(match[1]).slice(1).join('>'),back: match[2] === ' back',points: [...match[3].matchAll(/([\d.]+) ([\d.]+)/g)].map((point) => [Number(point[1]), Number(point[2])]),label: match[4] ? [...match[4].matchAll(/>([^<]*)<\/text>/g)].map((line) => line[1]).join(' · ') + (match[4].includes(' idle') ? ' (none yet)' : '') : null,diff --git a/test/cockpit/fixture.test.js b/test/cockpit/fixture.test.jsindex e3d9cdc3..f592703f 100644--- a/test/cockpit/fixture.test.js+++ b/test/cockpit/fixture.test.js@@ -174,7 +174,11 @@ test('borrowed board presentation keeps parity, shows staged rows, and leaves thtry {importBoard(staged, exportBoard(source));const ordinary = projectState(p.repo);- assert.deepEqual(projectState(p.repo, { board: staged }), ordinary, 'borrowed and ordinary projections share the same fields and values');+ assert.ok(ordinary.agents.every(agent => agent.presence === 'live' && typeof agent.heartbeatAt === 'string'),+ 'real native fixture heartbeats remain visible beside the durable board');+ const borrowed = projectState(p.repo, { board: staged });+ assert.deepEqual(borrowed, { ...ordinary, agents: ordinary.agents.map(agent => ({ ...agent, heartbeatAt: null, presence: 'gone' })) },+ 'borrowed projection preserves every durable field; an in-memory import has no native presence sidecar');const before = exportBoard(source);const stagedId = addItem(staged, { by: 'coordinator', lane: 'web', title: 'Staged recovery row', criterion: 'visible only in staged snapshot' });const stagedState = projectState(p.repo, { board: staged });diff --git a/test/cockpit/perf/generate.mjs b/test/cockpit/perf/generate.mjsindex ae06e8f0..558ad36a 100644--- a/test/cockpit/perf/generate.mjs+++ b/test/cockpit/perf/generate.mjs@@ -1,5 +1,6 @@/** Deterministically seed a disposable Pullboard board through its public board operations. */import { createHash } from 'node:crypto';+import assert from 'node:assert/strict';import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { basename, dirname, join, resolve } from 'node:path';@@ -12,6 +13,8 @@ import {register, reopen, shout, verify, withdraw,} from '../../../src/board.js';import { submitFixture } from '../../board-submit-fixture.js';+import { appliedSequence, applyEngineMove } from '../../../src/engine.js';+import { PROOF_RUN_ENGINE } from '../../../src/proof-run-engine.js';const ROOT = resolve(import.meta.dirname, '../../..');const BIN = join(ROOT, 'bin', 'pullboard.js');@@ -27,6 +30,14 @@ function digest(seed, ...parts) {return createHash('sha256').update(JSON.stringify([seed, ...parts])).digest('hex');}+/** Retain the long historical stress corpus through real pre-limit replay, without relaxing current writes. */+function historicalShout(board, { seed, index, from, text }) {+ const move = { version: 1, engine: PROOF_RUN_ENGINE - 1, id: digest(seed, 'pre-limit-shout', index),+ operation: 'shout', args: [{ from, to: 'all', text, lanes: LANES }] };+ const result = applyEngineMove(board, move, { sequence: appliedSequence(board) + 1, at: FIXED_NOW.toISOString() });+ assert.equal(result.error, undefined, 'the synthetic pre-limit record replays through the public engine');+}+/** Build a deterministic text body near the requested size without storing fixture randomness. */function textOf(seed, label, targetLength) {const piece = `${label} ${seed} records a reviewed change with its context, expected result, and follow-up. `;@@ -303,8 +314,12 @@ export function generateStressBoard({ seed = 'pullboard-perf-606', size = 150, pconst shoutCount = Math.round(7_289 * size / 605);for (let index = 0; index < shoutCount; index += 1) {const text = index === 0 ? textOf(seed, 'Longest generated shout', 14_000) : textOf(seed, `Generated board update ${index + 1}`, 410);- shout(board, { from: agents.writer, to: 'all', text, lanes: LANES });+ historicalShout(board, { seed, index, from: agents.writer, text });}+ const historicalCount = allShouts(board).length;+ assert.throws(() => shout(board, { from: agents.writer, to: 'all', text: 'x'.repeat(401), lanes: LANES }),+ error => error.code === 'SHOUT_TOO_LONG', 'new writes still obey the landed 400-character cap');+ assert.equal(allShouts(board).length, historicalCount, 'the current-write refusal creates no extra fixture shout');const milestoneCount = Math.max(1, Math.round(size * 56 / 605));const rowCount = Math.max(milestoneCount, Math.round(size * 384 / 605));for (let index = 0, cursor = 0; index < milestoneCount; index += 1) {diff --git a/test/cockpit/provenance.test.js b/test/cockpit/provenance.test.jsindex cb888022..5a5d22eb 100644--- a/test/cockpit/provenance.test.js+++ b/test/cockpit/provenance.test.js@@ -73,7 +73,7 @@ function fixture(t) {};/** Change exactly one version constant in linked source, leaving the primary source untouched. */const bump = (name, from, to) => {- const path = join(lane, 'src/board.js');+ const path = join(lane, 'src/board-schema-source.js');const before = readFileSync(path, 'utf8');const after = before.replace(`export const ${name} = ${from};`, `export const ${name} = ${to};`);assert.notEqual(after, before, `the linked checkout contains ${name} ${from}`);diff --git a/test/cockpit/rigor-view.test.js b/test/cockpit/rigor-view.test.jsindex 7a654147..69bd735b 100644--- a/test/cockpit/rigor-view.test.js+++ b/test/cockpit/rigor-view.test.js@@ -104,8 +104,9 @@ test('a materialized automatic Rigor draft shows in Needs you, marked unproved,assert.ok(served.length > 0, 'serve.js carries the automatic draft');assert.ok(served.every((call) => call.proof == null && call.evidence.occurrences >= 2), 'with its repeat evidence and no proof');assert.ok(!state.needs.some((call) => call.kind === 'rigor-draft'), 'board-only proposals stay with the coordinator');- const applied = box.run(alpha.repo, 'spec', 'apply', '--json');- assert.equal(applied.code, 0, applied.err || applied.out);+ const applied = JSON.parse(box.run(alpha.repo, 'spec', 'apply', '--json'));+ assert.equal(applied.version, 1, 'the successful CLI helper returns the public JSON document');+ assert.deepEqual(applied.applied, [], 'materializing an unproved proposal approves no person decision');const materialized = await boardOf(view, alpha.repo);assert.ok(materialized.needs.some((call) => call.kind === 'rigor-draft' && call.materialized), 'the real coordinator write exposes a person-actionable draft');chrome = await openSnapshotChrome(executable, view.link.href, profile);diff --git a/test/cockpit/roadmap.test.js b/test/cockpit/roadmap.test.jsindex 008fe876..b840921c 100644--- a/test/cockpit/roadmap.test.js+++ b/test/cockpit/roadmap.test.js@@ -234,7 +234,7 @@ test('the roadmap reads every item as the Items tab does, opens each one, anotheconst bar = await tabBar(chrome);for (const layout of bar.layouts) {const place = `${width} with ${layout.on} picked`;- assert.equal(layout.tabs.length, 6, `${place}: six tabs`);+ assert.equal(layout.tabs.length, 7, `${place}: seven tabs including Stats`);for (const tab of layout.tabs) assert.ok(tab.labelLeft >= tab.left + 2 && tab.labelRight <= tab.right - 2, `${place}: ${tab.tab}'s label sits inside its highlight: ${JSON.stringify(tab)}`);layout.tabs.forEach((tab, n) => { if (n) assert.ok(tab.left >= layout.tabs[n - 1].right - 0.5, `${place}: ${tab.tab} starts after the tab before it ends`); });assert.ok(layout.tabs[0].left >= layout.bar[0] - 0.5 && layout.tabs.at(-1).right <= layout.bar[1] + 0.5 && layout.bar[1] <= bar.client, `${place}: the tab bar fits on screen: ${JSON.stringify(layout)}`);diff --git a/test/cockpit/snapshot.test.js b/test/cockpit/snapshot.test.jsindex ae8e23e1..ff1f557e 100644--- a/test/cockpit/snapshot.test.js+++ b/test/cockpit/snapshot.test.js@@ -7,9 +7,27 @@ import { tmpdir } from 'node:os';import { join, resolve } from 'node:path';import { test } from 'node:test';import { fetchLocal } from '../../src/local-fetch.js';+import { closeBoard } from '../../src/board.js';+import { events } from '../../src/board.js';+import { openBoardForRead } from '../../src/board-read-open.js';+import { proofStats } from '../../src/stats.js';import { exportView, portableSnapshot } from '../../src/serve.js';-import { machine, project, build, sendBack, fetchLive, startView, accept, boardId, boardOf, assertObservationsEqual, chromeExecutable, browserPause, openSnapshotChrome, closeSnapshotChrome, press, travel, settled, roadmapRow, showing, readRoadmap, openRoadmapParts, serveFolder, proofShot } from './fixture.js';-+import { machine, project, build, sendBack, fetchLive, startView, accept, boardId, boardOf, chromeExecutable, browserPause, openSnapshotChrome, closeSnapshotChrome, press, travel, settled, roadmapRow, showing, readRoadmap, openRoadmapParts, serveFolder, proofShot } from './fixture.js';+++/** Compare every projection field, evaluating running statistics at each real observation clock. */+function assertSnapshotObservation(expected, actual, board, root, message) {+ /** Read the entire public statistics projection at its recorded observation time. */+ const statisticsAt = (observation) => {+ const now = Date.parse(observation.proofStats.flow.asOf);+ assert.ok(Number.isFinite(now), 'the projection records a valid observation clock');+ return portableSnapshot(JSON.parse(JSON.stringify(proofStats(board, { now }))), root);+ };+ assert.deepEqual(expected.proofStats, statisticsAt(expected), 'the live projection matches the public statistics reader at its clock');+ const actualStatistics = statisticsAt(actual);+ assert.deepEqual(actual.proofStats, actualStatistics, 'the export projection matches the public statistics reader at its clock');+ assert.deepEqual(actual, { ...expected, proofStats: actualStatistics }, message);+}test('static export stays in its prefix and replays read-only in Chrome [A10,A3]', { timeout: 90_000 }, async (t) => {const executable = chromeExecutable();@@ -37,6 +55,12 @@ test('static export stays in its prefix and replays read-only in Chrome [A10,A3]try { expected = portableSnapshot(await boardOf(live, alpha.repo), alpha.repo); }finally { await live.stop(); }+ const observationBoard = openBoardForRead(join(alpha.repo, '.git', 'pullboard', 'board.sqlite'));+ assert.ok(observationBoard, 'the parity oracle reads the real native board');+ t.after(() => closeBoard(observationBoard));+ observationBoard.db.exec('BEGIN');+ const observationEvents = JSON.parse(JSON.stringify(events(observationBoard)));+const exportDir = join(box.dir, 'snapshot-export');box.run(alpha.repo, 'view', '--export', exportDir);assert.ok(existsSync(join(exportDir, 'index.html')));@@ -45,6 +69,7 @@ test('static export stays in its prefix and replays read-only in Chrome [A10,A3]const boardId = exportedBoards.boards[0].id;const exportedEvents = JSON.parse(readFileSync(join(exportDir, 'api', 'v1', 'boards', boardId, 'events.json'), 'utf8')).events;const fullBoardLog = JSON.parse(box.run(alpha.repo, 'log', '--json')).events;+ assert.deepEqual(fullBoardLog, observationEvents, 'the live and exported projections share the same unchanged native history');assert.equal(exportedEvents.length, fullBoardLog.length, 'the snapshot exports every board event');assert.deepEqual(exportedEvents.map((event) => event.event_id), fullBoardLog.map((event) => event.event_id),'the snapshot event file contains the complete ordered board log');@@ -99,7 +124,7 @@ test('static export stays in its prefix and replays read-only in Chrome [A10,A3]const initial = JSON.parse(await evaluate(`JSON.stringify({ project: data.project, index: snapshotReplay.index, total: snapshotReplay.events.length, playing: snapshotReplay.playing, speedOptions: [...document.querySelector('#replay-speed').options].map((option) => option.value), bodyClass: document.body.classList.contains('snapshot') })`));assert.equal(initial.bodyClass, true);- assertObservationsEqual(expected, initial.project, 'the initial snapshot is the final live API state');+ assertSnapshotObservation(expected, initial.project, observationBoard, alpha.repo, 'the initial snapshot is the final live API state');assert.deepEqual(initial.speedOptions, ['1', '4', '16']);assert.ok(initial.total >= 6, 'the exported board contains the complete claim/submit/reject/claim/submit/accept history');assert.ok(initial.index >= initial.total - 1, 'the initial replay position is the exported final state');@@ -228,7 +253,7 @@ test('static export stays in its prefix and replays read-only in Chrome [A10,A3]['building', 'verify', 'back', 'building', 'verify', 'verified'],'the actual item row renders claim, submit, reject, claim, submit, accept in order');const finalProject = await evaluate('JSON.stringify(data.project)');- assertObservationsEqual(expected, JSON.parse(finalProject), 'replay ends at the same state served live before export');+ assertSnapshotObservation(expected, JSON.parse(finalProject), observationBoard, alpha.repo, 'replay ends at the same state served live before export');for (const [width, theme] of [[1280, 'light'], [375, 'dark']]) {await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 1000, deviceScaleFactor: 1, mobile: false });@@ -733,7 +758,7 @@ test('the export asks for the full board [N26,A2]', { timeout: 90_000 }, // budgassert.equal(opened.criterion, criterion, 'the exported item shows its criterion');assert.deepEqual(opened.verdicts, [['REJECT', 'the first greeting needs a correction'], ['ACCEPT', 'the page shows it']],'the exported item shows both verdicts with their notes');- assert.deepEqual(opened.moves, ['add', 'claim', 'submit', 'reject', 'claim', 'submit', 'accept'], 'the exported thread shows every move');+ assert.deepEqual(opened.moves, ['add', 'claim', 'proof-run', 'submit', 'reject', 'claim', 'proof-run', 'submit', 'accept'], 'the exported thread shows every move including native proof receipts');assert.deepEqual(opened.facts, ['The corrected greeting renders offline.'], 'the exported thread shows its fact');assert.ok(host.requests.some((request) => request.path.endsWith('/state.json')), 'the page reads the exported state file');assert.deepEqual(host.requests.filter((request) => !request.path.startsWith('/demo/') || request.status !== 200), [],diff --git a/test/cockpit/stats.test.js b/test/cockpit/stats.test.jsindex ce9f784c..960d7727 100644--- a/test/cockpit/stats.test.js+++ b/test/cockpit/stats.test.js@@ -147,6 +147,8 @@ test('[V2,N26] stats counts agree in number', { timeout: 90_000 }, async () => {await chrome.waitFor("!!data?.project?.proofStats && document.querySelector('#proof-stats-summary')");await pickProject(chrome, `document.querySelector('[data-root=${JSON.stringify(alpha.repo)}]')`);await chrome.waitFor(`data?.project?.root === ${JSON.stringify(alpha.repo)} && !!document.querySelector('#proof-stats-summary')`);+ await press(chrome, "document.querySelector('[data-tab=stats]')");+ await chrome.waitFor("view.tab === 'stats'");await press(chrome, "document.querySelector('#proof-stats-summary')");const detail = await chrome.stable("document.querySelector('#proof-stats-full').textContent");const count = await chrome.stable("document.querySelector('[data-stat=agentCount]').textContent");@@ -184,6 +186,8 @@ test('the stats card folds from its summary line [N26]', {try {chrome = await openSnapshotChrome(executable, view.link.href, profile);await chrome.waitFor("!!data?.project?.proofStats && document.querySelector('#proof-stats-summary')");+ await press(chrome, "document.querySelector('[data-tab=stats]')");+ await chrome.waitFor("view.tab === 'stats'");await chrome.stable(`(() => {window.__statsTouchTargets = [];document.addEventListener('pointerdown', event => {