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
feat(view): show item check baseline [V2,N26]
Corey Olson2e37035df079
diff --git a/src/cockpit.js b/src/cockpit.jsindex 4f89c0ec..414349e8 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -1060,12 +1060,16 @@ function render() {if (item && !view.adding) {const s = stateOf(item);const cited = item.specs.map((id) => p.spec.find((r) => r.id === id) || { id, status: 'missing', text: '(not in SPEC.md)' });+ const baseline = item.checkBaseline;+ const baselineClass = baseline?.result === 'green' ? 'ok' : baseline?.result === 'red' ? 'no' : baseline?.result === 'pending' ? 'warn' : '';// Why it came back is the first thing the person reads; the verdicts before it stay below.const back = rejected(item);const earlier = back ? item.verdicts.slice(0, -1) : item.verdicts;$('detail').innerHTML = '<div class="stack"><div><h2><span>#' + item.id + '</span>' + rich(item.title, titles) + '</h2><div class="meta spaced">' + (s === 'open' ? openChip(item) : chip(s)) + '<span class="chip">' + esc(item.lane) + '</span><span class="chip">' + esc(item.route) + '</span></div></div>'+ (back ? '<div class="sentback"><h3>Sent back' + (s === 'building' ? ', being reworked' : s === 'verify' ? ', resubmitted' : s === 'withdrawn' ? ', then withdrawn' : '') + '</h3>' + verdictHtml(item.verdict, titles) + '</div>' : '')+ (item.criterion ? '<div><h3>Criterion</h3><div class="text">' + rich(item.criterion, titles) + '</div></div>' : '')+ + (item.check ? '<div><h3>Check</h3><dl class="kv"><dt>command</dt><dd><code>' + esc(item.check) + '</code></dd><dt>baseline</dt><dd><span class="chip ' + baselineClass + '">' + esc(baseline?.result ?? 'not recorded') + '</span></dd></dl>'+ + (baseline?.warning === 'CRITERION_PROVES_NOTHING' ? '<p class="check-warning">This check already passed before the work, so it proves nothing.</p>' : '') + '</div>' : '')+ (cited.length ? '<div><h3>Spec rows it serves</h3>' + cited.map((r) => '<div class="rowref"><code>' + esc(r.id) + '</code><div>' + linked(r.text, titles) + ' <span class="chip ' + tone(r.status) + '">' + esc(r.status) + '</span></div></div>').join('') + '</div>' : '')+ (item.brief ? '<div><h3>Brief</h3><div class="text muted">' + rich(item.brief, titles) + '</div></div>' : '')+ '<div><h3>People and commits</h3><dl class="kv">' + (item.owner && s === 'building' ? '<dt>holding</dt><dd>' + esc(item.owner) + '</dd>' : '') + (item.builtBy ? '<dt>built by</dt><dd>' + esc(item.builtBy) + '</dd>' : '') + (item.verifiedBy ? '<dt>verified by</dt><dd>' + esc(item.verifiedBy) + '</dd>' : '') + (item.commit ? '<dt>commit</dt><dd><code>' + esc(item.commit.slice(0, 12)) + '</code></dd>' : '') + (item.merged ? '<dt>merged</dt><dd><code>' + esc(item.merged.slice(0, 12)) + '</code></dd>' : '') + (item.blockedBy.length ? '<dt>waits on</dt><dd class="waits-on">' + item.blockedBy.map((id) => '<span class="wait-unit"><button class="ref" data-go="item:' + id + '" type="button">#' + id + '</button></span>').join(', ') + '</dd>' : '') + '</dl></div>'diff --git a/src/view.css b/src/view.cssindex 1da29cf3..765af5b8 100644--- a/src/view.css+++ b/src/view.css@@ -244,6 +244,7 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }.detail h3 { margin: 0 0 6px; font: 600 11px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); }.detail .text { white-space: pre-wrap; overflow-wrap: anywhere; }.detail .muted, .muted { color: var(--ink-muted); }+.check-warning { margin: 6px 0 0; color: var(--warn); font-size: 13px; }.kv { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 4px 10px; font-size: 13px; margin: 0; }.kv dt { color: var(--ink-faint); } .kv dd { margin: 0; overflow-wrap: anywhere; }.kv dd.waits-on button.ref { border: 0; background: none; padding: 0; font: inherit; color: var(--accent-strong); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }diff --git a/test/cockpit.test.js b/test/cockpit.test.jsindex 63932cd9..4b6efd59 100644--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@ -14,7 +14,7 @@ import { after, test } from 'node:test';import vm from 'node:vm';import { loadConfig } from '../src/config.js';import { loadDoctrine } from '../src/doctrine.js';-import { addItem, closeBoard, openBoard } from '../src/board.js';+import { addItem, closeBoard, completeCheckBaseline, openBoard } from '../src/board.js';import { exportBoard, importBoard } from '../src/exchange.js';import { MACHINE } from '../src/machine.js';import { cockpitPage } from '../src/cockpit.js';@@ -1454,6 +1454,74 @@ test("the view's styles live in their own file [N26]", async () => {await view.stop();}});+test('an item detail shows its pending, red and green check baselines from the API [V2,N26]', async () => {+ const box = machine();+ const alpha = project(box, 'check-baselines');+ const main = box.git(alpha.repo, 'rev-parse', 'main');+ const checks = [+ { title: 'Pending baseline', command: 'node --test pending.test.js', result: 'pending', request: '00000000-0000-4000-8000-000000000001' },+ { title: 'Red baseline', command: 'node --test red.test.js', result: 'red', seconds: 2 },+ { title: 'Green baseline', command: 'node --test green.test.js', result: 'green', seconds: 1 },+ ];+ const board = openBoard(join(alpha.repo, '.git', 'pullboard', 'board.sqlite'));+ let ids;+ try {+ ids = checks.map((check) => addItem(board, {+ by: 'coordinator', lane: 'web', title: check.title, criterion: 'shows the observed check result', specIds: ['G1'],+ check: check.command,+ checkBaseline: { command: check.command, main, result: check.result, ...(check.request ? { request: check.request } : {}), ...(check.seconds ? { seconds: check.seconds } : {}) },+ }));+ } finally {+ closeBoard(board);+ }+ const view = await startView(box);+ try {+ const state = await boardOf(view, alpha.repo);+ for (let index = 0; index < checks.length; index += 1) {+ assert.equal(state.items.find((item) => item.id === ids[index]).check, checks[index].command);+ assert.equal(state.items.find((item) => item.id === ids[index]).checkBaseline.result, checks[index].result,+ 'the local API exposes the recorded baseline state');+ }+ assert.equal(state.items.find((item) => item.id === ids[2]).checkBaseline.warning, 'CRITERION_PROVES_NOTHING');++ const page = await openPage(view);+ for (let index = 0; index < checks.length; index += 1) {+ await page.click({ item: String(ids[index]), classes: 'row' });+ const detail = page.show('detail');+ assert.match(detail, /<h3>Check<\/h3>/);+ assert.ok(detail.indexOf('<h3>Criterion</h3>') < detail.indexOf('<h3>Check</h3>')+ && detail.indexOf('<h3>Check</h3>') < detail.indexOf('<h3>Spec rows it serves</h3>'), 'the check sits beside the criterion');+ assert.ok(detail.includes(`<code>${checks[index].command}</code>`), 'the displayed check is the API command');+ assert.ok(detail.includes(`<span class="chip ${checks[index].result === 'green' ? 'ok' : checks[index].result === 'red' ? 'no' : 'warn'}">${checks[index].result}</span>`),+ `the ${checks[index].result} baseline is visible`);+ if (checks[index].result === 'green') {+ assert.ok(detail.includes('This check already passed before the work, so it proves nothing.'), 'green baseline warning is plain language');+ } else {+ assert.doesNotMatch(detail, /proves nothing/, 'pending and red baselines do not claim the check proves nothing');+ }+ if (checks[index].result === 'pending') {+ const completionBoard = openBoard(join(alpha.repo, '.git', 'pullboard', 'board.sqlite'));+ try {+ assert.equal(completeCheckBaseline(completionBoard, ids[index], {+ agentId: 'coordinator',+ expected: { command: checks[index].command, main, result: 'pending', request: checks[index].request },+ baseline: { command: checks[index].command, main, result: 'green', seconds: 1 },+ }), true, 'the authorized pending baseline completes once');+ } finally {+ closeBoard(completionBoard);+ }+ await page.run('refresh()');+ const completed = page.show('detail');+ assert.match(completed, /<h2><span>#\d+<\/span>Pending baseline<\/h2>/, 'the open detail stays on the pending item');+ assert.ok(completed.includes('<span class="chip ok">green</span>'), 'the open detail updates to the completed result');+ assert.ok(completed.includes('This check already passed before the work, so it proves nothing.'), 'the completed warning appears without reopening the detail');+ }+ }+ } finally {+ await view.stop();+ }+});+test('a sent-back item shows why first [N26]', async () => {const box = machine();const p = project(box, 'shop');