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.

test(gate): static style refuses before submit proof [C7]

Corey Olson4dede11fe1f5
diff --git a/test/submit-gate.test.js b/test/submit-gate.test.js
index b70fb413..78a3d751 100644
--- a/test/submit-gate.test.js
+++ b/test/submit-gate.test.js
@@ -1379,3 +1379,37 @@ test('nested TAP child denials require bounded matching fatal details [C7,B26]',
assert.equal(sandboxBlockedOperation(box.root, tapBareNodeError(options)), null, `${label} stays unclassified`);
}
});
+
+/** Project-declared static guards reject unchanged-gate import regressions before costly proof. */
+test('a submit runs the static style checks first [C7]', t => {
+ let box = privateRepo(t);
+ const marker = join(box.dir, 'item-check-ran');
+ box.env.ITEM_CHECK_MARKER = marker;
+ const check = 'node -e "require(\'node:fs\').writeFileSync(process.env.ITEM_CHECK_MARKER, \'ran\')"';
+ put(box.root, 'pullboard.json', JSON.stringify({ gate: 'node -e "process.exit(0)"',
+ affectedTests: 'node --test', submitGate: 'landing', staticChecks: 'node test/static-style-check.mjs',
+ spec: 'SPEC.md', verify: 'any', lease: '2h' }));
+ put(box.root, 'src/cli.js', "import { join } from 'node:path';\nexport const fixture = join;\n");
+ const oracle = new URL('./import-style-helpers.js', import.meta.url).href;
+ put(box.root, 'test/static-style-check.mjs', [
+ "import { readFileSync } from 'node:fs';",
+ `import { importStyleViolations } from ${JSON.stringify(oracle)};`,
+ "const file = 'src/cli.js';",
+ "const errors = importStyleViolations([{ file, source: readFileSync(file, 'utf8') }]);",
+ "for (const row of errors) console.error(`${row.file}:${row.line}: one import binding per line`);",
+ 'process.exit(errors.length ? 1 : 0);',
+ ].join('\n'));
+ commitAll(box);
+ box = builderRepo(box);
+ const added = box.coordinator('add', 'build', 'Static style before proof', '--check', check);
+ assert.equal(added.code, 0, added.err);
+ assert.equal(box.run('claim', '1').code, 0);
+ put(box.root, 'src/cli.js', "import { join, resolve } from 'node:path';\nexport const fixture = join;\n");
+ commitAll(box, 'feat(core): expose the missed static guard [G1]');
+ rmSync(marker, { force: true });
+ const submitted = box.run('submit', '1', '--json');
+ assert.notEqual(submitted.code, 0, 'submit must refuse a static import violation before any item proof');
+ assert.match(submitted.out + submitted.err, /src\/cli\.js:1: one import binding per line/u);
+ assert.equal(existsSync(marker), false, 'the frozen item check must not run after an early static refusal');
+ assert.equal(JSON.parse(box.run('show', '1', '--json').out).item_status, 'claimed');
+});