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.

feat(check): a green baseline names a check that proves the work [V2,C7]

Corey Olsonde3f08c82fc0
diff --git a/src/check-accept.js b/src/check-accept.js
index 62e7b9c2..3205b7f7 100644
--- a/src/check-accept.js
+++ b/src/check-accept.js
@@ -3,6 +3,7 @@
* until the person accepts that exact check [V2,V4,B26].
*/
import { createHash } from 'node:crypto';
+import { provingCheck } from './check-baseline.js';
import {
PERSON,
atomic,
@@ -94,7 +95,7 @@ export function refuseProvesNothing(mainConfig, board, item) {
if (mainConfig()?.checks?.provesNothing !== PROVES_NOTHING_HOLD) return;
throw new Refused('CRITERION_PROVES_NOTHING',
`#${item.item_id} is held: its check already passes on main ${String(base.main).slice(0, 12)}, so it proves nothing: ${base.command}`,
- `the coordinator sets a check that fails before the work (pullboard edit ${item.item_id} --check "<command>"), or the person accepts this one: pullboard check accept ${item.item_id}`);
+ `ask the coordinator for a check that fails before the work, ready to paste: pullboard shout coordinator --decision "#${item.item_id} is held because its check passes on main; please set: pullboard edit ${item.item_id} --check '${provingCheck(item)}'"; or the person accepts this one: pullboard check accept ${item.item_id}`);
}
/**
diff --git a/src/check-baseline.js b/src/check-baseline.js
index 4a556932..519abec5 100644
--- a/src/check-baseline.js
+++ b/src/check-baseline.js
@@ -79,6 +79,21 @@ function gateOnMain(root, main) {
} catch { return ''; }
}
+/**
+ * A check that would prove the work (#917): one that runs the item's new test file. The file is the one the
+ * criterion or brief names, or one named after the item; the runner is the item's own Node test runner when it uses
+ * one, and node --test otherwise, so an agent that set `npm test` gets a command it can paste.
+ *
+ * @param {{ item_title?: string, item_check?: string|null, item_criterion?: string|null, item_brief?: string|null }} item
+ * @returns {string}
+ */
+export function provingCheck(item) {
+ const named = /\b(test\/[\w./-]+\.test\.[cm]?js)\b/u.exec(`${item.item_criterion ?? ''}\n${item.item_brief ?? ''}`)?.[1];
+ const slug = String(item.item_title ?? '').toLowerCase().replace(/[^a-z0-9]+/gu, '-').replace(/^-+|-+$/gu, '').slice(0, 48) || 'the-work';
+ const runner = /^node\s+bin\/run-tests\.js\b/u.test(item.item_check ?? '') ? 'node bin/run-tests.js' : 'node --test';
+ return `${runner} ${named ?? `test/${slug}.test.js`}`;
+}
+
/** Print a recorded observation, including the warning every reviewer must see before work. */
export function sayCheckBaseline(io, item) {
const base = item.item_check_baseline;
@@ -93,6 +108,6 @@ export function sayCheckBaseline(io, item) {
}
io.say(`check baseline ${base.result} at main ${base.main}${base.reason ? ` (${base.reason})` : ''}: ${base.command}`);
if (base.result === 'green') {
- io.say('warning: [CRITERION_PROVES_NOTHING] this check already passes on main; use a check that fails before the work and passes after it');
+ io.say(`warning: [CRITERION_PROVES_NOTHING] this check already passes on main; use a check that fails before the work and passes after it, such as one that runs the new test: pullboard edit ${item.item_id} --check "${provingCheck(item)}"`);
}
}
diff --git a/test/check-proves-nothing.test.js b/test/check-proves-nothing.test.js
new file mode 100644
index 00000000..125993fa
--- /dev/null
+++ b/test/check-proves-nothing.test.js
@@ -0,0 +1,37 @@
+/** A check that already passes on main names the check that would prove the work, and a hold leaves the agent a step [V2,C7]. */
+import assert from 'node:assert/strict';
+import { test } from 'node:test';
+import { closeBoard } from '../src/board.js';
+import { openBoard } from '../src/board.js';
+import { refuseProvesNothing } from '../src/check-accept.js';
+import { sayCheckBaseline } from '../src/check-baseline.js';
+
+/** The #849 shape: an item whose whole-suite check is green on main before any work. */
+function provesNothing(overrides = {}) {
+ return { item_id: 4, item_status: 'open', item_title: 'Show the cart total', item_check: 'npm test', item_criterion: 'The cart shows its total.',
+ item_brief: '', item_check_baseline: { result: 'green', main: 'a'.repeat(40), command: 'npm test' }, ...overrides };
+}
+
+test('the green-baseline warning names a check that runs the new test file [V2,C7]', () => {
+ const lines = [];
+ sayCheckBaseline({ say: (line) => lines.push(line) }, provesNothing());
+ const warning = lines.find((line) => line.includes('CRITERION_PROVES_NOTHING'));
+ assert.ok(warning, lines.join('\n'));
+ assert.match(warning, /pullboard edit 4 --check "node --test test\/show-the-cart-total\.test\.js"/u, 'the concrete fix is a paste-ready command');
+ const named = [];
+ sayCheckBaseline({ say: (line) => named.push(line) }, provesNothing({ item_check: 'node bin/run-tests.js', item_check_baseline: { result: 'green', main: 'a'.repeat(40), command: 'node bin/run-tests.js' },
+ item_criterion: 'Tests in test/cart-total.test.js pass; the first fails before the change.' }));
+ assert.match(named.join('\n'), /--check "node bin\/run-tests\.js test\/cart-total\.test\.js"/u, 'the named test file and the project runner are used');
+});
+
+test('a held item leaves the agent one step it can take itself [V2,C7]', (t) => {
+ const board = openBoard(':memory:');
+ t.after(() => closeBoard(board));
+ assert.throws(() => refuseProvesNothing(() => ({ checks: { provesNothing: 'hold' } }), board, provesNothing()), (error) => {
+ assert.equal(error.code, 'CRITERION_PROVES_NOTHING');
+ assert.match(error.message, /#4 is held/u);
+ assert.match(error.next, /pullboard shout coordinator --decision "#4 is held because its check passes on main; please set: pullboard edit 4 --check 'node --test test\/show-the-cart-total\.test\.js'"/u,
+ 'the agent can ask for the concrete check without the person');
+ return true;
+ });
+});