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.

fix(init): set safe no-manifest gate [C7,B26]

Corey Olson0ca0be6940f2
diff --git a/docs/lifecycle.md b/docs/lifecycle.md
index 7731679b..2dc37f40 100644
--- a/docs/lifecycle.md
+++ b/docs/lifecycle.md
@@ -112,7 +112,7 @@ Each move checks its guards in this order and refuses with the first one that do
| DIRTY | the worktree has no uncommitted changes | commit your changes, then submit |
| UNTRACKED | the worktree has no untracked files | commit or ignore them, then submit |
| NO_COMMIT | there is a commit to submit | commit your work, then submit |
-| NO_GATE | the repo names a gate command | set "gate" in pullboard.json, e.g. "npm test" |
+| NO_GATE | the repo names a gate command | set "gate" in pullboard.json to "pullboard spec check", then commit it |
| OUTSIDE_LANE | the full claimed diff respects committed coordinator ownership | restore foreign paths or shout their owner |
| NO_POLICY | the full claimed diff respects committed coordinator ownership | restore the claim base or ask the coordinator to refreeze |
| BAD_CONFIG | the full claimed diff respects committed coordinator ownership | restore the committed coordinator configuration |
diff --git a/src/gate.js b/src/gate.js
index 88c7193b..e293f442 100644
--- a/src/gate.js
+++ b/src/gate.js
@@ -528,7 +528,7 @@ export async function withGateSlot(root, action, { landing = false, itemCheck =
*/
export async function runGate(root, config, { trustStamp = true, onWait, landing = false, agent, item = '', stages = false, waivers = [] } = {}) {
if (!config.gate.trim()) {
- throw new Refused('NO_GATE', 'no gate configured; set "gate" in pullboard.json, e.g. "npm test"');
+ throw new Refused('NO_GATE', 'no gate configured; set "gate" in pullboard.json to "pullboard spec check"', 'set "gate" in pullboard.json to "pullboard spec check", then commit it');
}
if (trustStamp && isStampedGreen(root)) return { isGreen: true, isCached: true, output: '', seconds: 0, log: '' };
return await withGateSlot(root, (lease) => fullGateRun(root, config, trustStamp, { waitMs: lease.waitMs, gateLease: lease, landing, stages, waivers }), {
@@ -576,7 +576,7 @@ export async function runStaticChecks(root, config, { agent, item = '', onWait,
* @returns {Promise<any>}
*/
export async function runSubmitGate(root, config, { base, trunk, changed, check, agent, item = '', kind = 'submit', onWait, onBrowserFallback }) {
- if (!config.gate.trim()) throw new Refused('NO_GATE', 'no gate configured; set "gate" in pullboard.json, e.g. "npm test"');
+ if (!config.gate.trim()) throw new Refused('NO_GATE', 'no gate configured; set "gate" in pullboard.json to "pullboard spec check"', 'set "gate" in pullboard.json to "pullboard spec check", then commit it');
await runStaticChecks(root, config, { agent, item, onWait, onBrowserFallback });
const selection = config.affectedTests
? selectAffectedTests(root, { base, trunk, changed })
diff --git a/src/init.js b/src/init.js
index 2fb611d2..9f24be4f 100644
--- a/src/init.js
+++ b/src/init.js
@@ -580,7 +580,7 @@ export function initRepo({ info, openBoardHere, register, closeBoard, model, per
const { root } = info;
const worktreeMode = existsSync(join(root, CONFIG_FILE)) ? loadConfig(root).worktrees : 'inside';
const doctrine = existsSync(join(root, CONFIG_FILE)) ? loadConfig(root).practice : doctrineFile(root);
- const gate = detectGate(root);
+ const gate = detectGate(root) || 'pullboard spec check';
const configured = configuredGate(root);
const written = [];
/** Record only paths setup actually writes; unrelated files never enter its staging command. */
diff --git a/src/machine.js b/src/machine.js
index 96bc9886..1409d579 100644
--- a/src/machine.js
+++ b/src/machine.js
@@ -144,7 +144,7 @@ export const GUARDS = [
{ id: 'treeClean', refuse: 'DIRTY', rule: 'the worktree has no uncommitted changes', next: 'commit your changes, then submit', source: 'cli' },
{ id: 'nothingUntracked', refuse: 'UNTRACKED', rule: 'the worktree has no untracked files', next: 'commit or ignore them, then submit', source: 'cli' },
{ id: 'hasCommit', refuse: 'NO_COMMIT', rule: 'there is a commit to submit', next: 'commit your work, then submit', source: 'cli' },
- { id: 'gateConfigured', refuse: 'NO_GATE', rule: 'the repo names a gate command', next: 'set "gate" in pullboard.json, e.g. "npm test"', source: 'cli' },
+ { id: 'gateConfigured', refuse: 'NO_GATE', rule: 'the repo names a gate command', next: 'set "gate" in pullboard.json to "pullboard spec check", then commit it', source: 'cli' },
{ id: 'withinLane', refuse: 'OUTSIDE_LANE', alsoRefuses: [{ code: 'NO_POLICY', next: 'restore the claim base or ask the coordinator to refreeze' }, { code: 'BAD_CONFIG', next: 'restore the committed coordinator configuration' }, { code: 'GIT_GRAFTS', next: 'ask the coordinator to remove the Git graft file before retrying' }], rule: 'the full claimed diff respects committed coordinator ownership', next: 'restore foreign paths or shout their owner', source: 'cli' },
{ id: 'trunkMergeClean', refuse: 'MERGE_CONFLICT', alsoRefuses: [{ code: 'MERGE_CHECK_FAILED', next: 'use Git 2.38 or newer, restore its objects and retry' }, { code: 'NO_POLICY', next: 'restore the primary repository metadata' }, { code: 'NO_TRUNK', next: 'check out the trunk branch in the main checkout once and run pullboard inbox' }], rule: 'the candidate merges cleanly into the current primary branch without changing an index or worktree', next: 'merge the trunk into your branch, resolve conflicts, commit and resubmit', source: 'cli' },
{ id: 'noUnverifiedStack', refuse: 'STACKED_ON_UNVERIFIED', rule: "the candidate range contains no other item's unverified submitted commit", next: 'wait for that item to be accepted, or rebuild without its commits', source: 'cli' },
diff --git a/src/next-steps.js b/src/next-steps.js
index f037345c..b89688e1 100644
--- a/src/next-steps.js
+++ b/src/next-steps.js
@@ -351,7 +351,7 @@ export const NEXT_STEPS = Object.freeze({
NO_FILE: 'check the path and pass a file that exists',
NO_FILES_LANE: 'run pullboard lanes, then file the build in a lane that owns files, or pass --after <id> if it reviews that item',
NO_FIRST_COMMIT: 'commit the repo, then pullboard spec signers add',
- NO_GATE: 'set "gate" in pullboard.json, such as "npm test", and commit it',
+ NO_GATE: 'set "gate" in pullboard.json to "pullboard spec check", then commit it',
NO_ITEM: 'find the item id: pullboard list --all',
NO_LANE: 'pick a lane from pullboard lanes',
NO_LINES: 'name a line range inside the file',
diff --git a/test/init-gate.test.js b/test/init-gate.test.js
index 9ec13f5e..33d995da 100644
--- a/test/init-gate.test.js
+++ b/test/init-gate.test.js
@@ -1,6 +1,6 @@
/** Check that init only resolves the detected gate executable and never runs it [I1, I2]. */
import assert from 'node:assert/strict';
-import { accessSync, chmodSync, constants as fsConstants, existsSync, mkdirSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs';
+import { accessSync, chmodSync, constants as fsConstants, existsSync, mkdirSync, readFileSync, rmSync, statSync, symlinkSync, writeFileSync } from 'node:fs';
import { delimiter, join } from 'node:path';
import { after, test } from 'node:test';
import { createE2eHelpers } from './e2e-helpers.js';
@@ -115,3 +115,56 @@ test('init says when its gate command cannot run [I1, I2]', () => {
'an explicitly active Poetry environment is checked');
assert.equal(existsSync(poetryMarker), false, 'init does not execute a gate found in the active Poetry environment');
});
+
+test('a repo without package.json is told a gate that fits it [C7,B26]', () => {
+ const box = e2e.sandbox();
+ const root = join(box.dir, 'no-package');
+ mkdirSync(root);
+ box.git(root, 'init', '-q', '-b', 'main');
+ mkdirSync(join(root, 'app'));
+
+ const initialized = box.run(root, 'init');
+ assert.equal(initialized.code, 0, initialized.err || initialized.out);
+ assert.equal(existsSync(join(root, 'package.json')), false, 'the newcomer repo has no package manifest');
+ const initializedGate = JSON.parse(readFileSync(join(root, 'pullboard.json'), 'utf8')).gate;
+
+ // Keep a legacy empty-gate board to exercise the real NO_GATE refusal after init.
+ const config = JSON.parse(readFileSync(join(root, 'pullboard.json'), 'utf8'));
+ config.gate = '';
+ writeFileSync(join(root, 'pullboard.json'), JSON.stringify(config, null, 2));
+ const lane = box.run(root, 'lane', 'add', 'app', '--owns', 'app/');
+ assert.equal(lane.code, 0, lane.err || lane.out);
+ box.git(root, 'add', '-A');
+ box.git(root, 'commit', '-q', '-m', 'chore: set up the no-manifest board');
+
+ const added = box.run(root, 'add', 'app', 'No-manifest newcomer change',
+ '--criterion', 'the result file is present', '--check', 'test -f app/result.txt', '--json');
+ assert.equal(added.code, 0, added.err || added.out);
+ const id = String(JSON.parse(added.out).item.item_id);
+ const worktree = join(box.dir, 'app-agent');
+ box.git(root, 'worktree', 'add', '-q', '-b', 'app/one', worktree);
+ const joined = box.run(worktree, 'join', 'app');
+ assert.equal(joined.code, 0, joined.err || joined.out);
+ const claimed = box.run(worktree, 'claim', id, '--json');
+ assert.equal(claimed.code, 0, claimed.err || claimed.out);
+ mkdirSync(join(worktree, 'app'), { recursive: true });
+ writeFileSync(join(worktree, 'app', 'result.txt'), 'done\n');
+ box.git(worktree, 'add', 'app/result.txt');
+ box.git(worktree, 'commit', '-q', '-m', 'chore: finish the newcomer change');
+
+ const submitted = box.run(worktree, 'submit', id, '--json');
+ assert.equal(submitted.code, 1, submitted.err || submitted.out);
+ const refusal = JSON.parse(submitted.out).error;
+ assert.equal(refusal.code, 'NO_GATE', submitted.out);
+ assert.deepEqual({
+ initializedGate,
+ refusalCode: refusal.code,
+ nextNamesInitCommand: /pullboard spec check/u.test(refusal.next),
+ nextNamesUnavailableNpm: /\bnpm test\b/u.test(refusal.next),
+ }, {
+ initializedGate: 'pullboard spec check',
+ refusalCode: 'NO_GATE',
+ nextNamesInitCommand: true,
+ nextNamesUnavailableNpm: false,
+ });
+});
diff --git a/test/resume-flow.test.js b/test/resume-flow.test.js
index b8e7b93f..c22679d6 100644
--- a/test/resume-flow.test.js
+++ b/test/resume-flow.test.js
@@ -143,7 +143,7 @@ test('resume asks the coordinator to commit an applied row file [I1,L3]', t => {
// Both at once: each owner gets exactly its own files, and an unrelated dirty file is never setup.
const mixed = applied();
const config = JSON.parse(readFileSync(join(mixed.repo, 'pullboard.json'), 'utf8'));
- writeFileSync(join(mixed.repo, 'pullboard.json'), JSON.stringify({ ...config, gate: 'pullboard spec check' }, null, 2) + '\n');
+ writeFileSync(join(mixed.repo, 'pullboard.json'), JSON.stringify({ ...config, gate: 'npm test' }, null, 2) + '\n');
const both = resume(mixed);
assert.ok(both.lines.includes(`${ROW_LINE}${commit(mixed, ['SPEC.md'])}`), both.lines.join('\n'));
assert.ok(both.lines.includes(`${PERSON_LINE}${add(mixed, ['pullboard.json'])}`), both.lines.join('\n'));
@@ -750,6 +750,10 @@ test('a reused authenticated view completes setup for its new board [N26,N32]',
/** Drive the same actual commands a newcomer receives, with a private fixture person approval. */
async function finishSetup(box, observe = () => {}) {
+ // Exercise an explicitly unconfigured gate even when init supplies a safe starter default.
+ const configFile = join(box.repo, 'pullboard.json');
+ const config = JSON.parse(readFileSync(configFile, 'utf8'));
+ writeFileSync(configFile, JSON.stringify({ ...config, gate: '' }));
/** Assert the next setup block in both the actual text and JSON CLI output. */
function step(number) {
const text = box.run(box.repo, 'resume');
@@ -816,6 +820,9 @@ test('resume walks a new board through setup one step at a time [N32,N19]', asyn
test('resume names lane add to make a lane [I1,N32]', t => {
const box = releaseFixture(t, { freshSetup: true });
+ const configFile = join(box.repo, 'pullboard.json');
+ const config = JSON.parse(readFileSync(configFile, 'utf8'));
+ writeFileSync(configFile, JSON.stringify({ ...config, gate: '' }, null, 2));
mkdirSync(join(box.repo, 'app'));
const drafted = box.run(box.repo, 'spec', 'draft', 'Describe the first thing the person wants.', '--json');
assert.equal(drafted.status, 0, drafted.failure || drafted.stderr || drafted.stdout);