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(gate): exclude cancelled invariant proposals [C7,V4]

Corey Olsonc869e4ccbfcd
diff --git a/src/land.js b/src/land.js
index efa565d8..e11809de 100644
--- a/src/land.js
+++ b/src/land.js
@@ -19,7 +19,7 @@ function testHash(root, file) {
}
/** Derive failing test identities from TAP names and source locations, refusing unknown paths. */
-export function landingFailures(output, root) {
+export function landingFailures(output, root, { excludeCancelled = false } = {}) {
const failures = [];
let active = null;
for (const line of output.split('\n')) {
@@ -35,8 +35,9 @@ export function landingFailures(output, root) {
const file = isAbsolute(path) ? relative(root, path) : path.replace(/^\.\//u, '');
if (file && !file.startsWith('../') && !file.includes('\\')) active.file = file;
}
+ if (excludeCancelled && active && /^\s*failureType:\s*['"]?(?:cancelledByParent|subtestsFailed)['"]?\s*$/u.test(line)) active.omit = true;
}
- const unique = new Map(failures.map((entry) => [`${entry.file}\0${entry.name}`, entry]));
+ const unique = new Map(failures.filter(entry => !entry.omit).map(({ file, name }) => [`${file}\0${name}`, { name, file }]));
return [...unique.values()];
}
@@ -211,7 +212,7 @@ async function gateGroup(state, label) {
const evidence = state.batch.invariantEvidence ?? { version: 1, gates: [], diagnostics: [] };
const tested = { commit, isGreen: gate.isGreen && completeGate(gate),
submissions: state.batch.items.map(({ id, commit }) => ({ id, commit })),
- failures: [...new Set(result.failures.map(failure => failure.file).filter(Boolean))],
+ failures: [...new Set(landingFailures(gate.output, state.batch.root, { excludeCancelled: true }).map(failure => failure.file).filter(Boolean))],
fileTimes: landingFileTimes(state.batch.root, gate.profile) };
await save(state, { gateResults: [...state.gates.values()].map(({ tree: testedTree, isGreen, failures, complete, requiresGreen, logPath: log }) =>
({ tree: testedTree, isGreen, failures, complete: complete ?? null, requiresGreen: Boolean(requiresGreen), logPath: log })),
diff --git a/test/submit-invariants.test.js b/test/submit-invariants.test.js
index a3fb582d..41253798 100644
--- a/test/submit-invariants.test.js
+++ b/test/submit-invariants.test.js
@@ -7,6 +7,7 @@ import * as store from '../src/board.js';
import { applyEngineMove, applyRelayMove, prepareEngineMove } from '../src/engine.js';
import { exportBoard, importBoard } from '../src/exchange.js';
import { SUBMISSION_PROOF_ENGINE, landingFileTimes } from '../src/submit-invariants.js';
+import { landingFailures } from '../src/land.js';
import { createE2eHelpers } from './e2e-helpers.js';
const e2e = createE2eHelpers();
@@ -186,4 +187,8 @@ test('submission selection replays on two replicas and legacy history remains un
'case-body duration is not a measured file duration');
assert.deepEqual(landingFileTimes('/fixture', { files: [{ path: '/fixture/test/a.test.js', durationMs: 8 }, { path: '/elsewhere/private.js', durationMs: 1 }] }),
[{ path: 'test/a.test.js', durationMs: 8 }], 'reported file timings are relative and cannot escape the project');
+ const cancelled = "not ok 1 - cancelled child\n location: /fixture/test/cancelled.test.js:1:1\n failureType: 'cancelledByParent'\nnot ok 2 - actual failure\n location: /fixture/test/failed.test.js:1:1\n failureType: 'testCodeFailure'\nnot ok 3 - test/wrapper.test.js\n failureType: 'subtestsFailed'\n";
+ assert.equal(landingFailures(cancelled, '/fixture').length, 3, 'the existing landing parser behavior stays available');
+ assert.deepEqual(landingFailures(cancelled, '/fixture', { excludeCancelled: true }), [{ file: 'test/failed.test.js', name: 'actual failure' }],
+ 'cancellation fallout and aggregate wrappers do not become independent escaped-file suggestions');
});