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): only placeholder leaves are numbered at landing [B3,R3]
Corey Olson5f9710b7919a
diff --git a/src/engine-numbers.js b/src/engine-numbers.jsindex 61c664e5..357c2882 100644--- a/src/engine-numbers.js+++ b/src/engine-numbers.js@@ -51,7 +51,7 @@ export function nextEngineNumber(leaves) {}/**- * Give each unlanded leaf under `root`/src its number, next above the landed ones in file-name order, and keep the+ * Give each unlanded leaf under `root`/src (one importing the placeholder) its number, next above the landed ones in file-name order, and keep the* documented move engine in docs/formats.md equal to the result. A tree with no unlanded leaf is left untouched.** @param {string} root@@ -60,7 +60,18 @@ export function nextEngineNumber(leaves) {export function assignEngineNumbers(root) {const directory = join(root, 'src');if (!existsSync(directory)) return { files: [], assigned: [] };- const leaves = readEngineLeaves(directory);+ // Only a leaf that imports the placeholder is Pullboard's to number. Any other project may have its own+ // src/*-engine.js files that follow none of these rules; they are never read as leaves, so a land never fails on them.+ const texts = readdirSync(directory).filter((file) => ENGINE_CANDIDATE.test(file))+ .map((file) => ({ file, text: readFileSync(join(directory, file), 'utf8') }));+ const leaves = texts.map(({ file, text }) => {+ const lines = text.split('\n').filter((line) => /^export const /u.test(line));+ const match = lines.length === 1 ? ENGINE_LINE.exec(lines[0]) : null;+ if (!match) return null;+ const number = match[2] === undefined ? null : Number(match[2]);+ if (number === null && !text.split('\n').includes(UNASSIGNED_IMPORT)) return null;+ return { file, name: match[1], number };+ }).filter(Boolean);const unlanded = leaves.filter((leaf) => leaf.number === null);if (!unlanded.length) return { files: [], assigned: [] };let next = nextEngineNumber(leaves) - 1;diff --git a/test/land-engine-fixture.js b/test/land-engine-fixture.jsindex 9cb9284a..ba57a687 100644--- a/test/land-engine-fixture.js+++ b/test/land-engine-fixture.js@@ -33,6 +33,9 @@ export function landEnginesInOrder({ landProject, itemWorktree, submitItem, accemkdirSync(join(box.repo, 'src'), { recursive: true });mkdirSync(join(box.repo, 'docs'), { recursive: true });writeFileSync(join(box.repo, 'src', 'base-engine.js'), '/** The landed base engine. */\nexport const BASE_ENGINE = 80;\n');+ // The project's own engine file, which is not Pullboard's: landing must neither fail on it nor change it.+ const game = '/** The project\'s game engine. */\nexport class GameEngine {}\nexport const SPEED = 3;\n';+ writeFileSync(join(box.repo, 'src', 'game-engine.js'), game);writeFileSync(join(box.repo, 'docs', 'formats.md'), '| Format | Version |\n| --- | --- |\n| `move engine` | `80` | the fixture |\n');box.git(box.repo, 'add', '-A');box.git(box.repo, 'commit', '-q', '-m', 'chore: a landed engine and its documented number');@@ -58,6 +61,7 @@ export function landEnginesInOrder({ landProject, itemWorktree, submitItem, acceassert.match(landed, /^export const ALPHA_ENGINE = \d+;$/mu, 'the export line itself names its number');assert.ok(!landed.includes("from './engine-next.js'"), 'a landed leaf no longer imports the placeholder');assert.notEqual(box.git(box.repo, 'rev-parse', 'main'), base);+ assert.equal(box.git(box.repo, 'show', `${result.batch.tip}:src/game-engine.js`) + '\n', game, 'the project\'s own engine file is untouched');// The landed board replays: its events import into a fresh board unchanged.const document = onBoard(box, (board) => exportBoard(board));const replayed = store.openBoard(join(box.dir, 'replayed.sqlite'));