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: dependencies, pinning, the worktree command, refusal wording

Corey Olsonc167c0a318ce
diff --git a/test/board.test.js b/test/board.test.js
index 54a4e889..80cfc15d 100644
--- a/test/board.test.js
+++ b/test/board.test.js
@@ -3,6 +3,9 @@
* R2). The git-facing rules (V3, V4, V7) run against real repos in e2e.test.js.
*/
import assert from 'node:assert/strict';
+import { mkdtempSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
import { beforeEach, test } from 'node:test';
import * as store from '../src/board.js';
@@ -193,3 +196,33 @@ test('every move lands in the event log; stats count items and verdicts [R1, R2]
assert.equal(stats.items.open, 1);
assert.equal(stats.rejected, 1);
});
+
+test('an item can wait on others: claiming it is refused until they are verified', () => {
+ const contract = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Store module' });
+ const user = store.addItem(board, { by: 'coordinator', lane: 'api', title: 'Uses the store', after: [contract] });
+ assert.throws(() => claimAs(user, 'api-1', 'api'), /BLOCKED.*#2 waits on #1 \(open, web lane\)/);
+ 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' });
+ 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' });
+ assert.throws(() => store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Late', after: [dropped] }), /WITHDRAWN/);
+});
+
+test('a board made before dependencies existed is migrated on open', () => {
+ const dir = mkdtempSync(join(tmpdir(), 'pullboard-migrate-'));
+ try {
+ const file = join(dir, 'board.sqlite');
+ const old = store.openBoard(file, clock);
+ old.db.exec('ALTER TABLE item DROP COLUMN item_after');
+ store.closeBoard(old);
+ const reopened = store.openBoard(file, clock);
+ const columns = reopened.db.prepare('PRAGMA table_info(item)').all().map((column) => column.name);
+ store.closeBoard(reopened);
+ assert.ok(columns.includes('item_after'));
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
+});
diff --git a/test/e2e.test.js b/test/e2e.test.js
index c1af1e60..830c8c68 100644
--- a/test/e2e.test.js
+++ b/test/e2e.test.js
@@ -195,6 +195,19 @@ test('submit needs a clean tree, nothing untracked, and the gate green at HEAD [
const submitted = box.run(box.web, 'submit', '1');
assert.equal(submitted.code, 0, submitted.err);
assert.match(submitted.out, /submitted #1 at [0-9a-f]{12}; gate green/);
+ const head = box.git(box.web, 'rev-parse', 'HEAD');
+ assert.equal(box.git(box.repo, 'rev-parse', `refs/pullboard/items/1/${head.slice(0, 12)}`), head, 'submit pins the commit');
+});
+
+test('pullboard worktree makes a joined worktree for a lane in one command [I4]', () => {
+ const box = project();
+ const made = box.run(box.repo, 'worktree', 'api');
+ 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(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/);
});
test('a red gate refuses submit', () => {
diff --git a/test/hooks.test.js b/test/hooks.test.js
index ef226b12..e49a92b3 100644
--- a/test/hooks.test.js
+++ b/test/hooks.test.js
@@ -22,15 +22,19 @@ test('a clean header citing a live id passes [C1, C2]', () => {
});
test('feat and fix cite ids; cited ids exist and are not retired [C2]', () => {
- assert.match(check('feat(web): add the page')[0], /cite the spec ids/);
+ assert.match(check('feat(web): add the page')[0], /end the header with the spec rows this feat serves, like \[G1,G2\]/);
assert.match(check('fix: patch [G9]')[0], /G9 is not in SPEC.md/);
assert.match(check('fix: patch [G2]')[0], /G2 is retired/);
});
test('header format, length, case and period [C1]', () => {
assert.match(check('Added the page')[0], /type\(scope\): subject/);
- assert.match(check(`docs: ${'x'.repeat(80)}`)[0], /characters; at most 72/);
- assert.deepEqual(check('docs: Explain lanes.'), ['the subject starts lowercase', 'the subject has no trailing period']);
+ assert.match(check(`docs: ${'x'.repeat(80)}`)[0], /shorten the header to 72 characters or fewer \(it has 86\)/);
+ assert.deepEqual(check('docs: Explain lanes.'), [
+ 'start the subject with a lowercase letter (saw "Explain lanes.")',
+ 'remove the period at the end of the subject',
+ ]);
+ assert.match(check('feat: x [G K P D]')[0], /cite only rows that exist, separated by commas like \[G1,G2\]/);
assert.deepEqual(check('docs: explain lanes\nsecond line'), ['leave a blank line after the header']);
});
@@ -43,7 +47,7 @@ test('comments are dropped; merges, reverts and fixups are exempt', () => {
test('opt-in rules: filler words, emoji, co-author trailers', () => {
const strict = { ...RULES, banned: ['basically', 'seamless'], noEmoji: true, noCoAuthor: true };
const problems = check('docs: basically seamless lanes \u{1F680}\n\nCo-Authored-By: Bot <b@x>', strict);
- assert.deepEqual(problems, ['filler word: "basically"', 'filler word: "seamless"', 'no emojis', 'no Co-Authored-By trailer']);
+ assert.deepEqual(problems, ['drop the filler word "basically"', 'drop the filler word "seamless"', 'remove the emoji', 'remove the Co-Authored-By trailer']);
assert.deepEqual(check('docs: basically fine'), []);
});