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(next): prove idle seats receive an actionable queue step [N2,I6]

Corey Olsonf671fe8fe00c
diff --git a/test/idle-seat.test.js b/test/idle-seat.test.js
new file mode 100644
index 00000000..eef1a910
--- /dev/null
+++ b/test/idle-seat.test.js
@@ -0,0 +1,45 @@
+/** @pullboard-test-input source-tree */
+/** Idle seats get actionable native queue guidance through CLI and session hooks [N2,I6]. */
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { test } from 'node:test';
+import { createE2eHelpers } from './e2e-helpers.js';
+import { runFixtureChild } from './fixture-child.js';
+
+test('a seat with no claim is sent to pullboard next and never told to wait for assignment [N2,I6]', (t) => {
+ const helpers = createE2eHelpers();
+ t.after(helpers.cleanup);
+ const box = helpers.project('true');
+ assert.equal(box.run(box.web, 'inbox', '--json').code, 0);
+ const resumed = box.run(box.web, 'resume', '--json');
+ assert.equal(resumed.code, 0, resumed.err || resumed.out);
+ const card = JSON.parse(resumed.out);
+ assert.equal(card.holding.length, 0);
+ assert.match(card.next, /^pullboard next(?:\s|$)/u, 'an idle seat pulls the ranked queue instead of waiting to be assigned');
+ assert.doesNotMatch(card.next, /wait for (?:an? )?assignment|wait to be assigned/iu);
+ const guide = readFileSync(join(box.repo, 'AGENTS.md'), 'utf8');
+ assert.match(guide, /no (?:active )?claim[\s\S]{0,100}pullboard next/iu, 'generated guidance states the idle-seat rule');
+ const settings = JSON.parse(readFileSync(join(box.repo, '.claude/settings.json'), 'utf8'));
+ const command = settings.hooks.SessionStart.flatMap(entry => entry.hooks).find(hook => /pullboard resume/u.test(hook.command)).command;
+ const hooked = runFixtureChild('/bin/sh', ['-c', command], { cwd: box.web, env: box.env, encoding: 'utf8' });
+ assert.equal(hooked.status, 0, hooked.failure || hooked.stderr || hooked.stdout);
+ assert.match(hooked.stdout, /next: pullboard next/u, 'the actual session hook gives the same queue instruction');
+ assert.doesNotMatch(hooked.stdout, /wait for (?:an? )?assignment|wait to be assigned/iu);
+ const empty = box.run(box.web, 'next', '--json');
+ assert.equal(empty.code, 1, empty.out);
+ const refusal = JSON.parse(empty.out).error;
+ assert.equal(refusal.code, 'NOTHING_FREE');
+ assert.match(refusal.message, /lane web/u);
+ assert.match(refusal.message, /route strong/u);
+ assert.match(refusal.message + refusal.next, /pullboard next --wait 9/u, 'no-work output names when to ask the queue again');
+ assert.equal(box.run(box.repo, 'add', 'web', 'Held work', '--criterion', 'A marker exists', '--check', 'test -f web/ready').code, 0);
+ assert.equal(box.run(box.repo, 'hold', 'web', '--reason', 'Release approval is pending').code, 0);
+ const held = box.run(box.web, 'next', '--json');
+ assert.equal(held.code, 1, held.out);
+ assert.match(JSON.parse(held.out).error.message, /Release approval is pending/u, 'a real lane hold is explained, not bypassed');
+ assert.equal(box.run(box.repo, 'hold', 'web', '--off').code, 0);
+ const next = box.run(box.web, 'next', '--json');
+ assert.equal(next.code, 0, next.err || next.out);
+ assert.equal(JSON.parse(next.out).item.item_title, 'Held work', 'normal next takes the work once its hold is released');
+});