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: prove unnamed links and all-board computer names

Corey Olson81e6d5a0eb0a
diff --git a/docs/api.md b/docs/api.md
index 34edf335..2794c630 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -324,6 +324,8 @@ Only the coordinator sets or edits an item's `--check`. `pullboard check [id]` p
| `error` | `code:string`, `message:string`, `next:string` |
<!-- api-refusal-shapes:end -->
+`relay on`, `relay on --all`, and `relay join <code>` accept `--name "<computer>"` for a person-given display name. Coordinator holds, refusals and device lists use that name; unnamed computers keep `computer <last 8 of machine id>`. Labels never come from a hostname or path.
+
`relay on`, `relay`, and `relay off` share the relay result shape. Successful `pullboard relay recover --skip N` returns that same shape with optional `skipped: N` naming the explicitly refused sequence and `adopted: true` when it adopts a different authenticated person checkpoint that proves the same blocked refusal. Every relay result includes `recovery: { pending, skip, next }`; when a saved recovery is pending, `next` is the exact retry command. The `behind` count remains the number of pending uploads and does not include recovery. `status` includes this relay object alongside the local board summary. Human status and relay output show the recovery sequence and retry command when one is saved. The local `agent_last_shout_id` inbox read cursor is metadata: recovery ignores only that field in its guarded digest and preserves the greater valid cursor for matching agents. Other native changes remain protected; if a semantic local write changes while recovery is pending, the CLI preserves it and refuses automatic restoration. Exporting alone does not unblock that conflict; this prototype has no merge or discard command, so the person must reconcile the export and remote checkpoint before continuing. Successful results may include `diagnostics` for a relay refusal or inactivity notice; a local move still succeeds when its upload must wait. Device sign-in instructions are written immediately to stderr, including with `--json`, so the person can sign in before the command returns.
With `"relay": { "outbox": true }` in the committed `pullboard.json` (off by default), a board move on a link whose baseline the relay accepted no longer fails while the relay is unavailable. The move is sealed into this machine's relay outbox in the order it was made, made on this machine at once, and the command exits 0. The relay result then carries `outbox: [{id, operation, item, actor, queuedAt}]`, counted in `behind`, and `pullboard show <id> --json` carries `relayPending` for the item's queued moves. The next command that reaches the relay replays the outbox first, in order: a move the relay already holds from a lost reply is not sent twice, and a move refused at replay, because another machine's move came first, is kept in `outboxRefusals: [{move, queuedAt, code, message, earlier: [{sequence, move}]}]` with the moves the relay ordered before it. While queued moves wait, `RELAY_OUTBOX_PENDING` refuses to apply other machines' moves underneath them.
diff --git a/test/relay-computer-name.test.js b/test/relay-computer-name.test.js
index 602a800d..a072831b 100644
--- a/test/relay-computer-name.test.js
+++ b/test/relay-computer-name.test.js
@@ -10,6 +10,7 @@ import { requireCoordinatorHold } from '../src/coordinator-hold.js';
import { coordinatorHolder } from '../src/coordinator-hold.js';
import { COMPUTER_NAME_ENGINE } from '../src/computer-name-engine.js';
import { openBoard, closeBoard } from '../src/board.js';
+import { readFileSync } from 'node:fs';
test('linked computers use person-given names in coordinator holds and devices [E19,H16]', { timeout: relayWorkBudgetMs(12) }, async t => { // budget: real two-device CLI sign-in, pairing, takeover and cleanup; no speed target.
const box = await relayClientFixture(t);
@@ -38,6 +39,22 @@ test('linked computers use person-given names in coordinator holds and devices [
}
});
+test('linked computers without names use the machine tail in real refusals and devices [E19]', { timeout: relayWorkBudgetMs(12) }, async t => { // budget: real unnamed two-device pairing and refusal, not a speed target.
+ const box = await relayClientFixture(t);
+ await box.link();
+ const pairing = await box.cli('relay', 'pair');
+ const other = await box.otherDeviceJoin(pairing.document.code);
+ assert.equal((await box.cli('add', box.lane, 'Unnamed coordinator')).code, 0);
+ const refused = await other.cli('add', box.lane, 'Other unnamed coordinator');
+ const machine = JSON.parse(readFileSync(box.linkFile, 'utf8')).machine;
+ assert.equal(refused.document?.error?.code, 'COORDINATOR_HELD');
+ assert.ok(refused.document.error.message.includes(`computer ${machine.slice(-8)}`));
+ const roster = await box.cli('relay', 'devices');
+ assert.equal(roster.code, 0);
+ assert.equal(roster.document.computers[0].name, null);
+ assert.equal(JSON.stringify(roster.document).includes(hostname()), false);
+});
+
test('unnamed computers retain ID-tail labels and invalid names are refused [E19,H16]', () => {
assert.equal(computerLabel('machine-1234567890'), 'computer 34567890');
assert.equal(computerLabel(undefined), 'another main checkout');
diff --git a/test/relay-setup.test.js b/test/relay-setup.test.js
index ce586b41..cb732ab4 100644
--- a/test/relay-setup.test.js
+++ b/test/relay-setup.test.js
@@ -242,7 +242,7 @@ const CLI = resolve(import.meta.dirname, '../bin/pullboard.js');
/** Pair a stand-in phone through the real relay: Node signs the same enrollment the phone page sends. */
async function pairPhone(box, t) {
- const child = startFixtureChild(process.execPath, [CLI, 'relay', 'on', '--all', '--url', box.origin, '--json'], { cwd: box.root, env: box.env, stdio: ['ignore', 'pipe', 'pipe'] });
+ const child = startFixtureChild(process.execPath, [CLI, 'relay', 'on', '--all', '--url', box.origin, '--name', 'Kitchen computer', '--json'], { cwd: box.root, env: box.env, stdio: ['ignore', 'pipe', 'pipe'] });
t.after(() => { if (child.exitCode === null) child.kill('SIGTERM'); });
const exited = new Promise(done => child.once('close', done));
const machineFile = join(box.env.PULLBOARD_HOME, 'relay-machine/state.json');
@@ -324,6 +324,7 @@ test('relay devices names phones and joined computers with paired date and board
// The joined computer never paired the phone: it lists it by short id from the relay, with its status and board.
const there = await joined.cli('relay', 'devices');
assert.equal(there.code, 0, 'relay devices succeeds on the joined computer');
+ assert.equal(there.document.computers[0].name, 'Kitchen computer', 'on --all retains the explicit computer name');
assert.equal(there.document.devices.length, 1, "the joined computer lists the linked computer's phone");
const [phoneThere] = there.document.devices;
assert.deepEqual([phoneThere.deviceId, phoneThere.pairedHere, phoneThere.label, phoneThere.revoked, phoneThere.boards],