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.

fix(spec): keep verdict checks read-only and replayable [S1,V4]

Corey Olson6a2fc0b32987
diff --git a/src/commands/spec.js b/src/commands/spec.js
index eeddf15c..fab9ac0c 100644
--- a/src/commands/spec.js
+++ b/src/commands/spec.js
@@ -125,6 +125,13 @@ import {
withBoard,
} from '../cli.js';
+/** Validate optional verdicts using only existing board state; a check never initializes a board. */
+function verifierFindings(ctx, parsed) {
+ const source = readFileSync(parsed.file, 'utf8');
+ return hookRead(ctx, board => rowVerificationFindings(board, parsed, source))
+ ?? rowVerificationFindings(null, parsed, source);
+}
+
/**
* The spec commands: reads, sign-offs and person decisions applied by the coordinator.
*
@@ -357,7 +364,9 @@ export async function specCommand(io, { first, second, rest, values }) {
const findings = [
...lintSpec(parsed).filter((finding) => !finding.message.startsWith('duplicate id;')),
...(name === ctx.config.spec && parsed.rows.some(row => row.verify !== undefined)
- ? withBoard(ctx, board => rowVerificationFindings(board, parsed, readFileSync(parsed.file, 'utf8'))) : []),
+ ? verifierFindings(ctx, parsed) : []),
+ ...(name !== ctx.config.spec ? parsed.rows.filter(row => row.verify !== undefined).map(row => ({ level: 'error', line: row.line, id: row.id,
+ message: 'ROW_VERIFY_PROVENANCE: verifier annotations currently require an exact board-drafted SPEC row' })) : []),
...missingGateFindings(parsed, ctx.info.root),
...(collisionFindings.get(name) ?? []),
];
@@ -424,6 +433,11 @@ export async function specCommand(io, { first, second, rest, values }) {
const parsed = doctrineId ? practice : spec;
const id = doctrineId ? second.slice('doctrine:'.length) : second;
const source = parsed.rows.find((entry) => entry.id === id);
+ if (source?.verify) {
+ const findings = doctrineId ? [{ message: 'verifier annotations currently require an exact board-drafted SPEC row' }]
+ : verifierFindings(ctx, { ...parsed, rows: [source] });
+ if (findings.length) throw new Refused('ROW_VERIFY_RECEIPT', findings[0].message);
+ }
const row = source && withBoard(ctx, (board) => decisionProjection(store.rowDecisions(board), source, doctrineId ? 'doctrine' : 'spec', rowDecisionContext(ctx.info.root, ctx.config)));
if (!row) throw new Refused('NO_ROW', `no row ${second ?? ''} in ${ctx.config.spec}`);
const standing = standings(parsed.rows, signoffs).get(row.id) ?? { met: [], stale: [] };
diff --git a/src/spec-verdicts.js b/src/spec-verdicts.js
index 84727850..b039311a 100644
--- a/src/spec-verdicts.js
+++ b/src/spec-verdicts.js
@@ -77,7 +77,7 @@ export function recordRowVerification(board, { agentId, source, decision, reason
/** Reject fabricated, stale or same-parent file annotations against the current exact receipt. */
export function rowVerificationFindings(board, parsed, source) {
const lines = source.split(/\r?\n/u);
- const records = rowVerifications(board);
+ const records = board ? rowVerifications(board) : [];
return parsed.rows.filter(row => row.verify !== undefined).flatMap(row => {
const record = records.find(candidate => candidate.id === row.id);
let message;
diff --git a/test/move-registry-baseline.json b/test/move-registry-baseline.json
index 64427929..e29af028 100644
--- a/test/move-registry-baseline.json
+++ b/test/move-registry-baseline.json
@@ -62,7 +62,9 @@
"recordJobRun",
"takeCoordinator",
"landingLeaseMove",
- "recordPublishFinding"
+ "recordPublishFinding",
+ "decideSpecRevisions",
+ "recordRowVerification"
],
"itemIdFirstArgument": [
"signBar",
@@ -631,6 +633,22 @@
null,
null,
null
+ ],
+ "decideSpecRevisions": [
+ null,
+ "first",
+ null,
+ null,
+ null,
+ null
+ ],
+ "recordRowVerification": [
+ null,
+ "first",
+ null,
+ null,
+ null,
+ null
]
},
"floorCases": [
@@ -6950,7 +6968,12 @@
"WRONG_BOARD": "open the repository registered to this board and confirm its identity with pullboard status",
"WRONG_LANE": "create a worktree in the required lane with pullboard worktree <lane> --model \"<model name>\", or take an item in your lane with pullboard next",
"EXCLUDED_REPOSITORY": "restore the GitHub origin of each excluded project, then run pullboard relay on --all",
- "EXCLUDED_INVENTORY": "restore at most 256 excluded boards and their active paired devices, then run pullboard relay on --all"
+ "EXCLUDED_INVENTORY": "restore at most 256 excluded boards and their active paired devices, then run pullboard relay on --all",
+ "SPEC_REVISION": "refresh Needs you and decide the exact pending proposal",
+ "ROW_VERIFY": "pullboard spec show <id>, then pullboard spec verify <id> accepted --reason \"why\"",
+ "ROW_VERIFY_PROVENANCE": "draft the row through pullboard spec draft and join normally before verifying it",
+ "ROW_VERIFY_PENDING": "ask the coordinator to run pullboard spec apply before recording a verifier verdict",
+ "ROW_VERIFY_SELF": "ask an outside-parent verifier to run pullboard spec verify"
},
"replay": {
"initial": {
diff --git a/test/spec.test.js b/test/spec.test.js
index ec5991d7..d5c615c2 100644
--- a/test/spec.test.js
+++ b/test/spec.test.js
@@ -3,6 +3,9 @@
*/
import assert from 'node:assert/strict';
import * as store from '../src/board.js';
+import { applyEngineMove, prepareEngineMove } from '../src/engine.js';
+import { exportBoard, importBoard } from '../src/exchange.js';
+import { SPEC_VERDICT_ENGINE } from '../src/spec-verdict-engine.js';
import { runFixtureExecFile as execFileSync, runFixtureChild as spawnSync, runFixtureChild, runFixtureGit } from './fixture-child.js';
import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
@@ -1215,3 +1218,45 @@ test('spec verify binds the real caller and preserves a pending person decision
assert.ok(!applied.includes('verify:'), 'the stale draft verdict does not overwrite the person-approved replacement');
assert.equal(box.run('check').status, 0);
});
+
+
+test('row verifier reads need an exact receipt and never create a missing board [S1,V4]', t => {
+ const box = specBox(t, { specSource: '# Demo\n\n## G · Goals\n- G1 [draft] A row. | verify: accepted by review-2 | A claimed reason.\n' });
+ const file = join(box.root, '.git', 'pullboard', 'board.sqlite');
+ rmSync(file, { force: true });
+ for (const suffix of ['-shm', '-wal']) rmSync(file + suffix, { force: true });
+ const checked = box.run('check');
+ assert.equal(checked.status, 1);
+ assert.match(checked.stdout, /ROW_VERIFY_RECEIPT/u);
+ assert.equal(existsSync(file), false, 'checking a forged field initializes no board');
+ const shown = box.run('show', 'G1');
+ assert.equal(shown.status, 1);
+ assert.match(shown.stderr, /ROW_VERIFY_RECEIPT/u);
+ assert.equal(existsSync(file), false, 'show refuses the unproved field before opening a writer');
+});
+
+test('an exact row verifier receipt replays once with its engine floor and native snapshot [S1,V4,H16]', t => {
+ const box = specBox(t, { specSource: '# Demo\n\n## G · Goals\n' });
+ const board = store.openBoard(join(box.root, '.git', 'pullboard', 'board.sqlite'));
+ const replica = store.openBoard(join(box.root, 'replica.sqlite'));
+ t.after(() => { store.closeBoard(board); store.closeBoard(replica); });
+ const author = store.register(board, { lane: 'core', path: join(box.root, 'author'), parentDigest: 'a'.repeat(64) });
+ const verifier = store.register(board, { lane: 'review', path: join(box.root, 'verifier'), parentDigest: 'b'.repeat(64) });
+ store.draftSpecRow(board, { agentId: author, row: { id: 'G1', text: 'An exact requirement.',
+ gate: 'review', tier: 'must', section: 'G · Goals' } });
+ const move = prepareEngineMove(board, 'recordRowVerification', [{ agentId: verifier,
+ source: '- G1 [draft, must] An exact requirement. | gate: review', decision: 'accepted', reason: 'Reviewed exactly.' }]);
+ assert.equal(move.engine, SPEC_VERDICT_ENGINE);
+ const options = { sequence: 1, at: new Date().toISOString() };
+ const before = store.events(board).length;
+ assert.throws(() => applyEngineMove(board, { ...move, engine: SPEC_VERDICT_ENGINE - 1 }, options), { code: 'RELAY_MOVE' });
+ assert.equal(store.events(board).length, before, 'an older engine records no verdict');
+ const result = applyEngineMove(board, move, options);
+ assert.equal(result.error, undefined, JSON.stringify(result));
+ assert.equal(store.rowVerifications(board)[0].by, verifier);
+ const count = store.events(board).length;
+ assert.deepEqual(applyEngineMove(board, move, options), result);
+ assert.equal(store.events(board).length, count, 'same-position retry adds no receipt or event');
+ importBoard(replica, exportBoard(board));
+ assert.deepEqual(store.rowVerifications(replica), store.rowVerifications(board), 'native restore retains the verdict and parent-bearing source board');
+});