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(land): establish executed affected baseline [C7,V4]

Corey Olsonbc7ac3b664c2
diff --git a/src/land.js b/src/land.js
index ef77d52e..db005017 100644
--- a/src/land.js
+++ b/src/land.js
@@ -55,9 +55,6 @@ import {
receiptStore,
} from './gate-run-receipt.js';
import { testsNeedBrowser } from './browser-admission.js';
-import { testsNeedGui } from './gui-admission.js';
-import { selectAffectedTests } from './affected-tests.js';
-import { selectRegistryGuards } from './registry-guards.js';
import { laneOf } from './lanes.js';
import { takeLandingResource } from './landing-resource.js';
import {
@@ -1083,35 +1080,18 @@ export function landsOnTrunk(config) {
}
/**
- * Prove a tier-1 batch's actual merged diff with submit's affected map (#1277). Fixed invariants and registry
- * guards remain a floor; an uncertain import graph requires the configured full gate before adoption.
+ * The quick guards a tier-1 landing runs on its merged tree (#801): the project's static checks and its submit
+ * invariants. Each item's frozen check already ran at verify, and the whole suite runs at publish.
*/
async function quickGuards(state) {
const root = state.batch.root;
await runStaticChecks(root, state.config, { agent: 'coordinator', onWait: state.onWait });
- const commit = headCommit(root);
- const tree = headTree(root);
- const selection = state.config.affectedTests
- ? selectAffectedTests(root, { base: state.batch.base, commit })
- : { full: true, reason: 'affected-test selection is not enabled for this project', files: [] };
- const registry = selectRegistryGuards(root, state.config.registryGuards, { base: state.batch.base });
- const files = [...new Set([...(state.config.submitInvariants ?? []), ...registry, ...(!selection.full ? selection.files : [])])].sort();
- if (files.length) {
- const command = `${state.config.affectedTests} ${files.map(quote).join(' ')}`;
- const browser = !browserFreeChecksEnabled() || await testsNeedBrowser(root, files);
- const run = await withLandingGateSlot(root, lease => runProfiledShell(root, command, { waitMs: lease.waitMs, gateLease: lease, stages: true }),
- { agent: 'coordinator', kind: 'gate', landing: true, browser, gui: testsNeedGui(root, files), onWait: state.onWait });
- if (headCommit(root) !== commit || headTree(root) !== tree || !isClean(root)) {
- throw new Refused('LAND_SOURCE_CHANGED', 'the landing source changed while its affected tests ran; restore the recorded batch before adopting');
- }
- state.say(`batch affected tests: ${files.length} file(s) ${run.isGreen ? 'green' : 'red'} on the merged tree`);
- if (!run.isGreen) throw new Refused('GATE_RED', `the batch affected tests are red on the merged tree: ${files.join(', ')}`);
- }
- if (selection.full) {
- state.say(`batch affected tests require the full gate: ${selection.reason}`);
- const gate = await gateGroup(state, 'affected');
- if (!gate.isGreen) throw new Refused('GATE_RED', 'the full affected gate is red on the merged tree; inspect its recorded failures before landing');
- }
+ const invariants = [...new Set(state.config.submitInvariants ?? [])].sort();
+ if (!invariants.length) return;
+ const command = `${state.config.affectedTests} ${invariants.map(quote).join(' ')}`;
+ const run = await withGateSlot(root, lease => runProfiledShell(root, command, { waitMs: lease.waitMs, gateLease: lease }),
+ { agent: 'coordinator', kind: 'check', itemCheck: true, onWait: state.onWait });
+ if (!run.isGreen) throw new Refused('GATE_RED', `the submit invariants are red on the merged tree: ${invariants.join(', ')}`);
}
/** The affected test files each batch item's submission moved to the landing gate, read from its exact submit. */
diff --git a/test/land-affected.test.js b/test/land-affected.test.js
index 4166f6f6..e9dc7ada 100644
--- a/test/land-affected.test.js
+++ b/test/land-affected.test.js
@@ -16,6 +16,8 @@ function valueTest(expected) {
test('a batch that breaks an affected test is caught at landing [C7,V4]', t => {
const box = e2e.project('node --test web/*.test.js');
+ // A fixture CLI is a fresh process, not the outer Node test worker. Admission markers stay intact.
+ delete box.env.NODE_TEST_CONTEXT;
const configFile = join(box.repo, 'pullboard.json');
const config = JSON.parse(readFileSync(configFile, 'utf8'));
writeFileSync(configFile, JSON.stringify({ ...config, affectedTests: 'node --test', submitGate: 'landing',
@@ -39,6 +41,8 @@ test('a batch that breaks an affected test is caught at landing [C7,V4]', t => {
const commit = box.git(box.web, 'rev-parse', 'HEAD');
const submitted = box.run(box.web, 'submit', String(item));
assert.equal(submitted.code, 0, submitted.out + submitted.err);
+ const checkLog = box.git(box.web, 'rev-parse', '--git-path', 'pullboard-submit.log.check.log');
+ assert.match(readFileSync(join(box.web, checkLog), 'utf8'), /# tests 1\b/u, 'submit really executes its frozen test');
box.git(box.repo, 'switch', '-q', '--detach', commit);
try {
const verified = box.run(box.repo, 'verify', String(item), 'accept', '--as', 'coordinator', '--note', 'private real affected-test fixture');
@@ -50,6 +54,7 @@ test('a batch that breaks an affected test is caught at landing [C7,V4]', t => {
const main = box.git(box.repo, 'rev-parse', 'main');
const mainGate = box.run(box.repo, 'gate');
assert.equal(mainGate.code, 0, mainGate.out + mainGate.err);
+ assert.match(readFileSync(join(box.repo, '.git/pullboard-gate.log'), 'utf8'), /# tests 3\b/u, 'main really executes all three tests');
const outcome = box.run(box.repo, 'land', '--json');
assert.equal(outcome.code, 0, outcome.out + outcome.err);
const landing = JSON.parse(outcome.out);
diff --git a/test/land.test.js b/test/land.test.js
index f4b99600..a9e899ae 100644
--- a/test/land.test.js
+++ b/test/land.test.js
@@ -1402,7 +1402,7 @@ test('publish pushes only a head the whole suite passed and names every red [B3,
assert.equal(box.git(box.remote, 'rev-parse', 'main'), fixed, 'only the head the whole suite passed reaches the remote');
});
-test('an uncertain affected batch passes its full gate before local adoption [B3,R3,C7,V4]', () => {
+test('an accepted item lands on the local trunk before the whole suite runs [B3,R3]', () => {
const box = landProject();
const path = join(box.repo, 'pullboard.json');
const config = JSON.parse(readFileSync(path, 'utf8'));
@@ -1417,14 +1417,14 @@ test('an uncertain affected batch passes its full gate before local adoption [B3
assert.equal(result.batch.state, 'landed');
assert.equal(box.git(box.repo, 'rev-parse', 'main'), result.batch.tip, 'the local trunk holds the landed batch');
assert.equal(box.git(box.remote, 'rev-parse', 'main'), remoteBefore, 'tier 1 pushes nothing');
- assert.equal(calls(box).length - start, 1, 'an unsupported fixture graph requires one full gate before adoption');
+ assert.deepEqual(calls(box).slice(start), [], 'no whole-suite run before the items land');
const merges = box.git(box.repo, 'rev-list', '--first-parent', `${result.batch.base}..${result.batch.tip}`).split('\n');
for (const entry of entries) assert.ok(merges.includes(json(box, box.repo, 'show', String(entry.item)).item_merged_commit), `#${entry.item} has its merged receipt on the local trunk`);
// Tier 2 then runs the whole suite once on that exact head and pushes it.
const published = json(box, box.repo, 'publish');
assert.equal(published.published, true);
assert.equal(box.git(box.remote, 'rev-parse', 'main'), result.batch.tip);
- assert.equal(calls(box).length - start, 2, 'publish also proves its exact trunk head before pushing');
+ assert.equal(calls(box).length - start, 1, 'publish ran the whole suite once');
});
test('a publish gate run is recorded and a red and green pair it sees files the flake [C7,D1]', () => {