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(core): a real landing writes ids, +N and the trailers [C7]

Corey Olson956a0501ad55
diff --git a/test/land.test.js b/test/land.test.js
index a9e899ae..70aac84a 100644
--- a/test/land.test.js
+++ b/test/land.test.js
@@ -467,7 +467,7 @@ test('land pushes one exact batch in verdict order and records each first-contai
assert.deepEqual(calls(box).slice(start), [[]], 'one full batch gate; pre-push reads its exact green tree stamp');
const merges = box.git(box.repo, 'rev-list', '--reverse', '--first-parent', `${base}..${result.batch.tip}`).split('\n');
for (const [index, id] of order.entries()) assert.equal(json(box, box.repo, 'show', String(id)).item_merged_commit, merges[index]);
- for (const [index, id] of order.entries()) assert.equal(box.git(box.repo, 'log', '-1', '--format=%b', merges[index]).trim(), `Pullboard-Item: #${id}`, 'each train merge body is only its item trailer, naming no lane branch');
+ for (const [index, id] of order.entries()) assert.equal(box.git(box.repo, 'log', '-1', '--format=%b', merges[index]).trim(), `Pullboard-Item: #${id}\nPullboard-Rows: G1`, 'each train merge body is only its trailers, naming no lane branch');
const receipt = events(box).filter((event) => event.event_kind === 'main-moved');
assert.equal(receipt.length, 1);
assert.equal(JSON.parse(receipt[0].event_detail).sha, result.batch.tip);
@@ -489,7 +489,7 @@ test('a train merge body is only the item trailer even when the local Git config
assert.equal(result.landed.length, 4);
const merges = box.git(box.repo, 'rev-list', '--reverse', '--first-parent', `${base}..${result.batch.tip}`).split('\n');
for (const [index, id] of result.landed.entries()) {
- assert.equal(box.git(box.repo, 'log', '-1', '--format=%b', merges[index]).trim(), `Pullboard-Item: #${id}`, 'merge.log=true appends no shortlog to the body');
+ assert.equal(box.git(box.repo, 'log', '-1', '--format=%b', merges[index]).trim(), `Pullboard-Item: #${id}\nPullboard-Rows: G1`, 'merge.log=true appends no shortlog to the body');
}
});
@@ -1252,8 +1252,9 @@ test('landing diagnostics retain unknown failures and merge subjects obey typed
// Node 24 node --test reports with spec by default: its failing-tests summary names each file and test (#1071).
const spec = landingFailures(`\u2716 red one (1.2ms)\n\u2716 failing tests:\n\ntest at web/red.test.js:6:1\n\u2716 red one (1.2ms)\n AssertionError\n\ntest at /elsewhere/x.test.js:1:1\n\u2716 outside (3ms)\n`, root);
assert.deepEqual(spec, [{ name: 'red one', file: 'web/red.test.js' }, { name: 'outside', file: null }], 'spec failures keep their file, and an outside path is unknown');
+ // The title keeps priority; the rows fill what is left, and +N counts the rest (RFC 0005).
const subject = landingSubject({ item_id: 91, item_title: 'A VERY LONG TITLE '.repeat(10), item_spec_ids: 'B3,R3' });
- assert.equal(subject, 'chore(merge): a very long title a very long title a very long [B3,R3]');
+ assert.equal(subject, 'chore(merge): a very long title a very long title a very long title [+2]');
assert.ok(subject.length <= 72);
});
diff --git a/test/landing-message.test.js b/test/landing-message.test.js
new file mode 100644
index 00000000..5c3cb772
--- /dev/null
+++ b/test/landing-message.test.js
@@ -0,0 +1,92 @@
+/** A real landing writes the shared header and trailers for an item citing 36 rows and for one refrozen after its claim (RFC 0005) [C7,B3,R3]. */
+import assert from 'node:assert/strict';
+import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { after, test } from 'node:test';
+import { parseCommitMessage } from '../src/commit-message.js';
+import { createE2eHelpers } from './e2e-helpers.js';
+
+const e2e = createE2eHelpers();
+after(e2e.cleanup);
+const { sandbox, commitFile } = e2e;
+
+/** The 36 approved rows Z1..Z36, in spec order. */
+const ROWS = Array.from({ length: 36 }, (_, index) => `Z${index + 1}`);
+
+/** A local-only repo with a spec of G1 and Z1..Z36, landing into its own trunk with a trivial gate. */
+function localProject() {
+ const box = sandbox();
+ const repo = join(box.dir, 'message-repo');
+ mkdirSync(repo);
+ box.git(repo, 'init', '-q', '-b', 'main');
+ const initialized = box.run(repo, 'init');
+ assert.equal(initialized.code, 0, initialized.err);
+ const configFile = join(repo, 'pullboard.json');
+ const config = JSON.parse(readFileSync(configFile, 'utf8'));
+ writeFileSync(configFile, JSON.stringify({ ...config, gate: 'true', verify: 'any', lanes: { web: { owns: ['web/'], specs: ['G1', ...ROWS] } } }, null, 2));
+ writeFileSync(join(repo, 'SPEC.md'), `# Message fixture\n\n## Goals\n- G1 [approved, must] The result exists. | gate: true\n${ROWS.map((id) => `- ${id} [approved, must] Row ${id} holds. | gate: true`).join('\n')}\n`);
+ box.git(repo, 'add', '-A');
+ box.git(repo, 'commit', '-q', '-m', 'chore: configure local landing');
+ return { ...box, repo };
+}
+
+/** Add one web item and a builder worktree that claims it. */
+function claimedItem(box, title, specs, file) {
+ const added = box.run(box.repo, 'add', 'web', title, '--specs', specs.join(','), '--criterion', `${file} exists`, '--check', `test -f ${file}`, '--json');
+ assert.equal(added.code, 0, added.err);
+ const id = JSON.parse(added.out).item.item_id;
+ const made = box.run(box.repo, 'worktree', 'web', '--model', 'message-builder', '--json');
+ assert.equal(made.code, 0, made.err);
+ const path = JSON.parse(made.out).path;
+ const claimed = box.run(path, 'claim', String(id));
+ assert.equal(claimed.code, 0, claimed.err);
+ return { id, path, file };
+}
+
+/** Commit, submit and accept one item as the coordinator at its submitted commit. */
+function buildAndAccept(box, entry) {
+ const committed = commitFile(box, entry.path, entry.file, 'built\n', `feat(web): build ${entry.file.split('/').pop()} [Z1]`);
+ assert.equal(committed.status, 0, committed.stderr);
+ const submitted = box.run(entry.path, 'submit', String(entry.id), '--json');
+ assert.equal(submitted.code, 0, submitted.err);
+ const head = JSON.parse(submitted.out).commit;
+ box.git(box.repo, 'switch', '-q', '--detach', head);
+ try {
+ const verdict = box.run(box.repo, 'verify', String(entry.id), 'accept', '--as', 'coordinator', '--note', `${entry.file} exists at the submitted commit`);
+ assert.equal(verdict.code, 0, verdict.err);
+ } finally { box.git(box.repo, 'switch', '-q', 'main'); }
+}
+
+test('a landing batch writes ids that fit then +N, and every frozen row in spec order as the last paragraph [C7,B3,R3]', () => {
+ const box = localProject();
+ // 36 rows cited in scattered order: landing never refuses, and the trailer lists them in spec order.
+ const many = claimedItem(box, 'Land every cited row', [...ROWS].reverse(), 'web/many.txt');
+ // Rows cited out of order, then refrozen after the claim by a coordinator correction.
+ const refrozen = claimedItem(box, 'Refrozen after the claim', ['Z9', 'Z3', 'G1'], 'web/refrozen.txt');
+ const edited = box.run(box.repo, 'edit', String(refrozen.id), '--criterion', `${refrozen.file} exists after the correction`);
+ assert.equal(edited.code, 0, edited.err);
+ const again = box.run(refrozen.path, 'refreeze', String(refrozen.id));
+ assert.equal(again.code, 0, again.err);
+ const frozenRows = JSON.parse(JSON.parse(box.run(box.repo, 'show', String(refrozen.id), '--json').out).item_frozen).rows.map((row) => row.id);
+ assert.deepEqual([...frozenRows].sort(), ['G1', 'Z3', 'Z9'], 'the refreeze froze the corrected bar with its rows');
+ buildAndAccept(box, many);
+ buildAndAccept(box, refrozen);
+
+ const base = box.git(box.repo, 'rev-parse', 'main');
+ const landed = box.run(box.repo, 'land', '--json');
+ assert.equal(landed.code, 0, landed.err || landed.out);
+ const receipt = JSON.parse(landed.out);
+ assert.deepEqual([...receipt.landed].sort(), [many.id, refrozen.id].sort());
+ const merges = box.git(box.repo, 'rev-list', '--reverse', '--first-parent', `${base}..${receipt.batch.tip}`).split('\n').filter(Boolean);
+ const messages = new Map(merges.map((commit) => {
+ const message = box.git(box.repo, 'log', '-1', '--format=%B', commit);
+ return [parseCommitMessage(message).item, message];
+ }));
+ assert.equal(messages.get(many.id),
+ `chore(merge): land every cited row [Z1,Z2,Z3,Z4,Z5,Z6,Z7,Z8,Z9,Z10,Z11,+25]\n\nPullboard-Item: #${many.id}\nPullboard-Rows: ${ROWS.join(',')}`);
+ assert.equal(messages.get(refrozen.id),
+ `chore(merge): refrozen after the claim [G1,Z3,Z9]\n\nPullboard-Item: #${refrozen.id}\nPullboard-Rows: G1,Z3,Z9`);
+ for (const message of messages.values()) assert.ok(message.split('\n')[0].length <= 72, message);
+ // Git's own trailer reader agrees with the shared parser.
+ assert.equal(box.git(box.repo, 'log', '-1', '--format=%(trailers:key=Pullboard-Rows,valueonly)', merges.find((commit) => box.git(box.repo, 'log', '-1', '--format=%B', commit) === messages.get(many.id))), ROWS.join(','));
+});