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(core): bind coverage to accepted execution inputs [V2,V4,M1]

Corey Olson9d357ed9648c
diff --git a/docs/lifecycle.md b/docs/lifecycle.md
index 4ab8c1de..061eb509 100644
--- a/docs/lifecycle.md
+++ b/docs/lifecycle.md
@@ -54,7 +54,7 @@ Each move checks its guards in this order and refuses with the first one that do
| Move | From | To | Who | Guards, in order; result refusals |
| --- | --- | --- | --- | --- |
-| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), builderFirstRefusal (REOPEN_HELD_FOR_BUILDER), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |
+| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), builderFirstRefusal (REOPEN_HELD_FOR_BUILDER), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or BAR_NOT_READY or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |
| release | open, claimed | open | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), releaseOwnsWork (NOT_YOURS), reviewReleaseExplained (NOTE_REQUIRED) |
| lapse | claimed | open | clock, when its lease runs out | none |
| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), correctionRefrozen (PENDING_REFREEZE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT or HOST_NAME), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), trunkInCandidate (MAIN_NOT_COMPOSED), noUnverifiedStack (STACKED_ON_UNVERIFIED), infraExplained (INFRA_NOTE_REQUIRED), doctrineHolds (RATCHET_ROSE or RATCHET_UNCOUNTED), gateConfigured (NO_GATE), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), gateGreen (GATE_RED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW) |
@@ -63,8 +63,8 @@ Each move checks its guards in this order and refuses with the first one that do
| reject | submitted, verified | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonCoded (BAD_REASON), noteGiven (NOTE_REQUIRED), causeWellFormed (BAD_CAUSE), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION), result (NOT_YOURS), result (CLOSED) |
| reopen | submitted, verified | open | coordinator | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), coordinatorOnly (COORDINATOR_ONLY), noteGiven (NOTE_REQUIRED), causeWellFormed (BAD_CAUSE), notMerged (ALREADY_MERGED), landingFailureRecorded (LANDING_FAILURE_REQUIRED), trunkConflicts (NOT_CONFLICTING or CONFLICT_FILES or NO_TRUNK or MERGE_CHECK_FAILED), conflictAccepted (NOT_ACCEPTED or BAD_CONFLICT or ENGINE_VERSION), result (BAD_CONFIG) |
| escalate | open, claimed | open | agent, coordinator | joined (NOT_JOINED or SESSION_LEDGER), noteGiven (NOTE_REQUIRED), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED) |
-| refreeze | open, claimed, submitted | open | coordinator, when there is no live claim awaiting a coordinator correction | joined (NOT_JOINED or SESSION_LEDGER), coordinatorOnly (COORDINATOR_ONLY), itemExists (NO_ITEM), inState (CLOSED), barReady (BAR_NOT_READY), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |
-| refreeze | claimed | claimed | agent, coordinator, when a live claim has a pending coordinator correction | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED), barReady (BAR_NOT_READY), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |
+| refreeze | open, claimed, submitted | open | coordinator, when there is no live claim awaiting a coordinator correction | joined (NOT_JOINED or SESSION_LEDGER), coordinatorOnly (COORDINATOR_ONLY), itemExists (NO_ITEM), inState (CLOSED), barReady (BAR_NOT_READY), rowsInForce (UNKNOWN_SPEC or BAR_NOT_READY or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |
+| refreeze | claimed | claimed | agent, coordinator, when a live claim has a pending coordinator correction | joined (NOT_JOINED or SESSION_LEDGER), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED), barReady (BAR_NOT_READY), rowsInForce (UNKNOWN_SPEC or BAR_NOT_READY or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED) |
| withdraw | open, claimed, submitted | withdrawn | coordinator | joined (NOT_JOINED or SESSION_LEDGER), coordinatorOnly (COORDINATOR_ONLY), noteGiven (NOTE_REQUIRED), itemExists (NO_ITEM), inState (CLOSED) |
## Required transition guards
@@ -108,6 +108,7 @@ Each move checks its guards in this order and refuses with the first one that do
| PENDING_REFREEZE | no coordinator correction to a claimed criterion or check is waiting to be frozen | pullboard refreeze <id> |
| ONE_CLAIM | the caller holds no other live top-level claim, reworks of its own rejected items aside | submit or release the other item first; child items are free |
| UNKNOWN_SPEC | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | fix the spec, or the coordinator withdraws the item |
+| BAR_NOT_READY | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | another parent session signs coverage for the current accepted test inventory and runner |
| A5_GRAMMAR_VERSION | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | upgrade Pullboard or use a file written for grammar 1 |
| NO_POLICY | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | restore the committed coordinator policy |
| BAD_CONFIG | every row the item cites exists and is in force, only where the criterion freezes: claiming an item with no frozen criterion, and refreeze | repair and commit the coordinator configuration |
diff --git a/src/bar-coverage.js b/src/bar-coverage.js
index 811f3794..546c9e1e 100644
--- a/src/bar-coverage.js
+++ b/src/bar-coverage.js
@@ -29,7 +29,7 @@ function observation(value, selection) {
export function normalizeBarCoverage(value, item) {
const bad = detail => { throw new Refused('BAR_COVERAGE', `${detail}; supply --coverage-file with recorded whole-file evidence before pullboard bar sign ${item.item_id}`); };
if (!value || value.version !== 1 || !COMMIT.test(value.sourceMain) || value.sourceCheck !== item.item_check
- || !Number.isSafeInteger(value.timeoutMs) || value.timeoutMs <= 0 || typeof value.runner !== 'string'
+ || !HASH.test(value.policyKey) || !Number.isSafeInteger(value.timeoutMs) || value.timeoutMs <= 0 || typeof value.runner !== 'string'
|| !Array.isArray(value.required) || value.required.some(path => !projectPath(path)) || !Array.isArray(value.files)) bad('the coverage plan must bind accepted main, its timeout, test paths and the original named check');
const required = [...new Set(value.required)].sort();
const files = value.files.map(file => {
@@ -47,13 +47,27 @@ export function normalizeBarCoverage(value, item) {
const totalMs = fixed + files.filter(file => file.mode === 'whole').reduce((sum,file) => sum + file.evidence.durationMs, 0);
if (totalMs > value.timeoutMs) bad('the recorded named, install and whole-file durations together exceed the unchanged review timeout');
if (files.some(file => file.mode === 'whole') && !value.runner.trim()) bad('configure the project affectedTests command; Pullboard never substitutes its own test runner');
- return { version: 1, sourceMain: value.sourceMain, sourceCheck: value.sourceCheck, timeoutMs: value.timeoutMs,
+ return { version: 1, sourceMain: value.sourceMain, policyKey: value.policyKey, sourceCheck: value.sourceCheck, timeoutMs: value.timeoutMs,
runner: value.runner, required, files, totalMs, ...(files.length ? { named: { ...value.named }, installMs: value.installMs, ...(value.install ? { install: { ...value.install } } : {}) } : {}) };
}
-/** Resolve existing brief test paths at accepted main; the project explicitly configures non-Node globs. */
-export function prepareBarCoverage(root, item, policy, file) {
+/** Bind inventory and accepted execution settings, allowing unrelated main changes without resigning. */
+function coverageInputs(root, item, policy) {
const committed = new Set(git(root, ['ls-tree', '-r', '--name-only', '-z', policy.commit]).split('\0').filter(Boolean));
const required = [...new Set(briefFiles(item.item_brief).filter(path => committed.has(path) && barTestPath(path, policy.config.claim.barTestFiles)))].sort();
+ const policyKey = createHash('sha256').update(JSON.stringify({ required, runner: policy.config.affectedTests ?? '',
+ install: policy.config.check.install, timeoutMs: policy.config.check.timeoutMs, patterns: policy.config.claim.barTestFiles })).digest('hex');
+ return { required, policyKey };
+}
+/** Revalidate the signed inventory and runner at the frozen policy, never silently replan its proof. */
+export function barCoverageForPolicy(root, item, plan, policy) {
+ if (coverageInputs(root, item, policy).policyKey !== plan.policyKey) {
+ throw new Refused('BAR_NOT_READY', `#${item.item_id}'s accepted test inventory, runner, install or timeout changed after signing; another session must read the new policy and run pullboard bar sign ${item.item_id} with current coverage`);
+ }
+ return plan;
+}
+/** Resolve existing brief test paths at accepted main; the project explicitly configures non-Node globs. */
+export function prepareBarCoverage(root, item, policy, file) {
+ const { required, policyKey } = coverageInputs(root, item, policy);
let supplied = {};
if (file) {
const path = resolve(root, file);
@@ -66,7 +80,7 @@ export function prepareBarCoverage(root, item, policy, file) {
if (policy.config.check.install && required.length && (!observation(supplied.install, 'install') || supplied.installMs !== supplied.install.durationMs)) throw new Refused('BAR_COVERAGE', 'the accepted install command needs its own recorded duration in --coverage-file');
if (!policy.config.check.install) supplied.installMs = 0;
return normalizeBarCoverage({ ...supplied, version: 1, sourceMain: policy.commit, sourceCheck: item.item_check,
- timeoutMs: policy.config.check.timeoutMs, runner: policy.config.affectedTests ?? '', required, files: supplied.files ?? [] }, item);
+ timeoutMs: policy.config.check.timeoutMs, policyKey, runner: policy.config.affectedTests ?? '', required, files: supplied.files ?? [] }, item);
}
/** Digest every captured input so a signature cannot be transplanted to another coverage plan. */
export function barCoverageDigest(plan) { return createHash('sha256').update(JSON.stringify(plan)).digest('hex'); }
diff --git a/src/board.js b/src/board.js
index 0194ef92..682dc65e 100644
--- a/src/board.js
+++ b/src/board.js
@@ -1192,6 +1192,7 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyCom
hasCommit: null,
withinLane: null,
trunkMergeClean: null,
+ trunkInCandidate: null,
noUnverifiedStack: null,
infraExplained: null, // The CLI checks the claimed Git diff before this transition.
doctrineHolds: null,
diff --git a/src/cli.js b/src/cli.js
index 054acfaf..923e0823 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -1,5 +1,5 @@
import { barReadinessRequired, barReadiness } from './bar-readiness.js';
-import { barCoverageCommand } from './bar-coverage.js';
+import { barCoverageCommand, barCoverageForPolicy } from './bar-coverage.js';
/**
* The pullboard command line: every command, bound to who is asking (B3, R3). The main checkout is the
* coordinator; every other worktree is the agent that joined from it.
@@ -1087,7 +1087,7 @@ export function freezer(ctx, { captureVerifyPolicy = false, board } = {}) {
const frozen = frozenCriterion(loadSpec(ctx.info.root, config), item, doctrine);
if (!policy) return frozen; // Legacy criteria retain their original digest and committed claim base.
const signed = board && barReadinessRequired(board, item) ? barReadiness(board, item).signed : null;
- const coverage = signed?.coverage;
+ const coverage = signed?.coverage ? barCoverageForPolicy(ctx.info.root, item, signed.coverage, { commit: policy.commit, config }) : null;
const text = JSON.stringify({ ...JSON.parse(frozen.text), ...(coverage ? { sourceCheck: item.item_check, check: barCoverageCommand(item.item_check, coverage), barCoverage: coverage, barRevision: signed.revision } : {}), policy });
return { text, digest: createHash('sha256').update(text).digest('hex') };
};
diff --git a/src/commands/submit.js b/src/commands/submit.js
index 0408457b..fcfbafb6 100644
--- a/src/commands/submit.js
+++ b/src/commands/submit.js
@@ -24,6 +24,7 @@ import {
withGateSlot,
} from '../gate.js';
import {
+ contains,
headCommit,
headTree,
isClean,
@@ -97,6 +98,9 @@ export async function submitHere(ctx, id, infra) {
if (recordedRecovery(board, recovered)) return { me, recorded: true };
const item = store.getItem(board, id);
const trunk = requireTrunkMerge(root, recovered.args[1].commit);
+ if (barReadySetting(board).enabled && (recovered.args[1].policyCommit !== trunk.commit || !contains(root, trunk.commit, recovered.args[1].commit))) {
+ throw new Refused('MAIN_NOT_COMPOSED', 'the unrecorded recovered submission has no proof for current main; run pullboard inbox to synchronize its original receipt, or ask the coordinator to resolve the pending move before a fresh submit; the original request is retained');
+ }
refuseUnverifiedStack(root, board, item, recovered.args[1].commit, trunk);
return { me, recorded: false };
});
diff --git a/src/machine.js b/src/machine.js
index c642b69b..622ef06c 100644
--- a/src/machine.js
+++ b/src/machine.js
@@ -162,7 +162,7 @@ export const GUARDS = [
{ id: 'itemNotHeld', refuse: 'ITEM_HELD', rule: 'the coordinator has not put this item on hold', next: 'the coordinator lifts it with pullboard hold <id> --off', source: 'board', when: 'unless the caller is renewing its own live claim' },
{ id: 'correctionRefrozen', refuse: 'PENDING_REFREEZE', rule: 'no coordinator correction to a claimed criterion or check is waiting to be frozen', next: 'pullboard refreeze <id>', source: 'board' },
{ id: 'oneLiveClaim', refuse: 'ONE_CLAIM', rule: 'the caller holds no other live top-level claim, reworks of its own rejected items aside', next: 'submit or release the other item first; child items are free', source: 'board' },
- { id: 'rowsInForce', refuse: 'UNKNOWN_SPEC', alsoRefuses: [{ code: 'A5_GRAMMAR_VERSION', next: 'upgrade Pullboard or use a file written for grammar 1' }, { code: 'NO_POLICY', next: 'restore the committed coordinator policy' }, { code: 'BAD_CONFIG', next: 'repair and commit the coordinator configuration' }, { code: 'SPEC_BEHIND_MAIN', next: 'merge main from this worktree, then retry the claim' }, { code: 'AGENT_APPROVAL_REQUIRED', next: 'ask the coordinator to arrange the person’s confirmation or decline, or change the explicit refuse setting' }], rule: 'every row the item cites exists and is in force', next: 'fix the spec, or the coordinator withdraws the item', source: 'board', when: 'only where the criterion freezes: claiming an item with no frozen criterion, and refreeze' },
+ { id: 'rowsInForce', refuse: 'UNKNOWN_SPEC', alsoRefuses: [{ code: 'BAR_NOT_READY', next: 'another parent session signs coverage for the current accepted test inventory and runner' }, { code: 'A5_GRAMMAR_VERSION', next: 'upgrade Pullboard or use a file written for grammar 1' }, { code: 'NO_POLICY', next: 'restore the committed coordinator policy' }, { code: 'BAD_CONFIG', next: 'repair and commit the coordinator configuration' }, { code: 'SPEC_BEHIND_MAIN', next: 'merge main from this worktree, then retry the claim' }, { code: 'AGENT_APPROVAL_REQUIRED', next: 'ask the coordinator to arrange the person’s confirmation or decline, or change the explicit refuse setting' }], rule: 'every row the item cites exists and is in force', next: 'fix the spec, or the coordinator withdraws the item', source: 'board', when: 'only where the criterion freezes: claiming an item with no frozen criterion, and refreeze' },
{ id: 'criterionUnchanged', refuse: 'CRITERIA_CHANGED', rule: 'the criterion and the rows it cites read as they did at claim', next: 'the coordinator runs pullboard refreeze <id>', source: 'cli' },
{ id: 'treeClean', refuse: 'DIRTY', rule: 'the worktree has no uncommitted changes', next: 'commit your changes, then submit', source: 'cli' },
{ id: 'nothingUntracked', refuse: 'UNTRACKED', rule: 'the worktree has no untracked files', next: 'commit or ignore them, then submit', source: 'cli' },
diff --git a/test/bar-coverage.test.js b/test/bar-coverage.test.js
index 7c573f64..4cb8d75c 100644
--- a/test/bar-coverage.test.js
+++ b/test/bar-coverage.test.js
@@ -4,7 +4,7 @@ import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { test } from 'node:test';
-import { barCoverageCommand, normalizeBarCoverage, prepareBarCoverage, barTestPath } from '../src/bar-coverage.js';
+import { barCoverageCommand, normalizeBarCoverage, prepareBarCoverage, barTestPath, barCoverageForPolicy } from '../src/bar-coverage.js';
import { requireSubmitComposition } from '../src/submit-composition.js';
import { baselineTestEvidence } from '../src/check-baseline.js';
import { configFromSource } from '../src/config.js';
@@ -19,7 +19,7 @@ function observed(durationMs, selection = 'whole-file') {
function example() {
const path = 'test/adjacent.test.js';
const item = { item_id: 1, item_check: `node --test --test-name-pattern named ${path}`, item_brief: `Files: ${path}\nTest: named proves the behavior` };
- const plan = { version: 1, sourceMain: SHA, sourceCheck: item.item_check, timeoutMs: 1000, runner: 'node --test', required: [path],
+ const plan = { version: 1, sourceMain: SHA, policyKey: 'c'.repeat(64), sourceCheck: item.item_check, timeoutMs: 1000, runner: 'node --test', required: [path],
files: [{ path, mode: 'whole', evidence: observed(400) }], named: observed(100, 'named-check'), installMs: 0 };
return { item, plan, path };
}
@@ -28,6 +28,7 @@ function repository(t) {
const root = mkdtempSync(join(tmpdir(), 'pullboard-bar-coverage-'));
t.after(() => rmSync(root, { recursive: true, force: true }));
const env = { ...process.env, GIT_AUTHOR_NAME: 'Fixture', GIT_AUTHOR_EMAIL: '[email protected]', GIT_COMMITTER_NAME: 'Fixture', GIT_COMMITTER_EMAIL: '[email protected]' };
+ delete env.NODE_TEST_CONTEXT; // A nested CLI/test runner is a normal process, not this test worker.
/** Keep hooks out of this synthetic project; product hooks and admission remain unchanged. */
const git = (...args) => {
const ran = runFixtureChild('git', ['-c','core.hooksPath=/dev/null',...args], { cwd: root, env, encoding: 'utf8' });
@@ -46,7 +47,7 @@ test('[V2,V4] a passing named check cannot hide the failing neighboring case', t
const named = runFixtureChild('/bin/sh',['-c',item.item_check],{cwd:f.root,env:f.env,encoding:'utf8'});
assert.equal(named.status,0,named.stderr);
const whole = runFixtureChild('/bin/sh',['-c',barCoverageCommand(item.item_check,normalizeBarCoverage(plan,item))],{cwd:f.root,env:f.env,encoding:'utf8'});
- assert.notEqual(whole.status,0);
+ assert.notEqual(whole.status,0,whole.stdout+whole.stderr);
assert.match(whole.stdout,/neighbor still fails/);
assert.ok(barCoverageCommand(item.item_check,plan).startsWith(`(\n${item.item_check}\n)`),'original shell command remains intact');
});
@@ -115,3 +116,17 @@ test('[V2,V4] baseline witness distinguishes observed failure, absent case and u
assert.equal(baselineTestEvidence('run-tests: NO_TESTS_MATCHED: no named case', 'node bin/run-tests.js').noTestsMatched, true);
assert.deepEqual(baselineTestEvidence('Error: module missing', 'node --test'), { failed: [], passed: [], noTestsMatched: false });
});
+
+
+test('[V2,V4] new existing test files or accepted execution settings need a new coverage signature', t => {
+ const f=repository(t);const {item,plan}=example();
+ item.item_brief=item.item_brief.replace('Files: test/adjacent.test.js','Files: test/adjacent.test.js, test/new.test.js');
+ const config=configFromSource('{"affectedTests":"node --test","check":{"timeout":"2s"}}');
+ const file=join(f.root,'record.json');writeFileSync(file,JSON.stringify(plan));
+ const policy={commit:f.git('rev-parse','HEAD'),config};const prepared=prepareBarCoverage(f.root,item,policy,file);
+ writeFileSync(join(f.root,'unrelated.txt'),'unrelated');f.git('add','unrelated.txt');f.git('commit','-qm','test: unrelated');
+ assert.doesNotThrow(()=>barCoverageForPolicy(f.root,item,prepared,{commit:f.git('rev-parse','HEAD'),config}));
+ writeFileSync(join(f.root,'test','new.test.js'),'// a newly committed test file');f.git('add','test/new.test.js');f.git('commit','-qm','test: new brief file');
+ assert.throws(()=>barCoverageForPolicy(f.root,item,prepared,{commit:f.git('rev-parse','HEAD'),config}),e=>e.code==='BAR_NOT_READY');
+ assert.throws(()=>barCoverageForPolicy(f.root,item,prepared,{...policy,config:{...config,affectedTests:'node other.js'}}),e=>e.code==='BAR_NOT_READY');
+});
diff --git a/test/claim-reopen.test.js b/test/claim-reopen.test.js
index 451290ca..93e38de0 100644
--- a/test/claim-reopen.test.js
+++ b/test/claim-reopen.test.js
@@ -205,7 +205,7 @@ function signReady(f, id, agentId = f.other) {
const { revision } = barReadiness(f.board, store.getItem(f.board, id));
return signBar(f.board, id, { agentId, revision: revision.revision, digest: revision.digest,
note: 'The builder can meet this bar; two reviewers can use the named witness and listed edges to grade it alike.',
- coverage: { version: 1, sourceMain: COMMIT, sourceCheck: store.getItem(f.board,id).item_check, timeoutMs: 300000, runner: 'node --test', required: [], files: [] } });
+ coverage: { version: 1, sourceMain: COMMIT, policyKey: 'd'.repeat(64), sourceCheck: store.getItem(f.board,id).item_check, timeoutMs: 300000, runner: 'node --test', required: [], files: [] } });
}
test('[B4,V2,V1,H16] a claim waits for a bar signed by another session', (t) => {