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(board): validate exact manual landing evidence [B3,V4]
Corey Olsond9c23d6ecd7e
diff --git a/src/board.js b/src/board.jsindex 3d8b2595..34615079 100644--- a/src/board.js+++ b/src/board.js@@ -1494,11 +1494,11 @@ export function reopen(board, id, { agentId, note }) {&& culprit.tests.every((failure) => typeof failure.file === 'string' && typeof failure.name === 'string'&& note.includes(`${failure.file}: ${failure.name}`) && note.includes(culprit.mergeCommit)));const manual = manualLandingFailure(note);- if (!accepted || (!recorded && !manual)) return new Refused('LANDING_FAILURE_REQUIRED', `reopening verified item #${id} needs a failing test and merge commit in --note`);+ if (!accepted || (!recorded && !manual)) return new Refused('LANDING_FAILURE_REQUIRED', `reopening verified item #${id} needs --note in the format <test file>: <test name>; merge commit <sha>`);supersedes = accepted.event_id;landingFailure = recorded? { batch: recorded.batch.id, tests: recorded.culprit.tests, mergeCommit: recorded.culprit.mergeCommit }- : { batch: null, tests: [manual.test], mergeCommit: manual.mergeCommit };+ : { batch: null, tests: manual.tests, mergeCommit: manual.mergeCommit };return null;},},@@ -1522,10 +1522,17 @@ export function reopen(board, id, { agentId, note }) {/** Read test and merge-commit evidence from a Studio/manual landing note without checking Git. */function manualLandingFailure(note) {- const test = note.match(/(?<file>(?:[\w.-]+\/)*[\w.-]+):\s*(?<name>[^;\n]+?)(?=\s*;\s*merge commit\b|$)/iu);- const mergeCommit = note.match(/\bmerge commit\s+([a-f0-9]{40}|[a-f0-9]{64})\b/iu)?.[1];- if (!test || !test.groups.name.trim() || !mergeCommit) return null;- return { test: { file: test.groups.file, name: test.groups.name.trim() }, mergeCommit };+ const generatedPrefix = /^Landing batch [a-z0-9_-]{1,80} failed /iu.exec(note);+ const body = generatedPrefix ? note.slice(generatedPrefix[0].length) : note;+ const evidence = body.match(/^(?<tests>.+);[ \t]*merge commit[ \t]+(?<mergeCommit>[a-f0-9]{40}|[a-f0-9]{64})$/iu);+ if (!evidence) return null;+ const tests = evidence.groups.tests.split(/;[ \t]*/u).map((entry) => {+ const test = entry.match(/^(?<file>(?:[\w.-]+\/)*[\w.-]+\.[a-z0-9]+):[ \t]*(?<name>[^;\r\n]+)$/iu);+ if (!test || !test.groups.name.trim()) return null;+ return { file: test.groups.file, name: test.groups.name.trim() };+ });+ if (!tests.length || tests.some((test) => !test)) return null;+ return { tests, mergeCommit: evidence.groups.mergeCommit };}/**diff --git a/test/reopen.test.js b/test/reopen.test.jsindex 6f8aa0cd..763a63a1 100644--- a/test/reopen.test.js+++ b/test/reopen.test.js@@ -299,12 +299,45 @@ test('a red landing gate returns a verified item to its builder [B3,V4]', asyncconst manualItem = submitLandingFixture(manualBox, 1, 'export const status = "PASS_MANUAL";\n');acceptLandingFixture(manualBox, manualItem);const manualBoard = store.openBoard(join(manualBox.repo, '.git', 'pullboard', 'board.sqlite'));- try { assert.deepEqual(store.landingBatches(manualBoard), [], 'hand-run landing evidence starts with no recorded batch'); }+ let manualSnapshot;+ try {+ assert.deepEqual(store.landingBatches(manualBoard), [], 'hand-run landing evidence starts with no recorded batch');+ manualSnapshot = exportBoard(manualBoard);+ }finally { store.closeBoard(manualBoard); }const manualAccept = readItem(manualBox, manualItem.id).thread.find((event) => event.type === 'move' && event.kind === 'accept');+ const generatedBoard = store.openBoard(':memory:');+ importBoard(generatedBoard, manualSnapshot);+ t.after(() => store.closeBoard(generatedBoard));+ const generatedNote = `Landing batch fixture_batch-1 failed web/landing.test.js: first red; nested/roadmap.test.js: second red; merge commit ${'f'.repeat(40)}`;+ const generatedReopen = store.reopen(generatedBoard, manualItem.id, { agentId: 'coordinator', note: generatedNote });+ assert.equal(store.getItem(generatedBoard, manualItem.id).item_status, 'open');+ assert.deepEqual(generatedReopen.landingFailure, {+ batch: null,+ tests: [+ { file: 'web/landing.test.js', name: 'first red' },+ { file: 'nested/roadmap.test.js', name: 'second red' },+ ],+ mergeCommit: 'f'.repeat(40),+ }, 'the exact landing-generated note prefix retains every failure when the batch is absent');+ assert.deepEqual(JSON.parse(store.events(generatedBoard).at(-1).event_detail).landingFailure, generatedReopen.landingFailure,+ 'the absent-batch fallback records every generated failure in immutable history');const noNamedTest = manualBox.run(manualBox.repo, 'reopen', String(manualItem.id), '--note', `merge commit ${'d'.repeat(40)}`, '--json');assert.equal(noNamedTest.code, 1);assert.equal(JSON.parse(noNamedTest.out).error.code, 'LANDING_FAILURE_REQUIRED');+ for (const invalidNote of [+ `Landing failed: gate red; merge commit ${'d'.repeat(40)}`,+ `Studio landing gate red: see the log; merge commit ${'d'.repeat(40)}`,+ `Reopening #12: the gate was red; merge commit ${'d'.repeat(40)}`,+ `Gate red at 10:30, test/a.test.js: keeps it; merge commit ${'d'.repeat(40)}`,+ ]) {+ const refused = manualBox.run(manualBox.repo, 'reopen', String(manualItem.id), '--note', invalidNote, '--json');+ assert.equal(refused.code, 1, invalidNote);+ assert.equal(JSON.parse(refused.out).error.code, 'LANDING_FAILURE_REQUIRED', invalidNote);+ assert.equal(readItem(manualBox, manualItem.id).item_status, 'verified', 'a malformed manual note leaves the item verified');+ }+ assert.match(JSON.parse(noNamedTest.out).error.message,+ /<test file>: <test name>; merge commit <sha>/u, 'the refusal explains the exact manual evidence format');const manualNote = `web/landing.test.js: keeps the landed behavior; merge commit ${'d'.repeat(40)}`;const manual = manualBox.run(manualBox.repo, 'reopen', String(manualItem.id), '--note', manualNote, '--json');assert.equal(manual.code, 0, manual.err);