Skip to content

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.

fix(verify): install dependencies before checks [V18,V2]

Corey Olson3a62720e0235
diff --git a/docs/lifecycle.md b/docs/lifecycle.md
index 991b2450..0e9d527c 100644
--- a/docs/lifecycle.md
+++ b/docs/lifecycle.md
@@ -4,6 +4,10 @@ Generated from src/machine.js by `pullboard lifecycle`. Do not edit it by hand:
An item starts open. Its final states, verified and withdrawn, cannot be left, and every way into them passes the same exit guards, whatever command gets there. The board file itself refuses any move not declared here.
+## Frozen check policy
+
+The coordinator may set `check.install` and `check.timeout` in committed `pullboard.json`; the defaults are no install command and `5m`. Accept runs the configured install and the frozen item check in a private clone, under one timeout budget. It reuses the verifier’s npm cache when available. Install commands that need network downloads conflict with P2 (offline); configure an offline install or make its needed packages available in the cache.
+
```mermaid
stateDiagram-v2
[*] --> open
@@ -48,7 +52,7 @@ Each move checks its guards in this order and refuses with the first one that do
| lapse | claimed | open | clock, when its lease runs out | none |
| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG), gateConfigured (NO_GATE), gateGreen (GATE_RED), treeStillDuringGate (MOVED_DURING_GATE), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW) |
| reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) |
-| accept | submitted | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonIsMet (BAD_REASON), itemCheckGreen (CHECK_RED), proofNoted (PROOF_REQUIRED) |
+| accept | submitted | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonIsMet (BAD_REASON), itemCheckGreen (CHECK_RED or CHECK_UNVERIFIED), proofNoted (PROOF_REQUIRED) |
| reject | submitted | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonCoded (BAD_REASON), noteGiven (NOTE_REQUIRED) |
| escalate | open, claimed | open | agent, coordinator | joined (NOT_JOINED), noteGiven (NOTE_REQUIRED), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED) |
| refreeze | open, claimed, submitted | open | coordinator | joined (NOT_JOINED), coordinatorOnly (COORDINATOR_ONLY), itemExists (NO_ITEM), inState (CLOSED), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG) |
@@ -99,6 +103,7 @@ Each move checks its guards in this order and refuses with the first one that do
| NO_POLICY | the full claimed diff respects committed coordinator ownership | restore the claim base or ask the coordinator to refreeze |
| BAD_CONFIG | the full claimed diff respects committed coordinator ownership | restore the committed coordinator configuration |
| CHECK_RED | the frozen item check passes at the exact submitted commit | reject the failing behavior; the builder fixes and resubmits |
+| CHECK_UNVERIFIED | the frozen item check passes at the exact submitted commit | restore the frozen install or check environment and retry |
| GATE_RED | the gate, which submit runs itself every time, is green at HEAD | fix what the digest names, commit, submit again |
| MOVED_DURING_GATE | when the gate ends, HEAD and every tracked file are as they were when it started | leave the worktree alone until the gate finishes, then submit again |
| CHILDREN_OPEN | every child item is verified or withdrawn | finish the child items, or the coordinator withdraws them |
diff --git a/src/cli.js b/src/cli.js
index ac2e81c4..3cd178db 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -1476,7 +1476,9 @@ async function verifyHere(ctx, id, { second, values }) {
}
if (decision === 'ACCEPT') {
if (digest !== item.item_frozen_digest) throw new Refused('CRITERIA_CHANGED', 'the criterion changed; ask the coordinator to refreeze this item before checking it');
- if (!checkAtCommit(root, item).green) throw new Refused('CHECK_RED', 'the frozen item check is red at the submitted commit; reject with the failing behavior or ask the builder to fix and resubmit');
+ const check = checkAtCommit(root, item);
+ if (check.state === 'unverified') throw new Refused('CHECK_UNVERIFIED', `the frozen ${check.stage} could not be verified at the submitted commit; output digest:\n${check.report.replace(/^/gm, ' ')}`);
+ if (check.state === 'red') throw new Refused('CHECK_RED', `the frozen item check is red at the submitted commit; check.install may be needed for dependencies; output digest:\n${check.report.replace(/^/gm, ' ')}`);
const receipt = store.events(board, { itemId: id }).filter(event => event.event_kind === 'submit').map(event => JSON.parse(event.event_detail)).find(event => event.commit === commit);
submissionPaths(root, item, commit, { mainCommit: receipt?.policyCommit, dependencies: dependencySnapshots(board.db, item) });
}
diff --git a/src/config.js b/src/config.js
index 98a5a8a9..7f6d1710 100644
--- a/src/config.js
+++ b/src/config.js
@@ -12,6 +12,9 @@ export const COORDINATOR = 'coordinator';
const LANE_NAME_RE = /^[a-z][a-z0-9-]{0,30}$/;
const DURATION_RE = /^(\d+)(m|h|d)$/;
const UNIT_MS = { m: 60_000, h: 3_600_000, d: 86_400_000 };
+const CHECK_TIMEOUT_RE = /^(\d+)(ms|s|m|h|d)$/;
+const CHECK_TIMEOUT_MS = { ms: 1, s: 1_000, m: 60_000, h: 3_600_000, d: 86_400_000 };
+const MAX_CHECK_TIMEOUT_MS = 2_147_483_647;
const COMMIT_TYPES = [
'feat',
'fix',
@@ -39,6 +42,7 @@ export function defaults() {
lease: '2h',
reviewLease: '30m',
verify: { policy: 'any', family: 'off', reviewRatio: 3 },
+ check: { install: '', timeout: '5m' },
lanes: {},
products: {},
shared: [],
@@ -89,6 +93,10 @@ function merge(base, raw) {
verify: typeof raw.verify === 'string'
? { ...base.verify, policy: raw.verify }
: { ...base.verify, ...(raw.verify ?? {}) },
+ check: raw.check === undefined ? base.check
+ : raw.check && typeof raw.check === 'object' && !Array.isArray(raw.check)
+ ? { ...base.check, ...raw.check }
+ : raw.check,
};
}
@@ -149,6 +157,15 @@ export function configProblems(config) {
if (!['off', 'prefer', 'require'].includes(config.verify?.family)) {
problems.push('"verify.family" is "off", "prefer" or "require"');
}
+ 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 (typeof config.check?.install !== 'string') problems.push('"check.install" is an install command string');
+ const timeout = typeof config.check?.timeout === 'string' ? CHECK_TIMEOUT_RE.exec(config.check.timeout) : null;
+ const timeoutMs = timeout ? Number(timeout[1]) * CHECK_TIMEOUT_MS[timeout[2]] : NaN;
+ if (!timeout || timeoutMs <= 0 || !Number.isFinite(timeoutMs) || timeoutMs > MAX_CHECK_TIMEOUT_MS) {
+ problems.push('"check.timeout" is a positive duration no longer than 2,147,483,647ms, like "5m"');
+ }
if (!Number.isFinite(config.verify?.reviewRatio) || config.verify.reviewRatio <= 0) {
problems.push('"verify.reviewRatio" is a positive number, such as 3');
}
@@ -201,5 +218,11 @@ export function configFromSource(source) {
const config = merge(defaults(), raw);
const problems = configProblems(config);
if (problems.length) throw new Refused('BAD_CONFIG', `${CONFIG_FILE}: ${problems.join('; ')}`);
- return { ...config, leaseMs: durationMs(config.lease), reviewLeaseMs: durationMs(config.reviewLease, 'reviewLease') };
+ const timeout = CHECK_TIMEOUT_RE.exec(config.check.timeout);
+ return {
+ ...config,
+ check: { ...config.check, timeoutMs: Number(timeout[1]) * CHECK_TIMEOUT_MS[timeout[2]] },
+ leaseMs: durationMs(config.lease),
+ reviewLeaseMs: durationMs(config.reviewLease, 'reviewLease'),
+ };
}
diff --git a/src/doctor.js b/src/doctor.js
index de5c3959..50bbd1a7 100644
--- a/src/doctor.js
+++ b/src/doctor.js
@@ -186,7 +186,9 @@ function submissionProblems(db, root) {
} catch (error) {
problems.push(finding(error.code ?? 'SUBMISSION_POLICY', 'item #' + item.item_id + ': ' + (error.code === 'OUTSIDE_LANE' ? error.message : 'its committed submission policy or claim base cannot be checked'), 'ask the coordinator to restore the original policy and inspect this submission'));
}
- if (!checkAtCommit(root, item).green) problems.push(finding('CHECK_RED', 'item #' + item.item_id + ' has a red frozen check at ' + item.item_commit, 'ask the coordinator to record and repair the failing submission'));
+ const check = checkAtCommit(root, item);
+ if (check.state === 'unverified') problems.push(finding('CHECK_UNVERIFIED', 'item #' + item.item_id + ' has an unverified frozen ' + check.stage + ' at ' + item.item_commit + '; output digest: ' + check.report, 'restore the install or check environment, then rerun doctor'));
+ else if (check.state === 'red') problems.push(finding('CHECK_RED', 'item #' + item.item_id + ' has a red frozen check at ' + item.item_commit + '; output digest: ' + check.report, 'ask the coordinator to record and repair the failing submission'));
}
return problems;
}
diff --git a/src/machine.js b/src/machine.js
index d93cce97..97c6bf19 100644
--- a/src/machine.js
+++ b/src/machine.js
@@ -115,7 +115,7 @@ export const GUARDS = [
{ id: 'hasCommit', refuse: 'NO_COMMIT', rule: 'there is a commit to submit', next: 'commit your work, then submit', source: 'cli' },
{ id: 'gateConfigured', refuse: 'NO_GATE', rule: 'the repo names a gate command', next: 'set "gate" in pullboard.json, e.g. "npm test"', source: 'cli' },
{ id: 'withinLane', refuse: 'OUTSIDE_LANE', alsoRefuses: [{ code: 'NO_POLICY', next: 'restore the claim base or ask the coordinator to refreeze' }, { code: 'BAD_CONFIG', next: 'restore the committed coordinator configuration' }], rule: 'the full claimed diff respects committed coordinator ownership', next: 'restore foreign paths or shout their owner', source: 'cli' },
- { id: 'itemCheckGreen', refuse: 'CHECK_RED', rule: 'the frozen item check passes at the exact submitted commit', next: 'reject the failing behavior; the builder fixes and resubmits', source: 'cli' },
+ { id: 'itemCheckGreen', refuse: 'CHECK_RED', alsoRefuses: [{ code: 'CHECK_UNVERIFIED', next: 'restore the frozen install or check environment and retry' }], rule: 'the frozen item check passes at the exact submitted commit', next: 'reject the failing behavior; the builder fixes and resubmits', source: 'cli' },
{ id: 'gateGreen', refuse: 'GATE_RED', rule: 'the gate, which submit runs itself every time, is green at HEAD', next: 'fix what the digest names, commit, submit again', source: 'cli' },
{ id: 'treeStillDuringGate', refuse: 'MOVED_DURING_GATE', rule: 'when the gate ends, HEAD and every tracked file are as they were when it started', next: 'leave the worktree alone until the gate finishes, then submit again', source: 'cli' },
{ id: 'childrenDone', refuse: 'CHILDREN_OPEN', rule: 'every child item is verified or withdrawn', next: 'finish the child items, or the coordinator withdraws them', source: 'board' },
@@ -504,6 +504,10 @@ export function lifecycleMarkdown(machine = MACHINE) {
'',
`An item starts ${machine.initial}. Its final states, ${finals.map((state) => state.id).join(' and ')}, cannot be left, and every way into them passes the same exit guards, whatever command gets there. The board file itself refuses any move not declared here.`,
'',
+ '## Frozen check policy',
+ '',
+ 'The coordinator may set `check.install` and `check.timeout` in committed `pullboard.json`; the defaults are no install command and `5m`. Accept runs the configured install and the frozen item check in a private clone, under one timeout budget. It reuses the verifier’s npm cache when available. Install commands that need network downloads conflict with P2 (offline); configure an offline install or make its needed packages available in the cache.',
+ '',
'```mermaid',
'stateDiagram-v2',
` [*] --> ${machine.initial}`,
diff --git a/src/trusted-policy.js b/src/trusted-policy.js
index 2ee6b4a7..8424b2af 100644
--- a/src/trusted-policy.js
+++ b/src/trusted-policy.js
@@ -1,6 +1,7 @@
/** Coordinator policy and immutable submission checks cannot come from a builder's candidate [V4,V16,L3,M3]. */
import { spawnSync } from 'node:child_process';
-import { mkdtempSync, mkdirSync, rmSync } from 'node:fs';
+import { digestOf } from './gate.js';
+import { closeSync, mkdtempSync, mkdirSync, openSync, readFileSync, rmSync, statSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { configFromSource } from './config.js';
@@ -99,19 +100,63 @@ export function frozenCheck(item) {
/** Run the frozen check at the exact submitted commit in a private clone, leaving live worktrees untouched. */
export function checkAtCommit(root, item) {
const command = frozenCheck(item);
- if (!command) return { green: true, checked: false };
+ if (!command) return { state: 'pass', green: true, checked: false, report: '' };
+ let config;
+ try { config = itemPolicy(root, item).config; }
+ catch { return checkResult('unverified', 'policy', '', ''); }
+ const install = config.check.install;
+ const timeout = config.check.timeoutMs;
const scratch = mkdtempSync(join(tmpdir(), 'pullboard-criterion-'));
const copy = join(scratch, 'repo');
const home = join(scratch, 'home');
mkdirSync(home, { mode: 0o700 });
- const env = { ...cleanGitEnvironment(), HOME: home, PULLBOARD_HOME: join(home, '.pullboard'), PULLBOARD_MACHINE_HOME: join(home, 'machine'), GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' };
+ const verifierHome = process.env.HOME ?? process.env.USERPROFILE;
+ const npmCache = process.env.npm_config_cache ?? join(verifierHome ?? home, '.npm');
+ const env = { ...cleanGitEnvironment(), HOME: home, PULLBOARD_HOME: join(home, '.pullboard'), PULLBOARD_MACHINE_HOME: join(home, 'machine'), GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1', npm_config_cache: npmCache };
+ delete env.PULLBOARD_RELAY_TOKEN;
+ let installOutput = '';
+ let checkOutput = '';
try {
const common = policyGit(root, ['rev-parse', '--path-format=absolute', '--git-common-dir']).trim();
const clone = spawnSync('git', ['clone', '--quiet', '--shared', '--no-checkout', common, copy], { env, stdio: 'ignore' });
const checkout = clone.status === 0 && spawnSync('git', ['checkout', '--quiet', '--detach', item.item_commit], { cwd: copy, env, stdio: 'ignore' });
- if (!checkout || checkout.status !== 0) return { green: false, checked: true };
- const run = spawnSync('(\n' + command + '\n) 2>&1', { cwd: copy, env, shell: true, stdio: 'ignore', timeout: 300000 });
- return { green: run.status === 0, checked: true };
- } catch { return { green: false, checked: true }; }
+ if (!checkout || checkout.status !== 0) return checkResult('unverified', 'clone or checkout', installOutput, checkOutput);
+ const deadline = Date.now() + timeout;
+ if (install) {
+ const run = runPrivateCommand(copy, env, install, Math.max(1, deadline - Date.now()), join(scratch, 'install.log'));
+ installOutput = run.output;
+ if (run.error?.code === 'ETIMEDOUT') return checkResult('unverified', 'install timed out', installOutput, checkOutput);
+ if (run.status !== 0) return checkResult('unverified', 'install failed', installOutput, checkOutput);
+ }
+ const remaining = deadline - Date.now();
+ if (remaining <= 0) return checkResult('unverified', 'check timed out', installOutput, checkOutput);
+ const run = runPrivateCommand(copy, env, command, remaining, join(scratch, 'check.log'));
+ checkOutput = run.output;
+ if (run.error?.code === 'ETIMEDOUT') return checkResult('unverified', 'check timed out', installOutput, checkOutput);
+ if (run.error || run.status === null) return checkResult('unverified', 'check could not complete', installOutput, checkOutput);
+ return checkResult(run.status === 0 ? 'pass' : 'red', 'check', installOutput, checkOutput);
+ } catch { return checkResult('unverified', 'check', installOutput, checkOutput); }
finally { rmSync(scratch, { recursive: true, force: true }); }
}
+
+/** Run one shell command in a bounded private process group and capture its combined output. */
+function runPrivateCommand(root, env, command, timeout, logPath) {
+ const descriptor = openSync(logPath, 'w', 0o600);
+ try {
+ const run = spawnSync('sh', ['-c', `ulimit -f 16384\n(\n${command}\n)`], {
+ cwd: root, env, detached: true, stdio: ['ignore', descriptor, descriptor], timeout,
+ });
+ if (run.pid) {
+ try { process.kill(-run.pid, 'SIGKILL'); } catch { /* The process group has already exited. */ }
+ }
+ const output = readFileSync(logPath, 'utf8');
+ const capped = statSync(logPath).size >= 8 * 1024 * 1024 ? `${output}\n[output capped at 8 MiB]` : output;
+ return { ...run, output: capped };
+ } finally { closeSync(descriptor); }
+}
+
+/** Summarize both private command outputs for verifier and doctor diagnostics. */
+function checkResult(state, stage, installOutput, checkOutput) {
+ const output = `install:\n${installOutput || '(no output)'}\ncheck:\n${checkOutput || '(not run or no output)'}`;
+ return { state, green: state === 'pass', checked: true, stage, report: digestOf(output) || '(no output)', output };
+}
diff --git a/test/e2e.test.js b/test/e2e.test.js
index 094df3e2..748bb50f 100644
--- a/test/e2e.test.js
+++ b/test/e2e.test.js
@@ -20,6 +20,7 @@ import { connect } from 'node:net';
import { join, resolve } from 'node:path';
import { after, test } from 'node:test';
import { parseSpec } from '../src/spec.js';
+import { checkAtCommit } from '../src/trusted-policy.js';
import * as store from '../src/board.js';
const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');
@@ -1763,6 +1764,82 @@ function attackCommit(box, cwd) {
return commit;
}
+/** Submit a fixture whose private check reads an ignored dependency folder. */
+function privateCheckSubmission({ install = '', timeout = '5m', check }) {
+ const box = project('true');
+ const config = JSON.parse(readFileSync(join(box.repo, 'pullboard.json'), 'utf8'));
+ config.check = { install, timeout };
+ writeFileSync(join(box.repo, 'pullboard.json'), JSON.stringify(config, null, 2));
+ box.git(box.repo, 'add', 'pullboard.json');
+ box.git(box.repo, 'commit', '-q', '-m', 'chore: configure private check fixture');
+ box.git(box.web, 'merge', '-q', '--ff-only', 'main');
+ assert.equal(box.run(box.repo, 'add', 'web', 'Private check', '--specs', 'G1', '--criterion', 'the installed check passes', '--check', check).code, 0);
+ assert.equal(box.run(box.web, 'claim', '1').code, 0);
+ mkdirSync(join(box.web, 'web'));
+ writeFileSync(join(box.web, 'web/.gitignore'), '.deps/\n');
+ writeFileSync(join(box.web, 'web/index.html'), 'fixture');
+ const commit = attackCommit(box, box.web);
+ assert.equal(box.run(box.web, 'submit', '1').code, 0);
+ const review = join(box.dir, 'private-check-review');
+ box.git(box.repo, 'worktree', 'add', '-q', '--detach', review, commit);
+ assert.equal(box.run(review, 'join', 'api').code, 0);
+ return { ...box, review, commit };
+}
+
+test('accept installs ignored dependencies from frozen policy and doctor audits the same private check [V18,V2]', () => {
+ const box = privateCheckSubmission({
+ install: 'echo frozen-install-ran; mkdir -p web/.deps; printf installed > web/.deps/ready',
+ check: 'test -f web/.deps/ready',
+ });
+ const accepted = box.run(box.review, 'verify', '1', 'accept', '--note', 'the private install created the ignored dependency folder', '--json');
+ assert.equal(accepted.code, 0, accepted.err);
+ const doctor = box.run(box.repo, 'doctor', '--json');
+ assert.equal(doctor.code, 0, doctor.out);
+
+ const board = store.openBoard(join(box.repo, '.git/pullboard/board.sqlite'));
+ let item;
+ try { item = store.getItem(board, 1); }
+ finally { store.closeBoard(board); }
+ writeFileSync(join(box.web, 'pullboard.json'), JSON.stringify({ ...JSON.parse(readFileSync(join(box.web, 'pullboard.json'), 'utf8')), check: { install: 'echo malicious-install-ran; exit 7', timeout: '5m' } }));
+ const changed = attackCommit(box, box.web);
+ const proof = checkAtCommit(box.repo, { ...item, item_commit: changed });
+ assert.equal(proof.state, 'pass');
+ assert.match(proof.output, /frozen-install-ran/);
+ assert.doesNotMatch(proof.output, /malicious-install-ran/);
+});
+
+test('accept without check.install keeps CHECK_RED and names the missing setting [V18,V2]', () => {
+ const box = privateCheckSubmission({ check: 'echo check-failed; test -f web/.deps/ready' });
+ const refused = box.run(box.review, 'verify', '1', 'accept', '--note', 'checking missing private dependency', '--json');
+ assert.equal(refused.code, 1);
+ const error = JSON.parse(refused.out).error;
+ assert.equal(error.code, 'CHECK_RED');
+ assert.match(error.message, /check\.install/);
+ assert.match(error.message, /output digest/);
+ assert.match(error.message, /check-failed/);
+});
+
+test('accept reports failed install as CHECK_UNVERIFIED with an output digest [V18,V2]', () => {
+ const box = privateCheckSubmission({ install: 'echo install-failed; exit 9', check: 'true' });
+ const refused = box.run(box.review, 'verify', '1', 'accept', '--note', 'install must complete before verification', '--json');
+ assert.equal(refused.code, 1);
+ const error = JSON.parse(refused.out).error;
+ assert.equal(error.code, 'CHECK_UNVERIFIED');
+ assert.match(error.message, /install failed/);
+ assert.match(error.message, /output digest/);
+ assert.match(error.message, /install-failed/);
+});
+
+test('accept reports a frozen check timeout as CHECK_UNVERIFIED [V18,V2]', () => {
+ const box = privateCheckSubmission({ timeout: '100ms', check: 'case "$PULLBOARD_HOME" in */pullboard-criterion-*/home/.pullboard) while :; do :; done;; *) exit 1;; esac' });
+ const refused = box.run(box.review, 'verify', '1', 'accept', '--note', 'the frozen check exceeded its configured timeout', '--json');
+ assert.equal(refused.code, 1);
+ const error = JSON.parse(refused.out).error;
+ assert.equal(error.code, 'CHECK_UNVERIFIED');
+ assert.match(error.message, /check timed out/);
+ assert.match(error.message, /output digest/);
+});
+
test('the blind gate-bypass repro refuses submit and accept, and doctor audits pre-merge policy [V4,V16,L3,M3]', () => {
const box = project('true');
assert.equal(box.run(box.repo, 'add', 'web', 'Append notes', '--specs', 'G1', '--criterion', 'append one note', '--check', 'test ! -f web/RED_CHECK').code, 0);