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.

test: proof on accept and pullboard next

Corey Olson2689b8d46d1d
diff --git a/test/board.test.js b/test/board.test.js
index 80cfc15d..1a631d79 100644
--- a/test/board.test.js
+++ b/test/board.test.js
@@ -108,7 +108,7 @@ function submitted() {
* A verdict with the defaults a correct verifier would pass.
*/
const verdict = (id, fields) =>
- store.verify(board, id, { head: SHA_A, digest: 'digest:Page', policy: 'any', ...fields });
+ store.verify(board, id, { head: SHA_A, digest: 'digest:Page', policy: 'any', note: 'broke the fix; its test failed; restored it', ...fields });
test('the builder never verifies its own work [V1]', () => {
const id = submitted();
@@ -138,7 +138,8 @@ test('ACCEPT needs CRITERION_MET; REJECT needs a reason code and a note [V5]', (
const id = submitted();
assert.throws(() => verdict(id, { agentId: 'web-2', decision: 'ACCEPT', reason: 'OTHER' }), /BAD_REASON/);
assert.throws(() => verdict(id, { agentId: 'web-2', decision: 'REJECT' }), /BAD_REASON/);
- assert.throws(() => verdict(id, { agentId: 'web-2', decision: 'REJECT', reason: 'TEST_FAILURE' }), /NOTE_REQUIRED/);
+ assert.throws(() => verdict(id, { agentId: 'web-2', decision: 'REJECT', reason: 'TEST_FAILURE', note: '' }), /NOTE_REQUIRED/);
+ assert.throws(() => verdict(id, { agentId: 'web-2', decision: 'ACCEPT', note: ' ' }), /PROOF_REQUIRED/);
assert.throws(() => verdict(id, { agentId: 'web-2', decision: 'MAYBE' }), /BAD_DECISION/);
});
@@ -204,7 +205,7 @@ test('an item can wait on others: claiming it is refused until they are verified
claimAs(contract, 'web-1', 'web');
store.submit(board, contract, { agentId: 'web-1', commit: SHA_A, tree: 't' });
assert.throws(() => claimAs(user, 'api-1', 'api'), /BLOCKED.*\(submitted/);
- store.verify(board, contract, { agentId: 'web-2', decision: 'ACCEPT', head: SHA_A, digest: 'digest:Store module', policy: 'any' });
+ store.verify(board, contract, { agentId: 'web-2', decision: 'ACCEPT', head: SHA_A, digest: 'digest:Store module', policy: 'any', note: 'reverted the module; its test failed' });
assert.equal(claimAs(user, 'api-1', 'api').renewed, false);
const dropped = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Dropped' });
store.withdraw(board, dropped, { agentId: 'coordinator', reason: 'not needed' });
@@ -226,3 +227,15 @@ test('a board made before dependencies existed is migrated on open', () => {
rmSync(dir, { recursive: true, force: true });
}
});
+
+test('next finds the oldest free item in your lane, or says what everything waits on [N2]', () => {
+ const contract = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Contract' });
+ const later = store.addItem(board, { by: 'coordinator', lane: 'api', title: 'Uses it', after: [contract] });
+ assert.deepEqual(store.nextFor(board, { agentId: 'api-1', lane: 'api' }), { item: null, reasons: [`#${later} waits on #${contract} (open)`] });
+ assert.equal(store.nextFor(board, { agentId: 'web-1', lane: 'web' }).item.item_id, contract);
+ claimAs(contract, 'web-1', 'web');
+ assert.equal(store.nextFor(board, { agentId: 'web-1', lane: 'web' }).item.item_status, 'claimed');
+ store.submit(board, contract, { agentId: 'web-1', commit: SHA_A, tree: 't' });
+ assert.equal(store.nextFor(board, { agentId: 'web-1', lane: 'web', verify: true }).item, null);
+ assert.equal(store.nextFor(board, { agentId: 'web-2', lane: 'web', verify: true }).item.item_id, contract);
+});
diff --git a/test/e2e.test.js b/test/e2e.test.js
index 830c8c68..c23e76f6 100644
--- a/test/e2e.test.js
+++ b/test/e2e.test.js
@@ -238,7 +238,8 @@ test('verify runs at the submitted commit, against the criterion frozen at claim
box.git(box.web, 'merge', '-q', '--ff-only', 'main');
box.run(box.web, 'claim', '1');
assert.equal(box.run(box.web, 'submit', '1').code, 0);
- assert.match(box.run(box.repo, 'verify', '1', 'accept').out, /verified #1: CRITERION_MET/);
+ assert.match(box.run(box.repo, 'verify', '1', 'accept').err, /PROOF_REQUIRED/);
+ assert.match(box.run(box.repo, 'verify', '1', 'accept', '--note', 'removed the heading; the page test failed').out, /verified #1: CRITERION_MET/);
const show = box.run(box.repo, 'show', '1').out;
assert.match(show, /G1: The page renders a heading\./);
assert.match(show, /ACCEPT CRITERION_MET by coordinator/);
@@ -295,3 +296,21 @@ test('two agents racing for one item: exactly one wins, every time [B2]', async
assert.equal(box.run(winners[0].cwd, 'release', String(round)).code, 0);
}
});
+
+test('next claims the next free item; --verify names the next to check [N2]', () => {
+ const box = project();
+ box.run(box.repo, 'add', 'web', 'Page', '--specs', 'G1');
+ box.run(box.repo, 'add', 'web', 'Second page', '--specs', 'G1', '--after', '1');
+ const first = box.run(box.web, 'next');
+ assert.equal(first.code, 0, first.err);
+ assert.match(first.out, /claimed #1: Page/);
+ assert.match(first.out, /G1: The page renders\./);
+ assert.match(box.run(box.web, 'next').out, /you hold #1: Page/);
+ commitFile(box, box.web, 'web/a.html', 'a', 'feat(web): page [G1]');
+ box.run(box.web, 'submit', '1');
+ const blocked = box.run(box.web, 'next');
+ assert.equal(blocked.code, 1);
+ assert.match(blocked.err, /NOTHING_FREE\] #2 waits on #1 \(submitted\)/);
+ assert.match(box.run(box.repo, 'next', '--verify').out, /next to verify: #1 Page, built by web-1/);
+ assert.match(box.run(box.web, 'next', '--verify').err, /NOTHING_FREE/);
+});