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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(core): only a landing may skip rows for a rowless item [C7]
Corey Olsonf351db6b9443
diff --git a/src/commands/hook.js b/src/commands/hook.jsindex d991a311..1dfdf962 100644--- a/src/commands/hook.js+++ b/src/commands/hook.js@@ -2,6 +2,7 @@import * as store from '../board.js';import { pendingCommitSignoffProblem } from '../commit-signoff.js';import { landingBatchOwnsRoot } from '../landing-candidates.js';+import { landingRows } from '../landing-message.js';import {hookRead,readStdin,@@ -86,7 +87,11 @@ export async function hookCommand(io, { first, second }) {return agent ? store.listItems(board, { lane: agent.agent_lane }).filter(item =>item.item_status === 'claimed' && item.item_owner === agent.agent_id).map(item => item.item_id) : [];}) ?? []);- problems = commitMsgProblems(message, { rules: ctx.config.commits, spec, doctrine: ctx.doctrine, claimedItems });+ // Only the main checkout or a landing worktree merges a verified item; elsewhere no trailer exempts a header.+ const rowlessLandings = hookRead(ctx, (board) => (info.isMain || store.landingBatches(board).some((batch) => landingBatchOwnsRoot(batch, info.root))+ ? store.listItems(board, { all: true }).filter((item) => item.item_status === 'verified' && !item.item_merged_commit && !landingRows(item).length).map((item) => item.item_id)+ : [])) ?? [];+ problems = commitMsgProblems(message, { rules: ctx.config.commits, spec, doctrine: ctx.doctrine, claimedItems, rowlessLandings });} else if (first === 'pre-push') {const refsText = await readStdin(io.stdin);if (gitBoardDataPush(info.root, refsText)) {diff --git a/src/hooks.js b/src/hooks.jsindex a7b3dab8..d701a57a 100644--- a/src/hooks.js+++ b/src/hooks.js@@ -123,10 +123,11 @@ function citationGuide(spec, type) {* Every rule a commit message breaks (C1, C2). Merges, reverts and fixups git wrote are exempt.** @param {string} raw - The message as git hands it, comments included.- * @param {{ rules: any, spec: any, doctrine?: any, claimedItems?: number[] }} context+ * @param {{ rules: any, spec: any, doctrine?: any, claimedItems?: number[], rowlessLandings?: number[] }} context+ * rowlessLandings: verified items citing no rows that a landing checkout may merge now.* @returns {string[]}*/-export function commitMsgProblems(raw, { rules, spec, doctrine = null, claimedItems = [] }) {+export function commitMsgProblems(raw, { rules, spec, doctrine = null, claimedItems = [], rowlessLandings = [] }) {const lines = raw.split('\n').filter((line) => !line.startsWith('#'));while (lines.length && !lines.at(-1)?.trim()) lines.pop();const [header = '', second, ...body] = lines;@@ -141,10 +142,10 @@ export function commitMsgProblems(raw, { rules, spec, doctrine = null, claimedItconst itemCitations = [...header.matchAll(/(?:^|\s)#([1-9]\d*)(?=\s|$)/gu)].map(match => Number(match[1]));const firstItem = !spec.rows.some(row => row.status === 'approved')&& itemCitations.some(id => claimedItems.includes(id));- // A generated landing message names its item in a trailer; one that cites no rows has no brackets and no- // Pullboard-Rows trailer, yet keeps the item's own type (RFC 0005), so the id rule reads the trailer.+ // A generated landing message keeps a rowless item's own type (RFC 0005), so it has no ids to cite. Only a+ // landing checkout, merging a verified item the board says cites no rows, passes on its trailer.const landing = parseCommitMessage(lines.join('\n'));- const rowlessLanding = landing.scope === 'merge' && landing.item !== null && landing.rows === null;+ const rowlessLanding = landing.scope === 'merge' && landing.rows === null && rowlessLandings.includes(landing.item);if (type && rules.requireIds.includes(type) && !ids.length && !firstItem && !rowlessLanding) {problems.push(citationGuide(spec, type),diff --git a/test/commit-message.test.js b/test/commit-message.test.jsindex 84ca0802..dead46b4 100644--- a/test/commit-message.test.js+++ b/test/commit-message.test.js@@ -162,7 +162,11 @@ test('one header per item type: the type is the item\'s commits\' first of feat,for (const type of ['feat', 'fix', 'test']) {const rowless = landingMessage({ ...item, item_spec_ids: '', item_lane: 'docs' }, { type });assert.equal(rowless.message, `${type}(merge): typed landing\n\nPullboard-Item: #40`);- assert.deepEqual(commitMsgProblems(rowless.message, { rules, spec }), [], `the commit hook accepts a rowless ${type} landing`);+ assert.deepEqual(commitMsgProblems(rowless.message, { rules, spec, rowlessLandings: [40] }), [], `a landing checkout accepts a rowless ${type} landing`);+ if (type !== 'test') {+ assert.notDeepEqual(commitMsgProblems(rowless.message, { rules, spec }), [], `outside a landing the ${type} trailer exempts nothing`);+ assert.notDeepEqual(commitMsgProblems(rowless.message.replace('#40', '#999'), { rules, spec, rowlessLandings: [40] }), [], 'another item\'s trailer exempts nothing');+ }}assert.equal(landingMessage({ ...item, item_spec_ids: '', item_lane: 'docs' }).header, 'docs(merge): typed landing', 'no typed commit: the lane rule');assert.notDeepEqual(commitMsgProblems('feat(core): add it', { rules, spec }), [], 'a work commit still cites its rows');diff --git a/test/landing-message.test.js b/test/landing-message.test.jsindex 9f540d1f..81891920 100644--- a/test/landing-message.test.js+++ b/test/landing-message.test.js@@ -32,7 +32,7 @@ function localProject() {/** 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');+ const added = box.run(box.repo, 'add', 'web', title, ...(specs.length ? ['--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');@@ -44,8 +44,8 @@ function claimedItem(box, title, specs, 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]`);+function buildAndAccept(box, entry, header = `feat(web): build ${entry.file.split('/').pop()} [Z1]`) {+ const committed = commitFile(box, entry.path, entry.file, 'built\n', header);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);@@ -90,3 +90,24 @@ test('a landing batch writes ids that fit then +N, and every frozen row in spec// 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(','));});++test('a rowless feat item lands under feat(merge) through the real hooks, and a seat cannot borrow that exemption [C7,B3,R3]', () => {+ const box = localProject();+ const rowless = claimedItem(box, 'Rowless feature', [], 'web/rowless.txt');+ buildAndAccept(box, rowless, 'feat(web): build the rowless feature [G1]');+ // A seat commit headed like a landing, naming the verified rowless item or an unknown one, still cites rows.+ const seat = claimedItem(box, 'Seat work', ['G1'], 'web/seat.txt');+ for (const id of [rowless.id, 999]) {+ const forged = commitFile(box, seat.path, `web/forged-${id}.txt`, 'forged\n', `feat(merge): unrelated work\n\nPullboard-Item: #${id}`);+ assert.notEqual(forged.status, 0, `a seat commit with Pullboard-Item: #${id} is refused`);+ assert.match(forged.stderr + forged.stdout, /spec rows/u);+ }+ 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);+ assert.deepEqual(JSON.parse(landed.out).landed, [rowless.id]);+ const merge = box.git(box.repo, 'rev-list', '--first-parent', '-n', '1', 'main');+ assert.notEqual(merge, base);+ assert.equal(box.git(box.repo, 'log', '-1', '--format=%B', merge), `feat(merge): rowless feature\n\nPullboard-Item: #${rowless.id}`,+ 'the item keeps its feat type with no brackets and no Pullboard-Rows trailer');+});