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(submit): make infra notes opt in [C7,V4]
Corey Olson083cd8dcdac6
diff --git a/docs/api.md b/docs/api.mdindex 58583429..0bc8d6f4 100644--- a/docs/api.md+++ b/docs/api.md@@ -34,7 +34,7 @@ Freshness never rewrites the stored ACCEPT or its verdict row. New accept/rejectFor a stale acceptance, merge current main into the submitted work and commit a clean review HEAD. Another agent runs `pullboard verify <id> accept --note "what was re-reviewed"`; its frozen check runs at that combined HEAD, and a new verdict appends to the history while retaining the original submitted commit. A main move during the check refuses `VERDICT_TRUNK_MOVED` and requires another review. `resume` keeps stale acceptances out of its merge list. `land` excludes stale items (and reports their file and commit); when none remain ready, it refuses `STALE_VERDICT`. Nothing in this observation changes the approved criterion or grants person authority.-A submit that edits a test file, `pullboard.json`, a githook or a file a gate command names, and that already existed at the claim, is refused with `INFRA_NOTE_REQUIRED` until it carries `--infra "<why>"`. The refusal names the files. The note and those files are recorded on the item's `submit` event as `infra: {note, files}`, and `pullboard show` prints them for the reviewer as `infra note:`. A new test file needs no note.+The board setting `submit.requireInfraNote` in the coordinator's accepted `pullboard.json` is `false` by default. With it `true`, a submit that edits a test file, `pullboard.json`, a githook or a file a gate command names, and that already existed at the claim, is refused with `INFRA_NOTE_REQUIRED` until it carries `--infra "<why>"`. The refusal names the files. With either setting, a supplied note and those files are recorded on the item's `submit` event as `infra: {note, files}`, and `pullboard show` prints them for the reviewer as `infra note:`. A new test file needs no note.`pullboard stats [--since <date>] --json` returns `{version: 1, stats: {...}}` from the append-only event log. `submissions` and `rejections` count moves, including repeated attempts; `rejectionShare` is rejections divided by submissions (zero when the window has no submissions). `merged` counts distinct items with a merge move; `mergedWithoutAccept` counts those whose merge lacks an earlier acceptance of the latest submitted commit. That audit uses earlier history even when the acceptance falls before the selected window. Current item and verdict rows do not replace event evidence.diff --git a/src/cli.js b/src/cli.jsindex a3cf7436..19eafc03 100644--- a/src/cli.js+++ b/src/cli.js@@ -2762,7 +2762,7 @@ async function submitHere(ctx, id, infra) {withBoard(ctx, (board) => submitPreflight(board, id, { agentId: me.id, commit, tree: headTree(root) ?? '' }));const trunk = requireTrunkMerge(root, commit);withBoard(ctx, (board) => refuseUnverifiedStack(root, board, held, commit, trunk));- const infraRecord = infraNotes.infraNote({ root, claimHead, files: filesSince(root, id, claimHead, commit), gates: [ctx.config.gate, acceptedMain.config.gate], infra });+ const infraRecord = infraNotes.infraNote({ root, claimHead, files: filesSince(root, id, claimHead, commit), gates: [ctx.config.gate, acceptedMain.config.gate], infra, requireInfraNote: acceptedMain.config.submit.requireInfraNote });// Doctrine counts only fall: accepted main's rules, at this exact commit (D1). No rule, no change.const doctrine = hasSubmitRules(root, acceptedMain.commit, acceptedMain.config.practice)? await withGateSlot(root, () => holdDoctrine(root, { mainCommit: acceptedMain.commit, commit, practice: acceptedMain.config.practice, timeoutMs: acceptedMain.config.check?.timeoutMs }),diff --git a/src/config.js b/src/config.jsindex 0107ac38..c40578e8 100644--- a/src/config.js+++ b/src/config.js@@ -44,6 +44,7 @@ export function defaults() {spec: 'SPEC.md',practice: DOCTRINE_FILE,gate: '',+ submit: { requireInfraNote: false },submitInvariants: [],staticChecks: '',lease: '2h',@@ -110,6 +111,10 @@ function merge(base, raw) {: raw.check && typeof raw.check === 'object' && !Array.isArray(raw.check)? { ...base.check, ...raw.check }: raw.check,+ submit: raw.submit === undefined ? base.submit+ : raw.submit && typeof raw.submit === 'object' && !Array.isArray(raw.submit)+ ? { ...base.submit, ...raw.submit }+ : raw.submit,};}@@ -197,6 +202,10 @@ export function configProblems(config) {if (typeof config.check !== 'object' || config.check === null || Array.isArray(config.check)) {problems.push('"check" is an object with optional "install" and "timeout" fields');}+ if (!config.submit || typeof config.submit !== 'object' || Array.isArray(config.submit)+ || Object.keys(config.submit).some(key => key !== 'requireInfraNote') || typeof config.submit.requireInfraNote !== 'boolean') {+ problems.push('"submit" is an object with a boolean "requireInfraNote" setting');+ }// Absent, a check already green on main is only a warning, as on boards made before the setting.if (config.checks !== undefined && (typeof config.checks !== 'object' || config.checks === null || Array.isArray(config.checks)|| Object.keys(config.checks).some((key) => key !== 'provesNothing') || !['hold', 'warn'].includes(config.checks.provesNothing))) {diff --git a/src/infra-note.js b/src/infra-note.jsindex 549f31aa..dc1b5a50 100644--- a/src/infra-note.js+++ b/src/infra-note.js@@ -84,17 +84,17 @@ export function existingGuardedEdits(root, claimHead, files, gates) {}/**- * Decide whether a submit may proceed: refused with INFRA_NOTE_REQUIRED when it edits an existing guarded file and- * carries no --infra reason, otherwise the note and the files it covers, to record on the submit event.+ * Decide whether a submit may proceed: an enabled board policy requires an --infra reason for an existing guarded+ * edit. A supplied note is recorded with its files whether or not the requirement is enabled.*- * @param {{ root: string, claimHead: string, files: string[], gates: string[], infra: string | undefined }} submit+ * @param {{ root: string, claimHead: string, files: string[], gates: string[], infra: string | undefined, requireInfraNote?: boolean }} submit* @returns {{ note: string, files: string[] } | null} the infra record, or null when none is needed or given* @throws {Refused} INFRA_NOTE_REQUIRED, or USAGE for a malformed --infra value*/-export function infraNote({ root, claimHead, files, gates, infra }) {+export function infraNote({ root, claimHead, files, gates, infra, requireInfraNote = false }) {const edited = existingGuardedEdits(root, claimHead, files, gates);if (infra === undefined) {- if (!edited.length) return null;+ if (!requireInfraNote || !edited.length) return null;throw new Refused('INFRA_NOTE_REQUIRED', `this change edits existing test or gate file${edited.length > 1 ? 's' : ''} ${edited.join(', ')}; say why with --infra "<why>"`,'run pullboard submit <id> --infra "<why>", giving the reason the edit is needed');}diff --git a/test/submit-infra.test.js b/test/submit-infra.test.jsindex e012beb5..b0a53812 100644--- a/test/submit-infra.test.js+++ b/test/submit-infra.test.js@@ -9,11 +9,21 @@ import { appendFileSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSimport { tmpdir } from 'node:os';import { dirname, join } from 'node:path';import { after, test } from 'node:test';+import { configFromSource } from '../src/config.js';const BIN = join(import.meta.dirname, '../bin/pullboard.js');const SPEC = '# Submit proof fixture\n\n## G · Goals\n- G1 [approved, must] The selected test proves the change. | gate: test\n';const dirs = [];+test('infra-note settings default off and refuse non-boolean policies [C7,V4]', () => {+ assert.equal(configFromSource('{}').submit.requireInfraNote, false);+ assert.equal(configFromSource('{"submit":{}}').submit.requireInfraNote, false);+ assert.equal(configFromSource('{"submit":{"requireInfraNote":true}}').submit.requireInfraNote, true);+ for (const submit of [null, [], true, { requireInfraNote: 'true' }, { requireInfraNote: 1 }, { requireInfraNote: null }, { requireInfraNotes: true }]) {+ assert.throws(() => configFromSource(JSON.stringify({ submit })), error => error.code === 'BAD_CONFIG');+ }+});+after(() => {for (const dir of dirs) rmSync(dir, { recursive: true, force: true });});@@ -70,9 +80,10 @@ function privateRepo(t) {}/** Create a real joined builder while the coordinator stays on its unchanged trunk. */-function builderRepo(box) {+function builderRepo(box, { requireInfraNote = true } = {}) {const config = JSON.parse(readFileSync(join(box.root, 'pullboard.json'), 'utf8'));config.lanes = { build: { owns: ['src/', 'test/'], specs: ['G'] } };+ if (requireInfraNote) config.submit = { requireInfraNote: true };put(box.root, 'pullboard.json', JSON.stringify(config));commitAll(box);const made = box.run('worktree', 'build', '--json');@@ -89,14 +100,14 @@ function builderRepo(box) {}/** Commit one change to a builder checkout, then return the item's builder repository. */-function infraBox(t, { edit, existing = true }) {+function infraBox(t, { edit, existing = true, requireInfraNote = true }) {let box = privateRepo(t);put(box.root, 'pullboard.json', JSON.stringify({ gate: 'true', spec: 'SPEC.md' }));put(box.root, 'SPEC.md', SPEC);put(box.root, 'src/a.js', 'export const value = 1;\n');if (existing) put(box.root, 'test/existing.test.js', "import '../src/a.js';\n");commitAll(box);- box = builderRepo(box);+ box = builderRepo(box, { requireInfraNote });assert.equal(box.coordinator('add', 'build', 'Infra note fixture', '--check', 'true').code, 0);assert.equal(box.run('claim', '1').code, 0);edit(box);@@ -121,6 +132,28 @@ test('submit asks why when a change edits an existing test [C7,V4]', (t) => {assert.match(shown.out, /test\/existing\.test\.js/u, 'show names the edited file');});+test('the infra note is required only when the board turns it on [C7,V4]', (t) => {+ /** Edit an existing test file after the item claim. */+ const edit = (box) => put(box.root, 'test/existing.test.js', "import '../src/a.js';\n// a change\n");+ const optional = infraBox(t, { edit, requireInfraNote: false });+ const accepted = optional.run('submit', '1');+ assert.equal(accepted.code, 0, `${accepted.out}\n${accepted.err}`);+ assert.doesNotMatch(`${accepted.out}\n${accepted.err}`, /INFRA_NOTE_REQUIRED/u);++ const recorded = infraBox(t, { edit, requireInfraNote: false });+ const noted = recorded.run('submit', '1', '--infra', 'the change keeps the real listener covered');+ assert.equal(noted.code, 0, `${noted.out}\n${noted.err}`);+ const shown = recorded.run('show', '1');+ assert.equal(shown.code, 0, shown.err);+ assert.match(shown.out, /infra note: the change keeps the real listener covered/u);+ assert.match(shown.out, /test\/existing\.test\.js/u);++ const enabled = infraBox(t, { edit, requireInfraNote: true });+ const refused = enabled.run('submit', '1');+ assert.equal(refused.code, 1, `${refused.out}\n${refused.err}`);+ assert.match(`${refused.out}\n${refused.err}`, /INFRA_NOTE_REQUIRED/u);+});+test('a new test file needs no note [C7,V4]', (t) => {const box = infraBox(t, { existing: true, edit: (box) => put(box.root, 'test/brand-new.test.js', "import '../src/a.js';\n") });const submitted = box.run('submit', '1');