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(api): expose captured baselines in board state [V2,H16,A2]
Corey Olson321775da429a
diff --git a/docs/api.md b/docs/api.mdindex cef344e4..e479a178 100644--- a/docs/api.md+++ b/docs/api.md@@ -12,7 +12,7 @@ A successful command returns the fields listed below. `version` is always the nuWhen `add` or `edit` supplies a new nonempty check, it records the item before measuring that check in a background temporary checkout of the captured `main` commit. Use `--wait` to wait for the measurement before returning, or `args.wait: true` for an HTTP add/edit move. The item returned by `add`, `edit`, `show`, and `next --verify` may include `item_check_baseline`: `{command, main, result, request?, seconds?, reason?, warning?}`. `main` is the commit id or `null`, and `result` is `pending`, `green`, `red`, or `unavailable`. A background request carries an opaque `request` identity; an older completion cannot overwrite a newly edited or cleared check.-A green result carries `warning: "CRITERION_PROVES_NOTHING"`; text output names that warning when showing or reserving the item for review, and when filing it with `--wait`. An exact match with the project gate configured at that main commit records green with `reason: "repo gate"` without running it again. A missing main records unavailable with `reason: "no main"` and still files the item. Changing the check replaces this observation; clearing it removes the observation. Captured observations and completions travel through ordered board moves, so replicas store results without executing commands. A completed result awaiting relay delivery stays on the measuring device and is retried by the next normal CLI command.+The board-state API's item projection includes `check` and, when recorded, `checkBaseline` with the same observation fields. A green result carries `warning: "CRITERION_PROVES_NOTHING"`; text output names that warning when showing or reserving the item for review, and when filing it with `--wait`. An exact match with the project gate configured at that main commit records green with `reason: "repo gate"` without running it again. A missing main records unavailable with `reason: "no main"` and still files the item. Changing the check replaces this observation; clearing it removes the observation. Captured observations and completions travel through ordered board moves, so replicas store results without executing commands. A completed result awaiting relay delivery stays on the measuring device and is retried by the next normal CLI command.<!-- api-command-shapes:start -->| Command | Required top-level fields |diff --git a/src/api.js b/src/api.jsindex 67bd7ce0..7c8bdd32 100644--- a/src/api.js+++ b/src/api.js@@ -204,9 +204,14 @@ export function createLocalApiHandler({ secret, getPort, runCommand, projects =requests: store.openRequests(db),milestones: milestoneRoadmap(board.root, db),rowDecisions: store.rowDecisions(db),+ checks: new Map(store.listItems(db, { all: true }).map((item) => store.getItem(db, item.item_id)).map((item) => [item.item_id, {+ check: item.item_check,+ ...(item.item_check_baseline ? { checkBaseline: item.item_check_baseline } : {}),+ }])),}));state.requests = projectData.requests;state.milestones = projectData.milestones;+ state.items = state.items.map((item) => ({ ...item, ...projectData.checks.get(item.id) }));state = projectRowDecisions(projectData.rowDecisions, state);return state;},diff --git a/test/api-http.test.js b/test/api-http.test.jsindex 892a1eec..03f76935 100644--- a/test/api-http.test.js+++ b/test/api-http.test.js@@ -1,5 +1,6 @@/** Real HTTP calls against an isolated Git repo and the actual board engine (A2). */import assert from 'node:assert/strict';+import { randomUUID } from 'node:crypto';import { execFileSync, spawnSync } from 'node:child_process';import { chmodSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';@@ -228,6 +229,35 @@ test('[A2] real HTTP state, moves and refusals use the CLI and exact committed eassert.equal(badAgent.document.error.code, 'NO_AGENT');});+test('[A2,V2,H16] board-state JSON retains pending and red baselines and removes cleared observations', async (t) => {+ const box = await httpBox(t);+ const pending = { command: 'true', main: box.commit, result: 'pending', request: randomUUID() };+ const board = store.openBoard(join(box.root, '.git', 'pullboard', 'board.sqlite'));+ let id;+ try {+ id = store.addItem(board, { by: 'coordinator', lane: 'app', title: 'Captured API observation',+ check: pending.command, checkBaseline: pending });+ } finally { store.closeBoard(board); }+ const initial = await box.call(box.path + '/state');+ assert.deepEqual(initial.document.state.items.find((item) => item.id === id).checkBaseline, pending,+ 'a pending captured request reaches the public state endpoint before completion');+ const completed = store.openBoard(join(box.root, '.git', 'pullboard', 'board.sqlite'));+ try {+ store.completeCheckBaseline(completed, id, { agentId: 'coordinator', expected: pending,+ baseline: { command: pending.command, main: pending.main, result: 'red', seconds: 1 } });+ } finally { store.closeBoard(completed); }+ const redState = await box.call(box.path + '/state');+ const red = redState.document.state.items.find((item) => item.id === id).checkBaseline;+ assert.deepEqual(red, { command: pending.command, main: pending.main, result: 'red', seconds: 1, request: pending.request });+ assert.equal(Object.hasOwn(red, 'warning'), false, 'a failing baseline has no proves-nothing warning');+ const cleared = await box.call(box.path + '/moves', { verb: 'edit', item: id, args: { check: '' } });+ assert.equal(cleared.status, 200, JSON.stringify(cleared.document));+ const clearedState = await box.call(box.path + '/state');+ const clearedItem = clearedState.document.state.items.find((item) => item.id === id);+ assert.equal(clearedItem.check, '');+ assert.equal(Object.hasOwn(clearedItem, 'checkBaseline'), false, 'clearing the check removes its old observation from API state');+});+test('[A2,V2] HTTP add and edit preserve explicit blocking baseline requests', async (t) => {const box = await httpBox(t);/** Build a finite check whose completion can be observed independently of the HTTP response. */@@ -245,6 +275,10 @@ test('[A2,V2] HTTP add and edit preserve explicit blocking baseline requests', aassert.equal(item.item_check_baseline.result, 'green', '--wait returns a terminal observation in the add response');assert.equal(item.item_check_baseline.warning, 'CRITERION_PROVES_NOTHING');assert.equal(readFileSync(firstMarker, 'utf8'), 'finished');+ const addedState = await box.call(box.path + '/state');+ const projected = addedState.document.state.items.find((row) => row.id === item.item_id);+ assert.equal(projected.check, check);+ assert.deepEqual(projected.checkBaseline, item.item_check_baseline, 'board-state item JSON carries the same complete observation and warning');const secondMarker = join(box.dir, 'edit-finished');const editedCheck = completedCheck(secondMarker);const edited = await box.call(box.path + '/moves', { verb: 'edit', item: item.item_id, args: {@@ -254,6 +288,10 @@ test('[A2,V2] HTTP add and edit preserve explicit blocking baseline requests', aassert.equal(edited.document.result.item.item_check_baseline.command, editedCheck);assert.equal(edited.document.result.item.item_check_baseline.result, 'green', '--wait also blocks edit until its new check finishes');assert.equal(readFileSync(secondMarker, 'utf8'), 'finished');+ const editedState = await box.call(box.path + '/state');+ const editedItem = edited.document.result.item;+ assert.deepEqual(editedState.document.state.items.find((row) => row.id === item.item_id).checkBaseline,+ editedItem.item_check_baseline, 'board-state JSON replaces the observation when the check changes');});test('[A2, H12, R2] requests and shouts append events and requests stay outside decisions', async (t) => {