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(land): a train merge body and the host scan ignore config [B3,R3,C1]

Corey Olson89214026a2c4
diff --git a/src/hooks.js b/src/hooks.js
index c836771e..cf42977c 100644
--- a/src/hooks.js
+++ b/src/hooks.js
@@ -190,9 +190,11 @@ export function machineNames(sources = { host: hostname(), computer: computerNam
*/
export function machineNameProblems(root, range, { refuse, say, names = machineNames() }) {
if (!names.length) return;
- const records = git(root, ['log', '--format=%H%x1f%B%x1e', range]).split('\x1e').filter(Boolean);
- for (const record of records) {
- const [sha, message = ''] = record.trim().split('\x1f');
+ // The SHAs come from rev-list and each message is read on its own, so no character in a message can
+ // change where another message starts or ends.
+ const shas = git(root, ['rev-list', range]).split('\n').filter(Boolean);
+ for (const sha of shas) {
+ const message = git(root, ['log', '-1', '--format=%B', sha]);
const lower = message.toLowerCase();
if (!names.some((name) => lower.includes(name))) continue;
const short = sha.slice(0, 12);
diff --git a/src/land.js b/src/land.js
index 82f21ae6..499af1c9 100644
--- a/src/land.js
+++ b/src/land.js
@@ -163,7 +163,8 @@ async function mergeGroup(state, items) {
const stale = verdictProjector(state.root, state.board, { main: batch.base }).state(item);
if (stale) throw staleVerdictRefusal(item, stale);
// The body is the item trailer alone: the subject carries the title, and no lane branch is named [B3,R3].
- const result = tryGit(batch.root, ['merge', '--no-ff', checked, '-m', landingSubject(item), '-m', `Pullboard-Item: #${item.item_id}`]);
+ // merge.log is switched off on this call, so a local Git config cannot append a shortlog to the body.
+ const result = tryGit(batch.root, ['-c', 'merge.log=false', 'merge', '--no-ff', '--no-log', checked, '-m', landingSubject(item), '-m', `Pullboard-Item: #${item.item_id}`]);
if (result.status !== 0) {
const files = tryGit(batch.root, ['diff', '--name-only', '--diff-filter=U']).stdout.split('\n').filter(Boolean);
if (!files.length) throw new Refused('LAND_MERGE', `merge of #${item.item_id} failed outside a conflict: ${result.stderr || result.stdout}; inspect ${batch.root} and its hooks before adopting`);
diff --git a/test/land.test.js b/test/land.test.js
index 4892d9aa..d15bd6b7 100644
--- a/test/land.test.js
+++ b/test/land.test.js
@@ -495,6 +495,19 @@ test('land pushes one exact batch in verdict order and records each first-contai
assert.equal(JSON.parse(lane.out).error?.code, 'COORDINATOR_ONLY');
});
+test('a train merge body is only the item trailer even when the local Git config logs merges [B3,R3]', () => {
+ const box = landProject();
+ verifiedFour(box, { order: [0, 1, 2, 3] });
+ const base = box.git(box.repo, 'rev-parse', 'main');
+ box.git(box.repo, 'config', 'merge.log', 'true');
+ const result = json(box, box.repo, 'land', '--max', '4');
+ 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');
+ }
+});
+
test('land bisects a real red, blocks stale proof and refuses an unverified stack [B3,R3,E8]', () => {
const box = landProject();
box.env.LAND_SUPPRESS_RED = '1';
diff --git a/test/worktree-start.test.js b/test/worktree-start.test.js
index c9a8d556..136d63ed 100644
--- a/test/worktree-start.test.js
+++ b/test/worktree-start.test.js
@@ -288,6 +288,17 @@ test('a submit naming a stand-in host refuses at HOST_NAME, and only warns when
(error) => error.code === 'HOST_NAME' && /names this machine/u.test(error.message), 'a stand-in computer name is refused');
});
+test('a stand-in host after a field separator in a commit body is still refused [C1]', () => {
+ const box = sandbox();
+ const { repo } = project('true', box);
+ const base = box.git(repo, 'rev-parse', 'HEAD');
+ const message = join(box.dir, 'separator-message.txt');
+ writeFileSync(message, 'chore: note a separator\n\nbefore \u001f and \u001e then fixture-host-892 after\n');
+ box.git(repo, 'commit', '-q', '--allow-empty', '-F', message);
+ assert.throws(() => machineNameProblems(repo, `${base}..HEAD`, { refuse: true, say: () => {}, names: ['fixture-host-892'] }),
+ (error) => error.code === 'HOST_NAME', 'a name after U+001F and U+001E in the body is found');
+});
+
/**
* Build a claimed web item whose only commit names this machine in its message, then submit it. The
* setting is written to the main checkout first, since submit reads the accepted main's policy [C1].