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): a rowless item lands under its own type [C7]
Corey Olson9cfe9ce07e49
diff --git a/src/cli.js b/src/cli.jsindex 99515234..a0adf805 100644--- a/src/cli.js+++ b/src/cli.js@@ -1444,17 +1444,16 @@ export async function addBlueprint(ctx, board, me, blueprint, { report = true, r* @param {any} info* @param {any} item* @param {string} [commit] - The exact checked composition the acceptance authorizes.- * @param {{ spec?: any, requireIds?: string[] }} [options] - The spec the trailer's rows are ordered by, and- * the commit types the hook requires ids for.+ * @param {{ spec?: any }} [options] - The spec the trailer's rows are ordered by.* @returns {string}*/-export function landNext(info, item, commit = item.item_commit, { spec = null, requireIds } = {}) {+export function landNext(info, item, commit = item.item_commit, { spec = null } = {}) {const mainRoot = primaryCheckoutRoot(info);const trunk = mainCheckout(info.root);const branch = trunk?.branch ?? '';const remote = landingRemote(info.root, branch);const command = remote ? 'pullboard land'- : handMergeCommand(item, commit, { root: info.root, base: trunk?.commit, spec, requireIds, quote: shellWord });+ : handMergeCommand(item, commit, { root: info.root, base: trunk?.commit, spec, quote: shellWord });if (!mainRoot) return `next: could not safely locate the primary checkout; run from the main checkout: ${command}`;if (remote) return `next: the coordinator lands it: ${cdTo(mainRoot)} ${command}`;return `next: this repo has no remote for pullboard land to push to, so the coordinator merges it on ${branch.replace(/^refs\/heads\//u, '') || 'the trunk'}: ${cdTo(mainRoot)} ${command}`;diff --git a/src/commands/verify.js b/src/commands/verify.jsindex e264472d..c3016b1a 100644--- a/src/commands/verify.js+++ b/src/commands/verify.js@@ -221,7 +221,7 @@ export async function verifyHere(ctx, id, { second, values }) {ctx.io.say(result.decision === 'ACCEPT'? `verified #${id}: ${result.reason}${result.check === 'none' ? '; no frozen check ran' : ''}${approvalRows.length ? `; ${agentApprovalLine(approvalRows)}` : ''}${verifiedTiming}`: `rejected #${id}: ${result.reason}; it is open again for rework`);- if (accepted) ctx.io.say(landNext(ctx.info, accepted, acceptedLandingCommit, { spec: loadSpec(ctx.info.root, ctx.config), requireIds: ctx.config.commits?.requireIds }));+ if (accepted) ctx.io.say(landNext(ctx.info, accepted, acceptedLandingCommit, { spec: loadSpec(ctx.info.root, ctx.config) }));return 0;}diff --git a/src/hooks.js b/src/hooks.jsindex fde74ab4..a7b3dab8 100644--- a/src/hooks.js+++ b/src/hooks.js@@ -41,6 +41,7 @@ import {LEGACY_DOCTRINE_FILE,} from './config.js';import { Refused } from './refused.js';+import { parseCommitMessage } from './commit-message.js';import { outOfLane } from './lanes.js';import {citedIds,@@ -140,7 +141,11 @@ 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));- if (type && rules.requireIds.includes(type) && !ids.length && !firstItem) {+ // 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.+ const landing = parseCommitMessage(lines.join('\n'));+ const rowlessLanding = landing.scope === 'merge' && landing.item !== null && landing.rows === null;+ if (type && rules.requireIds.includes(type) && !ids.length && !firstItem && !rowlessLanding) {problems.push(citationGuide(spec, type),);diff --git a/src/landing-message.js b/src/landing-message.jsindex 5c819123..d5012f49 100644--- a/src/landing-message.js+++ b/src/landing-message.js@@ -54,16 +54,15 @@ export function landingRows(item, spec = null) {* The whole landing message from board state through the shared builder [B3,R3]: header* `<type>(merge): <title> [<rows that fit>,+N]`, then `Pullboard-Item` and `Pullboard-Rows` as the* last paragraph. It never refuses for how many rows an item cites. The type is the item's own- * (from its commits); with none, or with one the commit hook would refuse without rows, the lane's.+ * (from its commits), with or without rows; only an item with no typed commit takes the lane rule.** @param {any} item- * @param {{ spec?: { rows: { id: string }[] } | null, type?: string | null, requireIds?: string[] }} [options]+ * @param {{ spec?: { rows: { id: string }[] } | null, type?: string | null }} [options]* @returns {{ header: string, body: string, trailers: string, message: string, rows: string[], type: string }}*/-export function landingMessage(item, { spec = null, type = null, requireIds = ['feat', 'fix'] } = {}) {+export function landingMessage(item, { spec = null, type = null } = {}) {const rows = landingRows(item, spec);- const own = type && !(requireIds.includes(type) && !rows.length) ? type : null;- const chosen = own ?? (rows.length ? 'chore' : (LANE_MERGE_TYPES[item.item_lane] ?? 'chore'));+ const chosen = type ?? (rows.length ? 'chore' : (LANE_MERGE_TYPES[item.item_lane] ?? 'chore'));return { ...buildCommitMessage({ type: chosen, scope: 'merge', title: item.item_title, item: item.item_id, rows }), rows, type: chosen };}@@ -77,13 +76,13 @@ export function landingSubject(item, options = {}) {* writes them, so a problem here is a Pullboard defect, never something an item's citations fix.** @param {any[]} items- * @param {{ spec: { rows: { id: string }[] } | null, typeOf?: (item: any) => string | null, requireIds?: string[] }} context+ * @param {{ spec: { rows: { id: string }[] } | null, typeOf?: (item: any) => string | null }} context* @returns {Map<number, ReturnType<typeof landingMessage>>}*/-export function checkLandingMessages(items, { spec, typeOf = () => null, requireIds = ['feat', 'fix'] }) {+export function checkLandingMessages(items, { spec, typeOf = () => null }) {const messages = new Map();for (const item of items) {- const built = landingMessage(item, { spec, type: typeOf(item), requireIds });+ const built = landingMessage(item, { spec, type: typeOf(item) });const problems = commitMessageProblems(built.message, { item: item.item_id, rows: built.rows });if (problems.length) {throw new Refused('LAND_HEADER', `the landing message for #${item.item_id} fails its own check (${problems.join('; ')}); nothing merged; shout the coordinator: pullboard shout coordinator "#${item.item_id} landing message fails its check"`);@@ -99,18 +98,16 @@ function landingSpec(root, config) {}/**- * Everything a landing message needs from the trunk at `base`: its spec, each item's own type and- * the types the commit hook requires ids for.+ * Everything a landing message needs from the trunk at `base`: its spec and each item's own type.** @param {string} root* @param {string} base* @param {any} config* @param {(item: any) => string} commitOf - The item's checked landing commit.- * @returns {{ spec: any, typeOf: (item: any) => string | null, requireIds: string[] }}+ * @returns {{ spec: any, typeOf: (item: any) => string | null }}*/export function landingContext(root, base, config, commitOf) {- return { spec: landingSpec(root, config), typeOf: (item) => itemCommitType(root, base, commitOf(item)),- requireIds: config?.commits?.requireIds ?? ['feat', 'fix'] };+ return { spec: landingSpec(root, config), typeOf: (item) => itemCommitType(root, base, commitOf(item)) };}/**@@ -119,11 +116,11 @@ export function landingContext(root, base, config, commitOf) {** @param {any} item* @param {string} commit - The checked composition to merge.- * @param {{ root: string, base?: string | null, spec?: any, requireIds?: string[], quote: (word: string) => string }} context+ * @param {{ root: string, base?: string | null, spec?: any, quote: (word: string) => string }} context* @returns {string}*/-export function handMergeCommand(item, commit, { root, base = null, spec = null, requireIds, quote }) {- const message = landingMessage(item, { spec, type: itemCommitType(root, base, commit), ...(requireIds ? { requireIds } : {}) });+export function handMergeCommand(item, commit, { root, base = null, spec = null, quote }) {+ const message = landingMessage(item, { spec, type: itemCommitType(root, base, commit) });const trailers = `"$(printf '%s\\n' ${message.trailers.split('\n').map(quote).join(' ')})"`;return `git merge --no-ff ${commit} -m ${quote(message.header)} -m ${trailers} && pullboard merged ${item.item_id} HEAD`;}diff --git a/test/commit-message.test.js b/test/commit-message.test.jsindex 1745174a..84ca0802 100644--- a/test/commit-message.test.js+++ b/test/commit-message.test.js@@ -13,6 +13,8 @@ import {} from '../src/commit-message.js';import { checkLandingMessages, itemCommitType, landingMessage, landingRows } from '../src/land.js';import { citedIds, parseSpec } from '../src/spec.js';+import { defaults } from '../src/config.js';+import { commitMsgProblems } from '../src/hooks.js';import { createE2eHelpers } from './e2e-helpers.js';const e2e = createE2eHelpers();@@ -122,7 +124,7 @@ test('a landing names the refrozen rows in spec order, and a batch checks every});});-test('one header per item type: the type is the item\'s commits\' first of feat, fix, perf, refactor, revert, docs, test, build, ci, style, chore, else the lane rule [C7,B3,R3]', () => {+test('one header per item type: the type is the item\'s commits\' first of feat, fix, perf, refactor, revert, docs, test, build, ci, style, chore, with or without rows, else the lane rule [C7,B3,R3]', () => {const box = e2e.sandbox();const repo = join(box.dir, 'types');box.git(box.dir, 'init', '-q', '-b', 'main', repo);@@ -154,7 +156,15 @@ test('one header per item type: the type is the item\'s commits\' first of feat,assert.equal(built.header, `${expected ?? 'chore'}(merge): typed landing [A1]`, 'each item type writes its own merge header');assert.deepEqual(parseCommitMessage(built.message).type, expected ?? 'chore');}- // A feat item with no rows would fail the commit hook's id rule, so it lands under its lane's type.- assert.equal(landingMessage({ ...item, item_spec_ids: '', item_lane: 'docs' }, { type: 'feat' }).header, 'docs(merge): typed landing');- assert.equal(landingMessage({ ...item, item_spec_ids: '' }, { type: 'test' }).header, 'test(merge): typed landing');+ // A rowless item keeps its own type too; only an item with no typed commit takes the lane rule.+ const rules = defaults().commits;+ const spec = parseSpec('');+ 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.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');+ assert.notDeepEqual(commitMsgProblems('feat(merge): add it', { rules, spec }), [], 'a merge header without its item trailer still cites rows');});