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.

chore: merge trunk for decisions resubmission

Corey Olson6549cd609321
diff --cc test/team.test.js
index cfb44fd0,c7ac8f7c..a9fe9198
--- a/test/team.test.js
+++ b/test/team.test.js
@@@ -873,87 -1020,57 +1020,142 @@@ test('a landing lease renewal or waite
assert.equal(state.line.length, 1, 'suppressing polling events does not discard the waiting command');
});
+/** Initialise a second repo in the first one's sandbox, so both register in the same machine home. */
+function siblingRepo(box, name, project) {
+ const repo = join(box.dir, name);
+ mkdirSync(repo);
+ box.git(repo, 'init', '-q', '-b', 'main');
+ assert.equal(box.run(repo, 'init').code, 0);
+ return { repo, project };
+}
+
+/** Put a repo into a named project under its own name, committed so the board reads it. */
+function nameRepo(box, repo, name, project) {
+ const file = join(repo, 'pullboard.json');
+ const config = JSON.parse(readFileSync(file, 'utf8'));
+ writeFileSync(file, JSON.stringify({ ...config, name, project }, null, 2));
+ box.git(repo, 'add', '-A');
+ box.git(repo, 'commit', '-q', '-m', 'chore: name the repo');
+}
+
+test("one decision list across a project's repos [N34]", { timeout: 180_000 }, async t => { // budget: hang ceiling for three real repos' CLI runs and one view process; not a speed target.
+ const box = helpers.project();
+ const other = siblingRepo(box, 'repo-b').repo;
+ const lone = siblingRepo(box, 'repo-c').repo;
+ nameRepo(box, box.repo, 'alpha', 'shop');
+ nameRepo(box, other, 'beta', 'shop');
+ nameRepo(box, lone, 'gamma', 'elsewhere');
+ const ask = (root, text) => {
+ const asked = box.run(root, 'shout', 'person', text, '--decision');
+ assert.equal(asked.code, 0, asked.err);
+ return Number(/as #(\d+)/.exec(asked.out)?.[1]);
+ };
+ const alphaId = ask(box.repo, 'Ship alpha?');
+ const betaId = ask(other, 'Ship beta?');
+ ask(lone, 'Ship gamma?');
+ const listed = () => JSON.parse(box.run(box.repo, 'decisions', '--as', 'person', '--json').out);
+
+ // The person sees both repos of the project, each with its repo, and not another project's.
+ const text = box.run(box.repo, 'decisions', '--as', 'person');
+ assert.equal(text.code, 0, text.err);
+ assert.match(text.out, new RegExp(`alpha#${alphaId} .*Ship alpha\\?`));
+ assert.match(text.out, new RegExp(`beta#${betaId} .*Ship beta\\?`));
+ assert.doesNotMatch(text.out, /gamma|Ship gamma/);
+ const both = listed();
+ assert.deepEqual(both.decisions.map(({ repo, shout_id: id }) => `${repo}#${id}`).sort(), [`alpha#${alphaId}`, `beta#${betaId}`].sort());
+
+ // The local API lists the same decisions, each with its board and repo.
+ const view = await helpers.startView(box, box.repo);
+ t.after(view.stop);
+ const headers = { 'x-pullboard-key': view.key };
+ const boards = (await (await fetchFresh(`${view.base}/api/v1/boards`, { headers })).json()).boards;
+ const alphaBoard = boards.find(entry => entry.root === box.repo);
+ const betaBoard = boards.find(entry => entry.root === other);
+ const api = await (await fetchFresh(`${view.base}/api/v1/decisions?board=${alphaBoard.id}`, { headers })).json();
+ assert.equal(api.project, 'shop');
+ assert.deepEqual(api.decisions.map(({ board, repo }) => `${repo}:${board}`).sort(), [`alpha:${alphaBoard.id}`, `beta:${betaBoard.id}`].sort());
+
+ // Answering from the first repo closes the decision on the second repo's own board, and nowhere else.
+ const answered = box.run(box.repo, 'answer', `beta#${betaId}`, 'Yes, ship it.', '--as', 'person');
+ assert.equal(answered.code, 0, answered.err);
+ assert.deepEqual(withBoard(other, board => store.openDecisions(board, store.PERSON)), []);
+ assert.equal(withBoard(box.repo, board => store.openDecisions(board, store.PERSON)).length, 1);
+ assert.deepEqual(listed().decisions.map(({ repo }) => repo), ['alpha']);
+ const unknown = box.run(box.repo, 'answer', 'nowhere#1', 'x', '--as', 'person');
+ assert.notEqual(unknown.code, 0);
+ assert.match(unknown.err, /PROJECT_REPO_UNKNOWN/);
+});
+
+test('two repos of a project that share a name are addressed by folder, never guessed [N34]', { timeout: 120_000 }, () => { // budget: hang ceiling for two real repos' CLI runs; not a speed target.
+ const box = helpers.project();
+ const other = siblingRepo(box, 'repo-twin').repo;
+ nameRepo(box, box.repo, 'twin', 'shop');
+ nameRepo(box, other, 'twin', 'shop');
+ const ask = (root, text) => Number(/as #(\d+)/.exec(box.run(root, 'shout', 'person', text, '--decision').out)?.[1]);
+ ask(box.repo, 'Ship first?');
+ const secondId = ask(other, 'Ship second?');
+ const listed = JSON.parse(box.run(box.repo, 'decisions', '--as', 'person', '--json').out).decisions.map(({ repo }) => repo).sort();
+ assert.deepEqual(listed, ['repo', 'repo-twin']);
+ const guessed = box.run(box.repo, 'answer', `twin#${secondId}`, 'yes', '--as', 'person');
+ assert.notEqual(guessed.code, 0);
+ assert.match(guessed.err, /PROJECT_REPO_AMBIGUOUS/);
+ assert.equal(withBoard(other, board => store.openDecisions(board, store.PERSON)).length, 1, 'nothing closed on either board');
+ assert.equal(box.run(box.repo, 'answer', `repo-twin#${secondId}`, 'yes', '--as', 'person').code, 0);
+ assert.deepEqual(withBoard(other, board => store.openDecisions(board, store.PERSON)), []);
+ assert.equal(withBoard(box.repo, board => store.openDecisions(board, store.PERSON)).length, 1, 'the same-numbered question here stays open');
+});
++
+
+ test('a non-approver device without a signed member list receives no board key [H15,E17]', async t => {
+ const folder = mkdtempSync(join(tmpdir(), 'pullboard-handover-membership-'));
+ t.after(() => rmSync(folder, { recursive: true, force: true }));
+ const box = helpers.project();
+ const state = { board: withBoard(box.repo, store.boardId), repository: 'fixture/repository', login: 'alice' };
+ const boardKey = randomBytes(32);
+ /** Make an actual SSH signature and device key, independent of what the malicious relay asserts. */
+ async function request(login) {
+ const file = join(folder, login);
+ const made = runFixtureChild('ssh-keygen', ['-q', '-t', 'ed25519', '-N', '', '-f', file], { encoding: 'utf8' });
+ assert.equal(made.status, 0, 'OpenSSH creates the private fixture signing key');
+ const device = await createDeviceKeys();
+ const statement = { v: 1, board: state.board, repository: state.repository, login, device: device.deviceId,
+ publicKey: device.publicKey, engine: PEOPLE_VERSION, expires: Date.now() + 60_000 };
+ const input = file + '.statement';
+ writeFileSync(input, statementBytes(statement), { mode: 0o600 });
+ const signed = runFixtureChild('ssh-keygen', ['-Y', 'sign', '-q', '-n', 'pullboard-device-key', '-f', file, input], { encoding: 'utf8' });
+ assert.equal(signed.status, 0, "the request is genuinely signed by that login's SSH key");
+ return { device, signingKey: file, publicKey: readFileSync(file + '.pub', 'utf8').trim().split(' ').slice(0, 2).join(' '),
+ entry: { id: login, login, statement, signature: readFileSync(input + '.sig', 'utf8') } };
+ }
+ const outsider = await request('bob');
+ const member = await request('alice');
+ const body = { v: 1, board: state.board, repository: state.repository, login: 'alice' };
+ const identity = { body, signature: signSshVouch(JSON.stringify(['pullboard-person-identity', body]), 'pullboard-person-identity', member.signingKey) };
+ /** Present attacker-controlled relay entries while resolving SSH ownership directly for each account. */
+ async function answer(person) {
+ const deliveries = [];
+ await handOverBoardKeys(state, boardKey, {
+ root: box.repo, identity,
+ async send(_state, _path, options) {
+ if (options.method === 'PUT') { deliveries.push(options.body); return {}; }
+ return { requests: [person.entry] };
+ },
+ async githubKeys(login) { return login === person.entry.login ? [person.publicKey] : []; },
+ }, { err() {} });
+ assert.equal(deliveries.length, 1, 'each request gets one explicit refusal or delivery');
+ return deliveries[0];
+ }
+ const refused = await answer(outsider);
+ const leaked = refused.wrapped ? await unwrapDeviceBoardKey(outsider.device.privateKey,
+ JSON.parse(Buffer.from(refused.wrapped, 'base64url').toString('utf8')),
+ { board: state.board, device: outsider.device.deviceId, engine: PEOPLE_VERSION }) : null;
+ assert.equal(leaked !== null && Buffer.from(leaked).equals(boardKey), false, 'the outsider cannot decrypt the actual board key');
+ assert.equal(refused.refused?.code, 'RELAY_NOT_MEMBER', 'a valid outsider signature cannot establish trusted board membership');
+ assert.equal(Object.hasOwn(refused, 'wrapped'), false, 'the relay receives no key ciphertext it could unwrap as the outsider');
+ const allowed = await answer(member);
+ assert.ok(allowed.wrapped, 'the linked person can still bootstrap their own independently vouched device');
+ const unwrapped = await unwrapDeviceBoardKey(member.device.privateKey,
+ JSON.parse(Buffer.from(allowed.wrapped, 'base64url').toString('utf8')),
+ { board: state.board, device: member.device.deviceId, engine: PEOPLE_VERSION });
+ assert.deepEqual(Buffer.from(unwrapped), boardKey, 'the legitimate new device receives the actual board key');
+ });