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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(land): retain long legacy stop markers [C7,V4]
Corey Olson3f69a3008fab
diff --git a/src/land.js b/src/land.jsindex 44b5997b..1d94f349 100644--- a/src/land.js+++ b/src/land.js@@ -125,10 +125,15 @@ function completionAccount() {let plan = null;let topLevel = 0;const counts = {};+ /** Recognize canonical incomplete accounts even when only a bounded line prefix is retained. */+ const markerPrefix = (text) => {+ if (/^(?:Landing gate stopped early after |Files not run: |Interrupted test files: )/u.test(text)) early = true;+ };return {+ markerPrefix,/** Consume one complete output line without retaining test output or diagnostic blocks. */line(text) {- if (/^(?:Landing gate stopped early after |Files not run: |Interrupted test files: )/u.test(text)) early = true;+ markerPrefix(text);if (/^(?:not )?ok \d+\b/u.test(text)) topLevel++;const planned = /^1\.\.(\d+)\s*$/u.exec(text);if (planned) plan = Number(planned[1]);@@ -164,14 +169,16 @@ function completeGate(gate) {const parts = chunk.toString('latin1', 0, count).split('\n');for (const [index, part] of parts.entries()) {if (index) {- if (!oversized) account.line(pending);+ if (oversized) account.markerPrefix(pending);+ else account.line(pending);pending = ''; oversized = false;}- if (!oversized && pending.length + part.length <= 256) pending += part;- else { pending = ''; oversized = true; }+ if (pending.length + part.length > 256) oversized = true;+ pending += part.slice(0, 256 - pending.length);}}- if (!oversized) account.line(pending);+ if (oversized) account.markerPrefix(pending);+ else account.line(pending);return account.complete();} finally { closeSync(input); }}diff --git a/test/land.test.js b/test/land.test.jsindex 5f14ed98..910e9961 100644--- a/test/land.test.js+++ b/test/land.test.js@@ -700,6 +700,52 @@ test('a waiver after an early-stopped gate runs the gate again [C7,V4]', async (});});+test('a waiver after an early-stopped gate runs the gate again with legacy oversized markers [C7,V4]', () => {+ const box = landProject();+ const gate = join(box.dir, 'land-gate.cjs');+ writeFileSync(gate, [+ "const fs = require('node:fs'); const path = require('node:path');",+ `const calls = ${JSON.stringify(box.calls)}; const trace = ${JSON.stringify(box.trace)};`,+ "const args = process.argv.slice(2); const alone = args.includes('--alone'); fs.appendFileSync(calls, JSON.stringify(args) + '\\n');",+ "const files = alone ? args.filter(arg => arg !== '--alone') : fs.readdirSync('web').filter(name => /^land-\\d+\\.test\\.js$/.test(name)).map(name => 'web/' + name);",+ "console.log('TAP version 13'); let count = 0; let failed = 0;",+ "for (const file of files) { const text = fs.readFileSync(file, 'utf8'); count++; fs.appendFileSync(trace, JSON.stringify({ alone, file }) + '\\n');",+ " const red = !alone && process.env.LAND_SUPPRESS_RED !== '1' && text.includes('FLAKE');",+ " console.log((red ? 'not ok ' : 'ok ') + count + ' - ' + file + ' keeps the landed behavior');",+ " if (red) { failed++; console.log(' ---\\n location: ' + path.resolve(file) + ':1:1\\n error: fixture failure\\n ...');",+ " if (process.env.LAND_EARLY_STOP === '1') { console.error('Landing gate stopped early after ' + file + ': fixture failure' + ' '.repeat(300)); console.error('Files not run: ' + files.slice(count).join(', ') + ' '.repeat(300)); break; } }",+ "}",+ "console.log('1..' + count); console.log('# tests ' + count); console.log('# pass ' + (count - failed)); console.log('# fail ' + failed); process.exitCode = failed ? 1 : 0;",+ ].join('\n'));+ const entries = verifiedFour(box, { flaky: 0 });+ box.env.LAND_EARLY_STOP = '1';+ const held = json(box, box.repo, 'land');+ assert.equal(held.batch.state, 'flaky');+ assert.deepEqual(held.landed, []);+ onBoard(box, board => {+ const saved = store.landingBatches(board).find(batch => batch.id === held.batch.id);+ store.recordLandingBatch(board, { agentId: 'coordinator', revision: saved.revision,+ batch: { ...saved, gateResults: saved.gateResults.map(({ complete, requiresGreen, ...run }) => run) } });+ });+ const before = calls(box).length;+ const initial = readFileSync(held.batch.logPath, 'utf8');+ assert.ok(initial.split('\n').find(line => line.startsWith('Landing gate stopped early after ')).length > 256,+ 'the early-stop marker exceeds the legacy reader line cap');+ assert.ok(initial.split('\n').find(line => line.startsWith('Files not run: ')).length > 256);+ assert.doesNotMatch(initial, /ok 2 -/u, 'later files actually did not run');+ json(box, box.repo, 'land', '--waive', FILES[0], '--until', '2099-01-01', '--reason', 'private first failure exception');+ delete box.env.LAND_EARLY_STOP;+ box.env.LAND_SUPPRESS_RED = '1';+ const result = json(box, box.repo, 'land');+ assert.deepEqual(calls(box).slice(before), [[]], 'exactly one fresh full gate runs after the waiver');+ const rerun = readFileSync(result.batch.logPath, 'utf8');+ assert.match(rerun, /ok 4 - web\/land-4/u, 'the fresh run reaches the previously untouched final file');+ assert.doesNotMatch(rerun, /stopped early|Files not run/u);+ assert.match(rerun, /# fail 0/u);+ assert.deepEqual(result.landed, entries.map(entry => entry.item));+ assert.equal(box.git(box.remote, 'rev-parse', 'main'), result.batch.tip);+});+test('land stops again with an expired waiver, and a changed test on main releases the held batch [B3,R3]', () => {const box = landProject();box.env.LAND_SUPPRESS_RED = '1';