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): skip empty review test admission [V4,C7]
Corey Olsonc9bbec65774f
diff --git a/docs/api.md b/docs/api.mdindex 8dbfe183..cf32797a 100644--- a/docs/api.md+++ b/docs/api.md@@ -205,7 +205,7 @@ A machine publishes an opaque approval with `POST /api/v1/devices/approvals {conThe result and refusal tables are checked against `JSON_SHAPES` in `src/json.js` by `docs/api.test.js`.-When `verify <id> accept` runs a frozen check and refuses with `CHECK_RED` or `CHECK_UNVERIFIED`, `error.message` includes its output digest, up to 40 sanitized tail lines, and `full output file: <path>`. The file is written with owner-only permissions. If diagnostic storage fails, the message says `full output file: (unavailable: CODE)` while retaining the bounded sanitized lines; the JSON error object remains `{ code, message, next }`. An item with no frozen check produces no check-output section.+When `verify <id> accept` runs a frozen check and refuses with `CHECK_RED` or `CHECK_UNVERIFIED`, `error.message` includes its output digest, up to 40 sanitized tail lines, and `full output file: <path>`. The file is written with owner-only permissions. If diagnostic storage fails, the message says `full output file: (unavailable: CODE)` while retaining the bounded sanitized lines; the JSON error object remains `{ code, message, next }`. An item with no frozen check produces no check-output section and records `check: "none"` without requesting a native test or browser slot. Its submitted-commit, frozen-digest, trunk, dependency, review-reservation, and verdict guards still apply.## MCP serverdiff --git a/src/cli.js b/src/cli.jsindex 3c5fb08f..0186954f 100644--- a/src/cli.js+++ b/src/cli.js@@ -2516,8 +2516,12 @@ async function verifyHere(ctx, id, { second, values }) {if (digest !== item.item_frozen_digest) throw new Refused('CRITERIA_CHANGED', 'the criterion changed; ask the coordinator to refreeze this item before checking it');const trunk = requireTrunkMerge(root, commit);refuseUnverifiedStack(root, board, item, commit, trunk);- const browser = !browserFreeChecksEnabled() || await checkNeedsBrowser(root, frozenCheck(item), { commit, onFallback: browserAdmissionReporter(ctx.io, ctx.io.relayJson) });- check = await withGateSlot(root, (lease) => checkAtCommit(root, item, { waitMs: lease.waitMs, gateLease: lease }), { browser, agent: me.id, item: String(id), kind: 'review', itemCheck: true, onWait: gateWaitReporter(ctx.io) });+ if (frozenCheck(item)) {+ const browser = !browserFreeChecksEnabled() || await checkNeedsBrowser(root, frozenCheck(item), { commit, onFallback: browserAdmissionReporter(ctx.io, ctx.io.relayJson) });+ check = await withGateSlot(root, (lease) => checkAtCommit(root, item, { waitMs: lease.waitMs, gateLease: lease }), { browser, agent: me.id, item: String(id), kind: 'review', itemCheck: true, onWait: gateWaitReporter(ctx.io) });+ } else {+ check = checkAtCommit(root, item);+ }refuseSandboxBlocked(check);verificationProfile = check.profile ?? null;const evidence = check.checkeddiff --git a/test/resources-verify-fixture.js b/test/resources-verify-fixture.jsnew file mode 100644index 00000000..0936d107--- /dev/null+++ b/test/resources-verify-fixture.js@@ -0,0 +1,63 @@+/** Private real-board setup for resource-admission verification checks [C7,V4]. */+import assert from 'node:assert/strict';+import { copyFileSync, cpSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';+import { join, resolve } from 'node:path';+import { runFixtureChild, runFixtureGit } from './fixture-child.js';+import { createE2eHelpers } from './e2e-helpers.js';++const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');+const TEST_RUNNER = resolve(import.meta.dirname, '../bin/run-tests.js');++/** Create a minimal real board whose CPU check and affected tests share the private gate pool. */+export function checkProject(box) {+ const repo = box.first;+ runFixtureGit(['branch', '-M', 'main'], { cwd: repo, env: box.env });+ const initialized = runFixtureChild(process.execPath, [BIN, 'init'], { cwd: repo, env: box.env, encoding: 'utf8' });+ assert.equal(initialized.status, 0, initialized.stderr);+ const configPath = join(repo, 'pullboard.json');+ const config = JSON.parse(readFileSync(configPath, 'utf8'));+ writeFileSync(configPath, `${JSON.stringify({ ...config, gate: 'true', spec: 'SPEC.md', affectedTests: 'node bin/run-tests.js', lanes: { web: { owns: ['web/'], specs: ['G1'] } }, shared: [] }, null, 2)}\n`);+ writeFileSync(join(repo, 'SPEC.md'), '# CPU check fixture\n\n## G · Goals\n- G1 [approved, must] The fixture keeps its board. | gate: true\n');+ writeFileSync(join(repo, 'package.json'), '{"type":"module"}\n');+ mkdirSync(join(repo, 'bin'), { recursive: true });+ cpSync(resolve(import.meta.dirname, '../src'), join(repo, 'src'), { recursive: true });+ copyFileSync(TEST_RUNNER, join(repo, 'bin/run-tests.js'));+ mkdirSync(join(repo, 'test'), { recursive: true });+ writeFileSync(join(repo, 'test/unrelated.test.js'), "import { test } from 'node:test'; test('unrelated test', () => {});\n");+ runFixtureGit(['add', '-A'], { cwd: repo, env: box.env });+ runFixtureGit(['-c', 'core.hooksPath=/dev/null', '-c', 'user.name=Resource fixture', '-c', '[email protected]', 'commit', '-q', '-m', 'fixture: initialize board'], { cwd: repo, env: box.env });+ const base = runFixtureGit(['rev-parse', 'HEAD'], { cwd: repo, env: box.env });+ writeFileSync(join(repo, 'test/cpu-check.test.js'), `import { writeFileSync } from 'node:fs';\nimport { test } from 'node:test';\ntest('item check marker', () => writeFileSync('item-check-started', 'started'));\ntest('submit check marker', () => writeFileSync('submit-check-started', 'started'));\n`);+ runFixtureGit(['add', 'test/cpu-check.test.js'], { cwd: repo, env: box.env });+ runFixtureGit(['-c', 'core.hooksPath=/dev/null', '-c', 'user.name=Resource fixture', '-c', '[email protected]', 'commit', '-q', '-m', 'test: add CPU check'], { cwd: repo, env: box.env });+ return { repo, base };+}++/** Submit a genuine private item and join a different reviewer before occupying its test pool. */+export function verificationProject(t, { checked = false } = {}) {+ const helpers = createE2eHelpers();+ t.after(helpers.cleanup);+ const project = helpers.project('true');+ const marker = join(project.dir, 'verification-check-ran');+ const check = 'printf check-ran > ' + "'" + marker.replaceAll("'", "'\\''") + "'";+ const added = project.run(project.repo, 'add', 'web', 'Private admission boundary', '--specs', 'G1',+ '--criterion', 'The real frozen verification keeps its public boundary.',+ ...(checked ? ['--check', check] : []), '--wait', '--json');+ assert.equal(added.code, 0, added.err || added.out);+ const item = JSON.parse(added.out).item.item_id;+ const claimed = project.run(project.web, 'claim', String(item), '--json');+ assert.equal(claimed.code, 0, claimed.err || claimed.out);+ const committed = helpers.commitFile(project, project.web, 'web/review.js', 'export const ready = true;\n', 'feat(web): admission fixture [G1]');+ assert.equal(committed.status, 0, committed.failure ?? committed.stderr);+ const submitted = project.run(project.web, 'submit', String(item), '--json');+ assert.equal(submitted.code, 0, submitted.err || submitted.out);+ const head = JSON.parse(submitted.out).commit;+ const reviewer = join(project.dir, 'reviewer');+ project.git(project.repo, 'worktree', 'add', '-q', '--detach', reviewer, head);+ const joined = project.run(reviewer, 'join', 'web');+ assert.equal(joined.code, 0, joined.err || joined.out);+ const settings = project.run(project.repo, 'settings', 'gateSlots', '1', '--json');+ assert.equal(settings.code, 0, settings.err || settings.out);+ return { project, item, reviewer, marker,+ box: { first: project.repo, home: project.env.PULLBOARD_MACHINE_HOME, env: project.env } };+}diff --git a/test/resources.test.js b/test/resources.test.jsindex 4c8ea851..2bcf8574 100644--- a/test/resources.test.js+++ b/test/resources.test.js@@ -14,6 +14,7 @@ import { DatabaseSync } from 'node:sqlite';import { listResources, setResourceCapacity, takeResource } from '../src/resources.js';import { checkNeedsBrowser } from '../src/browser-admission.js';import { releaseQueueProof } from './resources-release-fixture.js';+import { checkProject, verificationProject } from './resources-verify-fixture.js';const TEMP = [];const CHILDREN = new Set();@@ -119,31 +120,6 @@ function waitForMarker(path, timeoutMs = 10_000) {}).finally(() => watcher.close());}-/** Create a minimal real board whose CPU check and affected tests share the private gate pool. */-function checkProject(box) {- const repo = box.first;- runFixtureGit(['branch', '-M', 'main'], { cwd: repo, env: box.env });- const initialized = runFixtureChild(process.execPath, [BIN, 'init'], { cwd: repo, env: box.env, encoding: 'utf8' });- assert.equal(initialized.status, 0, initialized.stderr);- const configPath = join(repo, 'pullboard.json');- const config = JSON.parse(readFileSync(configPath, 'utf8'));- writeFileSync(configPath, `${JSON.stringify({ ...config, gate: 'true', spec: 'SPEC.md', affectedTests: 'node bin/run-tests.js', lanes: { web: { owns: ['web/'], specs: ['G1'] } }, shared: [] }, null, 2)}\n`);- writeFileSync(join(repo, 'SPEC.md'), '# CPU check fixture\n\n## G · Goals\n- G1 [approved, must] The fixture keeps its board. | gate: true\n');- writeFileSync(join(repo, 'package.json'), '{"type":"module"}\n');- mkdirSync(join(repo, 'bin'), { recursive: true });- cpSync(resolve(import.meta.dirname, '../src'), join(repo, 'src'), { recursive: true });- copyFileSync(TEST_RUNNER, join(repo, 'bin/run-tests.js'));- mkdirSync(join(repo, 'test'), { recursive: true });- writeFileSync(join(repo, 'test/unrelated.test.js'), "import { test } from 'node:test'; test('unrelated test', () => {});\n");- runFixtureGit(['add', '-A'], { cwd: repo, env: box.env });- runFixtureGit(['-c', 'core.hooksPath=/dev/null', '-c', 'user.name=Resource fixture', '-c', '[email protected]', 'commit', '-q', '-m', 'fixture: initialize board'], { cwd: repo, env: box.env });- const base = runFixtureGit(['rev-parse', 'HEAD'], { cwd: repo, env: box.env });- writeFileSync(join(repo, 'test/cpu-check.test.js'), `import { writeFileSync } from 'node:fs';\nimport { test } from 'node:test';\ntest('item check marker', () => writeFileSync('item-check-started', 'started'));\ntest('submit check marker', () => writeFileSync('submit-check-started', 'started'));\n`);- runFixtureGit(['add', 'test/cpu-check.test.js'], { cwd: repo, env: box.env });- runFixtureGit(['-c', 'core.hooksPath=/dev/null', '-c', 'user.name=Resource fixture', '-c', '[email protected]', 'commit', '-q', '-m', 'test: add CPU check'], { cwd: repo, env: box.env });- return { repo, base };-}-/** Create the previous private queue schema so simultaneous openers exercise its migration. */function oldSchema(box) {mkdirSync(box.home, { recursive: true });@@ -1750,3 +1726,46 @@ test('[Q4] a red gate releases its lease before the same process starts anotherif (child.exitCode === null && child.signalCode === null) await closed;}});+++test('a verification with no frozen check never enters the test queue [C7,V4]', async t => {+ const { project, box, item, reviewer } = verificationProject(t);+ const holder = worker(box, { agent: 'empty-check-holder' });+ await acquired(holder);+ let completed;+ const verifying = runFixtureChildAsync(process.execPath, [BIN, 'verify', String(item), 'accept', '--note', 'The private bar holds.', '--json'],+ { cwd: reviewer, env: project.env }).then(result => { completed = result; return result; });+ try {+ await waitUntil(() => completed || privateList(box).find(row => row.name === 'gate')?.line.some(row => row.item === String(item)),+ 'the verification to finish or enter its private queue');+ const gate = privateList(box).find(row => row.name === 'gate');+ assert.equal(gate.line.some(row => row.item === String(item)), false, 'an empty frozen check must not add a native waiter');+ assert.ok(gate.holders.some(row => row.agent === 'empty-check-holder'), 'the unrelated holder remains occupied throughout verification');+ assert.ok(completed, 'the verifier completed without waiting for that holder');+ assert.equal(completed.status, 0, completed.failure ?? completed.stderr);+ assert.equal(JSON.parse(completed.stdout).check, 'none');+ assert.equal(privateList(box).find(row => row.name === 'browser')?.line.some(row => row.item === String(item)) ?? false, false,+ 'an empty frozen check adds no browser waiter either');+ } finally { await release(holder); await verifying; }+});++test('a verification with a frozen check still waits for its slot [C7,V4]', async t => {+ const { project, box, item, reviewer, marker } = verificationProject(t, { checked: true });+ rmSync(marker, { force: true });+ const holder = worker(box, { agent: 'real-check-holder' });+ await acquired(holder);+ let completed;+ const verifying = runFixtureChildAsync(process.execPath, [BIN, 'verify', String(item), 'accept', '--note', 'The exact frozen command passed.', '--json'],+ { cwd: reviewer, env: project.env }).then(result => { completed = result; return result; });+ try {+ await waitUntil(() => completed || privateList(box).find(row => row.name === 'gate')?.line.some(row => row.item === String(item)),+ 'the nonempty frozen check to enter its private queue');+ assert.equal(privateList(box).find(row => row.name === 'gate').line.some(row => row.item === String(item)), true,+ 'a real frozen command keeps the normal native admission boundary');+ assert.equal(completed, undefined, 'the check cannot finish while its slot remains occupied');+ assert.equal(existsSync(marker), false, 'the frozen command has not run early');+ } finally { await release(holder); await verifying; }+ assert.equal(completed.status, 0, completed.failure ?? completed.stderr);+ assert.equal(JSON.parse(completed.stdout).check, 'green');+ assert.equal(readFileSync(marker, 'utf8'), 'check-ran', 'the unchanged frozen command ran after admission');+});