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(land): waivers subtract only accounted TAP failures per stage [B3]

Corey Olson388cc817181b
diff --git a/src/cli.js b/src/cli.js
index c98db6ed..6c96a28e 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -84,7 +84,7 @@ import { readRelayMachine } from './relay-machine.js';
import { relayJoin, relayPair } from './relay-pairing-client.js';
import { executePersonRequests } from './relay-request-execution.js';
import { engineReceipt } from './engine.js';
-import { land, landingFailures, waivedFailures, waiverLine } from './land.js';
+import { accountedFailures, land, waivedFailures, waiverLine } from './land.js';
const CHECKOUT_LEASES = new WeakMap();
const CHECKOUT_BOARD_ONLY = new WeakMap();
@@ -2135,7 +2135,7 @@ async function submitHere(ctx, id) {
// A full-gate stamp never substitutes for either proof; only an actual full fallback may stamp.
const gate = await runSubmitGate(root, ctx.config, { base: claimHead, trunk: acceptedMain.commit, check: frozenCheck(held), agent: me.id, item: String(id), onWait: gateWaitReporter(ctx.io) });
// Only the person's live waivers can pass a red proof, failure by failure; the item's own check is never waived [B3].
- const waived = !gate.isGreen && gate.check?.green ? withBoard(ctx, (board) => waivedFailures(board, landingFailures(gate.output ?? '', root))) : null;
+ const waived = !gate.isGreen && gate.check?.green ? withBoard(ctx, (board) => waivedFailures(board, accountedFailures(gate, root))) : null;
if (!gate.isGreen && !waived) {
const message = `the submission proof is red at ${commit.slice(0, 12)}; fix it, commit, submit again. ${submitGateReport(gate)}`;
// No submission can follow this verdict. Read-only main comparisons must not retain the seat's write lease.
@@ -3381,9 +3381,9 @@ async function runCommand(argv, io) {
}
throw error;
}
- const gate = await runGate(ctx.info.root, config, { landing: values.landing, agent: resourceAgent(ctx), onWait: gateWaitReporter(io) });
+ const gate = await runGate(ctx.info.root, config, { landing: values.landing, agent: resourceAgent(ctx), onWait: gateWaitReporter(io), stages: Boolean(values.landing) });
// A landing gate honours the person's live waivers exactly as land does; a red run never stamps, so it stays waived, not green [B3,R3].
- const waived = values.landing && !gate.isGreen ? withBoard(ctx, (board) => waivedFailures(board, landingFailures(gate.output ?? '', ctx.info.root))) : null;
+ const waived = values.landing && !gate.isGreen ? withBoard(ctx, (board) => waivedFailures(board, accountedFailures(gate, ctx.info.root))) : null;
if (waived) {
const lines = waived.map(waiverLine);
const report = `landing gate waived, not green: ${waived.length} failure(s), each covered by a live person waiver; the whole output is in ${gate.log}\n${lines.join('\n')}`;
diff --git a/src/gate.js b/src/gate.js
index 7a0f2ccd..1a679873 100644
--- a/src/gate.js
+++ b/src/gate.js
@@ -122,16 +122,96 @@ export function isStampedGreen(root) {
return tree !== null && existsSync(file) && readFileSync(file, 'utf8').trim() === tree;
}
+/**
+ * Split a gate command into its top-level stages, the commands joined by `&&`, `||`, `;` or a newline.
+ * Anything the split cannot read for certain (a subshell, a group, command substitution, a heredoc,
+ * a comment, a background job or an open quote) returns null, so no stage is ever guessed [B3,R3].
+ *
+ * @param {string} command
+ * @returns {Array<{ text: string, op: string }> | null}
+ */
+export function gateStages(command) {
+ const source = String(command).trim();
+ const stages = [];
+ let current = '';
+ let quote = null;
+ let variable = 0;
+ /** Close the current stage with the operator that follows it; an empty stage is unreadable. */
+ const close = (op) => {
+ if (!current.trim() || /\\$/u.test(current.trim())) return false;
+ stages.push({ text: current.trim(), op });
+ current = '';
+ return true;
+ };
+ for (let at = 0; at < source.length; at += 1) {
+ const char = source[at];
+ const next = source[at + 1];
+ if (quote === "'") { current += char; if (char === "'") quote = null; continue; }
+ if (char === '\\') { current += next === '\n' ? ' ' : char + (next ?? ''); at += 1; continue; }
+ if (char === '`' || (char === '$' && next === '(')) return null;
+ if (quote === '"') { current += char; if (char === '"') quote = null; continue; }
+ if (char === "'" || char === '"') { quote = char; current += char; continue; }
+ if (char === '$' && next === '{') { variable += 1; current += '${'; at += 1; continue; }
+ if (char === '}' && variable) { variable -= 1; current += char; continue; }
+ if ('(){}#'.includes(char) || (char === '<' && (next === '<' || next === '('))) return null;
+ if (char === '&') {
+ if (next === '&') { if (!close('&&')) return null; at += 1; continue; }
+ if (next === '>' || source[at - 1] === '>' || source[at - 1] === '<') { current += char; continue; }
+ return null;
+ }
+ if (char === '|' && next === '|') { if (!close('||')) return null; at += 1; continue; }
+ if (char === ';') { if (next === ';' || !close(';')) return null; continue; }
+ if (char === '\n') { if (current.trim() && !close(';')) return null; continue; }
+ current += char;
+ }
+ if (quote || variable || !current.trim() || /\\$/u.test(current.trim())) return null;
+ stages.push({ text: current.trim(), op: '' });
+ return stages;
+}
+
+/**
+ * Wrap each stage so the shell prints its start and its exit status between private marker lines.
+ * Control flow is unchanged: each wrapper exits with its stage's status, and an `exit` inside a
+ * stage still ends the run, which leaves that stage without an end marker and so unaccounted.
+ */
+function stagedScript(stages, marker) {
+ return stages.map((stage, index) => `{ printf '\\n${marker} begin ${index}\\n'; {\n${stage.text}\n}; pullboard_stage_status=$?; `
+ + `printf '\\n${marker} end ${index} %s\\n' "$pullboard_stage_status"; (exit "$pullboard_stage_status"); } ${stage.op}`).join('\n');
+}
+
+/** Cut a staged run's output back to the command's own lines and each stage's lines and status. */
+function readStages(output, marker, count) {
+ const stages = Array.from({ length: count }, () => ({ status: null, lines: [], began: false }));
+ const kept = [];
+ let open = null;
+ const lines = output.split('\n');
+ for (const [index, line] of lines.entries()) {
+ const found = line.startsWith(`${marker} `) ? /^(?:\S+) (begin|end) (\d+)(?: (\d+))?$/u.exec(line) : null;
+ if (found) {
+ if (kept.length && kept.at(-1) === '' && lines[index - 1] === '') kept.pop();
+ const stage = stages[Number(found[2])];
+ if (!stage) { open = null; continue; }
+ if (found[1] === 'begin') { stage.began = true; open = stage; }
+ else { stage.status = found[3] === undefined ? null : Number(found[3]); open = null; }
+ continue;
+ }
+ kept.push(line);
+ if (open) open.lines.push(line);
+ }
+ return { output: kept.join('\n'), stages: stages.map(({ status, lines: own, began }) => ({ status: began ? status : null, output: own.join('\n') })) };
+}
+
/**
* Run a shell command in a checkout for a digest: both streams in one pipe, in order, read whole
- * however long, stdin closed so nothing waits on a person.
+ * however long, stdin closed so nothing waits on a person. With `stages`, each top-level stage's
+ * exit status and own output are kept too, or `stages` is null when the command cannot be split.
*
* @param {string} root
* @param {string} command
- * @param {{ pipefail?: boolean, env?: NodeJS.ProcessEnv }} [options] - Gate-only pipefail and additional child environment values.
- * @returns {{ isGreen: boolean, output: string, seconds: number }}
+ * @param {{ pipefail?: boolean, env?: NodeJS.ProcessEnv, stages?: boolean }} [options] - Gate-only pipefail, additional child environment values and per-stage accounting.
+ * @returns {{ isGreen: boolean, output: string, seconds: number, stages?: Array<{ status: number|null, output: string }> | null }}
*/
-export function runShell(root, command, { pipefail = false, env = {} } = {}) {
+export function runShell(root, command, { pipefail = false, env = {}, stages = false } = {}) {
const started = Date.now();
const options = { cwd: root, env: { ...gitChildEnv(root), ...env }, shell: true, stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf8', maxBuffer: 2 ** 30 };
let prefix = '';
@@ -143,10 +223,16 @@ export function runShell(root, command, { pipefail = false, env = {} } = {}) {
throw new Refused('PIPEFAIL_UNAVAILABLE', 'the repo gate shell cannot enable pipefail; rewrite the gate without a pipe');
}
}
+ const split = stages ? gateStages(command) : null;
+ const marker = `PULLBOARD_STAGE_${randomUUID().replaceAll('-', '')}`;
// Newlines, not spaces, around the command, so a trailing comment in it cannot swallow the `)`.
- const result = spawnSync(`${prefix}(\n${command}\n) 2>&1`, options);
+ const result = spawnSync(`${prefix}(\n${split ? stagedScript(split, marker) : command}\n) 2>&1`, options);
invalidateGitFacts();
- return { isGreen: result.status === 0, output: `${result.stdout ?? ''}${result.stderr ?? ''}`, seconds: Math.round((Date.now() - started) / 1000) };
+ const raw = `${result.stdout ?? ''}${result.stderr ?? ''}`;
+ const seconds = Math.round((Date.now() - started) / 1000);
+ if (!stages) return { isGreen: result.status === 0, output: raw, seconds };
+ if (!split) return { isGreen: result.status === 0, output: raw, seconds, stages: null };
+ return { isGreen: result.status === 0, seconds, ...readStages(raw, marker, split.length) };
}
/** Replace a possible secret-bearing line before persisting a direct item-check log. */
@@ -163,7 +249,7 @@ function safeLog(output) {
* @param {string} command
* @param {{ waitMs?: number, artifactDirectory?: string, artifactPrefix?: string, persistLog?: boolean, profileFile?: string, pipefail?: boolean, gateSlotHeld?: boolean, gateLease?: object }} [options]
*/
-export function runProfiledShell(root, command, { waitMs = 0, artifactDirectory, artifactPrefix = 'pullboard-gate', persistLog = false, profileFile, pipefail = false, gateSlotHeld = false, gateLease } = {}) {
+export function runProfiledShell(root, command, { waitMs = 0, artifactDirectory, artifactPrefix = 'pullboard-gate', persistLog = false, profileFile, pipefail = false, gateSlotHeld = false, gateLease, stages = false } = {}) {
const directory = artifactDirectory ?? dirname(gitPath(root, LOG));
mkdirSync(directory, { recursive: true, mode: 0o700 });
const id = randomUUID();
@@ -171,7 +257,7 @@ export function runProfiledShell(root, command, { waitMs = 0, artifactDirectory,
const logPath = persistLog ? join(directory, `${artifactPrefix}-${id}.log`) : null;
const started = Date.now();
const inherited = gateLease ? gateSlotEnvironment(gateLease) : gateSlotHeld ? { [GATE_SLOT_HELD_ENV]: '1' } : {};
- const run = runShell(root, command, { pipefail, env: inherited });
+ const run = runShell(root, command, { pipefail, env: inherited, stages });
const profile = writeTimingProfile(profilePath, {
...timingFromOutput(run.output, timingRunner(command)),
waitMs: Math.max(0, Math.round(waitMs)), wallMs: Math.max(0, Date.now() - started),
@@ -312,24 +398,25 @@ export async function withGateSlot(root, action, { landing = false, itemCheck =
* @param {{ trustStamp?: boolean, onWait?: (state: object) => void, landing?: boolean, agent?: string, item?: string|number }} [options]
* @returns {Promise<{ isGreen: boolean, isCached: boolean, output: string, seconds: number, log: string, profile?: object, profilePath?: string }>}
*/
-export async function runGate(root, config, { trustStamp = true, onWait, landing = false, agent, item = '' } = {}) {
+export async function runGate(root, config, { trustStamp = true, onWait, landing = false, agent, item = '', stages = false } = {}) {
if (!config.gate.trim()) {
throw new Refused('NO_GATE', 'no gate configured; set "gate" in pullboard.json, e.g. "npm test"');
}
if (trustStamp && isStampedGreen(root)) return { isGreen: true, isCached: true, output: '', seconds: 0, log: '' };
- return await withGateSlot(root, (lease) => fullGateRun(root, config, trustStamp, { waitMs: lease.waitMs, gateLease: lease }), {
+ return await withGateSlot(root, (lease) => fullGateRun(root, config, trustStamp, { waitMs: lease.waitMs, gateLease: lease, stages }), {
landing, browser: true, agent, item, kind: landing ? 'landing' : 'gate', onWait,
});
}
/** Run a full gate while its caller owns the queue lease; only a full run may stamp its tree. */
-function fullGateRun(root, config, trustStamp = false, { waitMs = 0, log = gitPath(root, LOG), gateLease } = {}) {
+function fullGateRun(root, config, trustStamp = false, { waitMs = 0, log = gitPath(root, LOG), gateLease, stages = false } = {}) {
if (trustStamp && isStampedGreen(root)) return { isGreen: true, isCached: true, output: '', seconds: 0, log: '' };
const before = committedTree(root);
- const { isGreen, output, seconds, profile, profilePath } = runProfiledShell(root, config.gate, { waitMs, pipefail: true, profileFile: `${log}.profile.json`, gateLease });
+ const run = runProfiledShell(root, config.gate, { waitMs, pipefail: true, profileFile: `${log}.profile.json`, gateLease, stages });
+ const { isGreen, output, seconds, profile, profilePath } = run;
writeFileSync(log, output);
if (isGreen && before !== null && committedTree(root) === before) writeFileSync(gitPath(root, STAMP), `${before}\n`);
- return { isGreen, isCached: false, output, seconds, log, profile, profilePath };
+ return { isGreen, isCached: false, output, seconds, log, profile, profilePath, ...(stages ? { stages: run.stages } : {}) };
}
/** Quote a fixed executable or selected path without permitting shell expansion. */
@@ -384,11 +471,12 @@ export async function runSubmitGate(root, config, { base, trunk, changed, check,
// The proof already owns this lease: its phase profile has no additional queue wait.
const proofWait = check ? 0 : lease.waitMs;
let proof;
- if (selection.full) proof = fullGateRun(root, config, false, { waitMs: proofWait, log: proofLog, gateLease: lease });
+ // The proof keeps each stage's status, so a person's waiver can only ever explain named test failures.
+ if (selection.full) proof = fullGateRun(root, config, false, { waitMs: proofWait, log: proofLog, gateLease: lease, stages: true });
else if (!selection.files.length) proof = { isGreen: true, output: '', seconds: 0, isCached: false, log: '' };
else {
const command = `${config.affectedTests.trimEnd()} ${selection.files.map(path => commandWord('./' + path)).join(' ')}`;
- proof = { ...runProfiledShell(root, command, { waitMs: proofWait, profileFile: `${proofLog}.profile.json`, gateLease: lease }), isCached: false, log: proofLog };
+ proof = { ...runProfiledShell(root, command, { waitMs: proofWait, profileFile: `${proofLog}.profile.json`, gateLease: lease, stages: true }), isCached: false, log: proofLog };
writeFileSync(proofLog, proof.output);
}
writeFileSync(log, `item check:\n${criterion.output}\n${selection.full ? 'full gate' : 'affected tests'}:\n${proof.output}`);
diff --git a/src/land.js b/src/land.js
index 20476ec7..bf79ea5a 100644
--- a/src/land.js
+++ b/src/land.js
@@ -127,12 +127,12 @@ async function gateGroup(state, label) {
mkdirSync(directory, { recursive: true });
const logPath = join(directory, `${label}-${state.batch.revision}.log`);
await save(state, { state: 'gating', tip: headCommit(state.batch.root), logPath });
- const gate = await runGate(state.batch.root, state.config, { trustStamp: false, landing: true, agent: 'coordinator', onWait: state.onWait });
+ const gate = await runGate(state.batch.root, state.config, { trustStamp: false, landing: true, agent: 'coordinator', onWait: state.onWait, stages: true });
copyFileSync(gate.log, logPath);
if (gate.profilePath) copyFileSync(gate.profilePath, `${logPath}.profile.json`);
- const result = { ...gate, failures: landingFailures(gate.output, state.batch.root), tree, logPath };
+ const result = { ...gate, failures: landingFailures(gate.output, state.batch.root), accounted: accountedFailures(gate, state.batch.root), tree, logPath };
state.gates.set(tree, result);
- await save(state, { gateResults: [...state.gates.values()].map(({ tree: testedTree, isGreen, failures, logPath: log }) => ({ tree: testedTree, isGreen, failures, logPath: log })) });
+ await save(state, { gateResults: [...state.gates.values()].map(({ tree: testedTree, isGreen, failures, accounted, logPath: log }) => ({ tree: testedTree, isGreen, failures, accounted: accounted ?? null, logPath: log })) });
return result;
}
@@ -155,12 +155,77 @@ async function diagnose(state, failures) {
return flakes;
}
+/**
+ * Read one stage's TAP strictly: test lines outside YAML blocks, each failure's file from its own
+ * block, and a final `# fail N` that equals the failures read. Anything after that summary other
+ * than summary counts or the package manager's own failure report means something else failed,
+ * so the stage is unaccounted and null is returned [B3,R3].
+ */
+export function tapFailures(output, root) {
+ const lines = output.split('\n');
+ const failures = [];
+ let yaml = null;
+ let active = null;
+ let version = false;
+ let summary = null;
+ let summaryAt = -1;
+ let cancelled = 0;
+ for (const [index, line] of lines.entries()) {
+ if (yaml !== null) {
+ if (line === `${yaml}...`) { yaml = null; continue; }
+ const location = /^\s*location:\s*['"]?(.+?):\d+(?::\d+)?['"]?\s*$/u.exec(line);
+ if (active && location) {
+ const path = location[1];
+ const file = isAbsolute(path) ? relative(root, path) : path.replace(/^\.\//u, '');
+ if (file && !file.startsWith('../') && !file.includes('\\')) active.file = file;
+ }
+ continue;
+ }
+ const block = /^(\s*)---\s*$/u.exec(line);
+ if (block) { yaml = block[1]; continue; }
+ if (/^TAP version \d+\s*$/u.test(line)) version = true;
+ const failed = /^\s*not ok\s+\d+\s+-\s+(.*)$/u.exec(line);
+ if (failed) {
+ active = { name: failed[1].replace(/\s+#.*$/u, ''), file: null };
+ if (/^(?:\.\/)?(?:test|tests)\/[^\r\n]+\.(?:[cm]?js|ts|py)$/u.test(active.name)) active.file = active.name.replace(/^\.\//u, '');
+ failures.push(active);
+ continue;
+ }
+ if (/^\s*ok\s+\d+/u.test(line)) { active = null; continue; }
+ const count = /^# fail (\d+)\s*$/u.exec(line);
+ if (count) { summary = Number(count[1]); summaryAt = index; }
+ const stopped = /^# cancelled (\d+)\s*$/u.exec(line);
+ if (stopped) cancelled = Number(stopped[1]);
+ }
+ if (yaml !== null || !version || summary === null || summary < 1 || summary !== failures.length || cancelled !== 0) return null;
+ const trailer = lines.slice(summaryAt + 1).every((line) => !line.trim() || /^# [a-z_]+ \d+(?:\.\d+)?\s*$/u.test(line) || /^npm (?:ERR!|error|warn|notice)\b/u.test(line));
+ return trailer ? failures : null;
+}
+
+/**
+ * The failures that explain a red run, or null when anything else may have failed: the command
+ * could not be split into stages, a stage did not finish, or a stage exited other than 0 without
+ * exactly 1 and a complete TAP account of its failures. Waivers only ever subtract these [B3,R3].
+ */
+export function accountedFailures(gate, root) {
+ if (gate.isGreen || !Array.isArray(gate.stages) || !gate.stages.length) return null;
+ const failures = [];
+ for (const stage of gate.stages) {
+ if (!Number.isInteger(stage.status)) return null;
+ if (stage.status === 0) continue;
+ const own = stage.status === 1 ? tapFailures(stage.output ?? '', root) : null;
+ if (!own) return null;
+ failures.push(...own);
+ }
+ return failures.length ? failures : null;
+}
+
/**
* Pair every named failure of a red run with the live person waiver covering it, or return null.
* One unnamed, unfiled or unwaived failure voids the whole run, so a waiver never hides another red [B3,R3].
*/
export function waivedFailures(board, failures) {
- if (!failures.length || failures.some((entry) => !entry.file)) return null;
+ if (!Array.isArray(failures) || !failures.length || failures.some((entry) => !entry.file)) return null;
const covered = failures.map((failure) => ({ ...failure, waiver: store.landingWaiverFor(board, failure) }));
return covered.every((entry) => entry.waiver) ? covered : null;
}
@@ -173,7 +238,7 @@ export function waiverLine(failure) {
/** Record every failure's exact live waiver rather than changing which tests the gate runs. */
function waivedProof(state, gate) {
- const failures = waivedFailures(state.board, gate.failures);
+ const failures = waivedFailures(state.board, gate.accounted);
return failures ? { tree: gate.tree, failures: failures.map((entry) => ({ ...entry, waiver: entry.waiver.id })), logPath: gate.logPath } : null;
}
diff --git a/test/land.test.js b/test/land.test.js
index ff44ee65..c86f1620 100644
--- a/test/land.test.js
+++ b/test/land.test.js
@@ -1,6 +1,6 @@
/** Exercise landing against real private Git worktrees, hooks, SQLite and bare remotes [B3,R3]. */
import assert from 'node:assert/strict';
-import { existsSync, readFileSync, writeFileSync } from 'node:fs';
+import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { join, relative } from 'node:path';
import { after, test } from 'node:test';
import * as store from '../src/board.js';
@@ -717,6 +717,40 @@ test("a person's waiver lets a submit and a landing gate through only the waived
assert.equal(landingJson.green, false, 'a waived landing gate is never reported green');
assert.deepEqual(landingJson.waived.map((entry) => [entry.file, entry.waiver]), [[FILES[0], waiver.id]]);
assert.notEqual(stampOf(box.repo), box.git(box.repo, 'rev-parse', 'HEAD^{tree}'), 'a waived landing gate writes no green stamp');
+
+ // A separate stage that fails outside any test is never covered by a waiver for the test that also failed.
+ const setup = join(box.dir, 'stage-setup.cjs');
+ const runs = join(box.dir, 'stage-setup-runs');
+ const broken = join(box.dir, 'stage-setup-broken');
+ writeFileSync(setup, `const fs = require('node:fs'); fs.appendFileSync(${JSON.stringify(runs)}, 'x'); if (fs.existsSync(${JSON.stringify(broken)})) throw new Error('separate setup stage failed');\n`);
+ const configPath = join(box.repo, 'pullboard.json');
+ const original = readFileSync(configPath, 'utf8');
+ const gateCommand = JSON.parse(original).gate;
+ const setGate = (command, message) => {
+ writeFileSync(configPath, JSON.stringify({ ...JSON.parse(original), gate: command }, null, 2));
+ box.git(box.repo, 'add', 'pullboard.json');
+ box.git(box.repo, 'commit', '-q', '-m', message);
+ };
+ writeFileSync(broken, 'on\n');
+ setGate(`${gateCommand}; node ${JSON.stringify(setup)}`, 'chore: run a separate setup stage after the tests');
+ const staged = box.run(box.repo, 'gate', '--landing', '--json');
+ assert.equal(readFileSync(runs, 'utf8').length, 1, 'the failing setup stage really ran');
+ assert.equal(staged.code, 1, 'a waived test plus a separate failing stage refuses the landing gate');
+ assert.equal(JSON.parse(staged.out).waived, undefined, 'a refused run names no waived failures');
+ assert.doesNotMatch(staged.out, /waived, not green/u);
+ const stagedItem = itemWorktree(box, 4);
+ assert.equal(commitFile(box, stagedItem.path, stagedItem.file, 'PASS\n', `feat(web): build land fixture ${stagedItem.item} [G1]`).status, 0);
+ const stagedSubmit = box.run(stagedItem.path, 'submit', String(stagedItem.item), '--json');
+ assert.equal(JSON.parse(stagedSubmit.out).error?.code, 'GATE_RED', 'a waived test plus a separate failing stage refuses the submission');
+ assert.equal(readFileSync(runs, 'utf8').length, 2, 'the submission ran the failing setup stage');
+ assert.ok(!events(box).some((event) => event.event_kind === 'fact' && event.item_id === stagedItem.item), 'a refused submission records nothing as waived');
+ rmSync(broken);
+ setGate(`node ${JSON.stringify(setup)} && ${gateCommand}`, 'chore: run a passing setup stage before the tests');
+ const passingStage = box.run(box.repo, 'gate', '--landing');
+ assert.equal(passingStage.code, 0, `${passingStage.err}\n${passingStage.out}`);
+ assert.match(passingStage.out, line, 'a passing stage leaves only the waived test to subtract');
+ setGate(gateCommand, 'chore: restore the single-stage gate');
+
onBoard(box, (board) => {
assert.equal(store.landingWaiverFor(board, { file: FILES[2], name: FILES[0] }), null, 'a file waiver never covers a test merely named like that file');
store.recordLandingWaiver(board, { agentId: 'person', channel: 'terminal', id: 'name-waiver', test: 'keeps a named behavior', until: '2099-01-01', reason: 'named fixture' });