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(board): retain the exact ordered claim protocol [B24,H16]
Corey Olson53ba5d07b52a
diff --git a/src/moves/claim.js b/src/moves/claim.jsindex 990828fd..fd7d5957 100644--- a/src/moves/claim.js+++ b/src/moves/claim.js@@ -25,7 +25,9 @@ function existingEngine(args, board, at) {function minimumEngine(args, board, at) {const outside = board && Boolean(outsideSource(board, args[0]));const capacity = args[1]?.lineCapacity === true;- const item = board?.db.prepare('SELECT item_after FROM item WHERE item_id=?').get(args[0]);+ const id = args[0];+ const validId = ['number', 'string'].includes(typeof id) && Number.isSafeInteger(Number(id)) && Number(id) > 0;+ const item = board && validId ? board.db.prepare('SELECT item_after FROM item WHERE item_id=?').get(id) : null;const foreign = item && hasForeignDependencies(item);return Math.max(foreign ? CROSS_REPO_DEPENDENCY_ENGINE : 1, outside ? OUTSIDE_INTAKE_ENGINE : 1, capacity ? LINE_CAPACITY_ENGINE : 1, existingEngine(args, board, at));}diff --git a/test/team.test.js b/test/team.test.jsindex 47773ff2..f200a9b0 100644--- a/test/team.test.js+++ b/test/team.test.js@@ -948,7 +948,8 @@ test('an item waits across repos [B24,H16]', async t => {const move = prepareEngineMove(local, 'claim', [dependent, options]);const { CROSS_REPO_DEPENDENCY_ENGINE } = await import('../src/cross-repo-dependency-engine.js');assert.ok(move.engine >= CROSS_REPO_DEPENDENCY_ENGINE, 'older replicas cannot flatten a foreign-dependent claim');- assert.deepEqual(applyEngineMove(local, move), applyEngineMove(replica, move), 'one ordered claim returns the same receipt on both replicas');+ const ordered = { sequence: 1, at: clock.now().toISOString() };+ assert.deepEqual(applyEngineMove(local, move, ordered), applyEngineMove(replica, move, ordered), 'one ordered claim returns the same receipt on both replicas');assert.equal(store.getItem(local, dependent).item_status, 'claimed');assert.equal(store.getItem(replica, dependent).item_status, 'claimed', 'replica uses canonical received state, not a local registry or foreign-board path');assert.deepEqual(exportBoard(replica), exportBoard(local), 'same canonical state and claim produce exact replica rows and event IDs');