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: coordinator lanes, explicit verdicts, idle reasons, cd prefixes

Corey Olsonb5c1d898b235
diff --git a/test/board.test.js b/test/board.test.js
index 2d4c1ca5..342d025a 100644
--- a/test/board.test.js
+++ b/test/board.test.js
@@ -58,7 +58,7 @@ test('a claim is a lease: renewable by its holder, free again once it lapses [B4
assert.equal(store.getItem(board, id).item_owner, 'web-2');
});
-test('one live top-level claim per agent; child items are free; lanes hold [B5]', () => {
+test('one live top-level claim per agent; child items are free; lanes hold, the coordinator\'s too [B5, B12]', () => {
const first = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'One' });
const second = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Two' });
const child = store.addItem(board, { by: 'web-1', lane: 'web', title: 'One, part', parentId: first });
@@ -67,7 +67,9 @@ test('one live top-level claim per agent; child items are free; lanes hold [B5]'
assert.throws(() => claimAs(second, 'web-1', 'web'), /ONE_CLAIM/);
claimAs(child, 'web-1', 'web');
assert.throws(() => claimAs(api, 'web-1', 'web'), /WRONG_LANE/);
- claimAs(api, 'coordinator', 'coordinator');
+ assert.throws(() => claimAs(api, 'coordinator', 'coordinator'), /WRONG_LANE.*built from that lane's worktree, never the main checkout/);
+ const notes = store.addItem(board, { by: 'coordinator', lane: 'coordinator', title: 'Release notes' });
+ assert.equal(claimAs(notes, 'coordinator', 'coordinator').renewed, false);
assert.throws(
() => store.addItem(board, { by: 'web-1', lane: 'api', title: 'Cross', parentId: first }),
/PARENT_LANE/,
@@ -231,16 +233,23 @@ test('a board made by an older version is migrated on open', () => {
}
});
-test('next finds the oldest free item in your lane, or says what everything waits on [N2]', () => {
+test('next finds the oldest free item in your lane, or says what everything waits on [N2, N13]', () => {
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.deepEqual(store.nextFor(board, { agentId: 'api-1', lane: 'api' }), { item: null, reasons: [`#${later} waits on #${contract} (open, web lane)`] });
+ assert.deepEqual(store.nextFor(board, { agentId: 'coordinator', lane: 'coordinator' }).reasons, ["no open items in the coordinator lane; lane items are built from each lane's own worktree"]);
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);
+ assert.deepEqual(store.nextFor(board, { agentId: 'web-1', lane: 'web' }).reasons, [
+ `no open items in the web lane; #${contract} still awaits a verdict, and a rejected item comes back to this lane. A lane is done when its items are verified`,
+ ]);
+ store.verify(board, contract, { agentId: 'web-2', decision: 'REJECT', reason: 'TEST_FAILURE', note: 'the contract test fails', head: SHA_A, digest: 'digest:Contract', policy: 'any' });
+ assert.deepEqual(store.nextFor(board, { agentId: 'api-1', lane: 'api' }).reasons, [`#${later} waits on #${contract} (open, rejected, web lane)`]);
+ assert.equal(store.nextFor(board, { agentId: 'web-1', lane: 'web' }).item.item_id, contract);
});
test('an item carries a brief; editing it changes how to build, never what [B10]', () => {
diff --git a/test/e2e.test.js b/test/e2e.test.js
index 9f3d3a02..67e57f6f 100644
--- a/test/e2e.test.js
+++ b/test/e2e.test.js
@@ -205,6 +205,7 @@ test('pullboard worktree makes a joined worktree for a lane in one command [I4]'
assert.equal(made.code, 0, made.err);
const path = join(box.dir, 'repo-api-1');
assert.match(made.out, /on branch api\/1, joined as api-1 in the api lane/);
+ assert.match(made.out, new RegExp(`start every command with: cd ${path} &&\n {2}cd ${path} && pullboard inbox\n {2}cd ${path} && pullboard next`));
assert.match(box.run(path, 'whoami').out, /^api-1 \(api lane\)/);
assert.match(box.run(box.repo, 'worktree', 'api').out, /repo-api-2 on branch api\/2, joined as api-2/);
assert.match(box.run(box.repo, 'worktree', 'nope').err, /NO_LANE/);
@@ -229,17 +230,21 @@ test('verify runs at the submitted commit, against the criterion frozen at claim
commitFile(box, box.web, 'web/a.html', '<h1>Hi</h1>', 'feat(web): page [G1]');
assert.equal(box.run(box.web, 'submit', '1').code, 0);
assert.match(box.run(box.web, 'verify', '1', 'accept').err, /SELF_VERIFY/);
- assert.match(box.run(box.repo, 'verify', '1', 'accept').err, /NOT_AT_COMMIT/);
+ const unsaid = box.run(box.repo, 'verify', '1', 'accept', '--note', 'ran it');
+ assert.match(unsaid.err, /MAIN_IS_COORDINATOR\] this is the main checkout, so this verdict would be the coordinator's/);
+ assert.match(unsaid.err, new RegExp(`Agent worktrees: web-1 at ${box.web}`));
+ assert.match(box.run(box.web, 'verify', '1', 'accept', '--as', 'coordinator').err, /USAGE.*only in the main checkout/);
+ assert.match(box.run(box.repo, 'verify', '1', 'accept', '--as', 'coordinator').err, /NOT_AT_COMMIT/);
box.git(box.repo, 'merge', '-q', '--ff-only', 'web/one');
writeFileSync(join(box.repo, 'SPEC.md'), SPEC.replace('The page renders.', 'The page renders a heading.'));
box.git(box.repo, 'commit', '-qam', 'docs: tighten G1');
- assert.match(box.run(box.repo, 'verify', '1', 'accept').err, /CRITERIA_CHANGED/);
+ assert.match(box.run(box.repo, 'verify', '1', 'accept', '--as', 'coordinator').err, /CRITERIA_CHANGED/);
assert.match(box.run(box.repo, 'refreeze', '1').out, /refrozen/);
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').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/);
+ assert.match(box.run(box.repo, 'verify', '1', 'accept', '--as', 'coordinator').err, /PROOF_REQUIRED/);
+ assert.match(box.run(box.repo, 'verify', '1', 'accept', '--as', 'coordinator', '--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/);
@@ -305,13 +310,18 @@ test('next claims the next free item; --verify names the next to check [N2]', ()
assert.equal(first.code, 0, first.err);
assert.match(first.out, /claimed #1: Page/);
assert.match(first.out, /G1: The page renders\./);
+ assert.match(first.out, new RegExp(`when it is built and committed: cd ${box.web} && pullboard submit 1`));
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(blocked.err, /NOTHING_FREE\] #2 waits on #1 \(submitted, web lane\)/);
+ assert.match(box.run(box.repo, 'next', '--verify').err, /MAIN_IS_COORDINATOR/);
+ const named = box.run(box.repo, 'next', '--verify', '--as', 'coordinator').out;
+ assert.match(named, /next to verify: #1 Page, built by web-1/);
+ assert.match(named, new RegExp(`check out exactly that commit, here: cd ${box.repo} && git switch --detach [0-9a-f]{40}`));
+ assert.match(named, /pullboard verify 1 accept --as coordinator --note/);
assert.match(box.run(box.web, 'next', '--verify').err, /NOTHING_FREE/);
});