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(grants): cross-lane verdicts are review from an engine [E21,V2,H16]
Corey Olson04db80a3e692
diff --git a/src/agent-grant.js b/src/agent-grant.jsindex 3a0ff323..a02cd65f 100644--- a/src/agent-grant.js+++ b/src/agent-grant.js@@ -1,5 +1,6 @@/** Derive authority from existing seats and claims; no mutable saved grant supplies permission [E21]. */import { AGENT_GRANT_ENGINE } from './agent-grant-engine.js';+import { REVIEW_GRANT_ENGINE } from './review-grant-engine.js';import { MOVE_REGISTRY } from './move-registry.js';import { Refused } from './refused.js';@@ -61,8 +62,11 @@ export function requireAgentGrant(board, move, at = board.clock.now()) {if (!scope.creating && !item) return; // Preserve the operation's own malformed/missing-item refusal.const now = at.toISOString();// A verdict is review, not an item change: verify's own rules (reservations, builder and session- // independence) govern reviewers, who check other lanes' work by design.- if (move.operation === 'verify') return;+ // independence) govern reviewers, who check other lanes' work by design. Older verdicts keep the+ // reservation-only rule they were recorded under, so every replica replays them identically.+ if (move.operation === 'verify' && move.engine >= REVIEW_GRANT_ENGINE) return;+ if (item?.item_review_by === actor && item.item_status === 'submitted' && item.item_review_until > now+ && move.operation === 'verify') return;const claims = board.db.prepare("SELECT item_id,item_lease_until FROM item WHERE item_owner=? AND item_status='claimed'").all(actor);const own = claims.find(claim => claim.item_id === item?.item_id);const live = claims.filter(claim => claim.item_lease_until > now);diff --git a/src/review-grant-engine.js b/src/review-grant-engine.jsnew file mode 100644index 00000000..b74006ed--- /dev/null+++ b/src/review-grant-engine.js@@ -0,0 +1,3 @@+/** From this engine a cross-lane verdict is review, not an item change; older verdicts replay as recorded [E21,V2,H16]. */+import { unassignedEngine } from './engine-next.js';+export const REVIEW_GRANT_ENGINE = unassignedEngine();diff --git a/test/review-grant-replay.test.js b/test/review-grant-replay.test.jsnew file mode 100644index 00000000..2c98690d--- /dev/null+++ b/test/review-grant-replay.test.js@@ -0,0 +1,61 @@+/** @pullboard-test-loads src/board.js src/engine.js src/exchange.js src/agent-grant.js */+/** A cross-lane verdict is review from its engine on, and older verdicts replay as they were recorded [E21,V2,H16]. */+import assert from 'node:assert/strict';+import { test } from 'node:test';+import * as store from '../src/board.js';+import { exportBoard, importBoard } from '../src/exchange.js';+import { applyEngineMove, prepareEngineMove } from '../src/engine.js';+import { REVIEW_GRANT_ENGINE } from '../src/review-grant-engine.js';+import { submitFixture } from './board-submit-fixture.js';++const BASE = 'a'.repeat(40);+const COMMIT = 'b'.repeat(40);+const TREE = 'c'.repeat(40);+const DIGEST = 'd'.repeat(64);+const AT = '2026-10-26T08:00:00.000Z';++/** Build a submitted web item whose builder holds a current-engine grant, with an api reviewer seat. */+function submitted(t) {+ const board = store.openBoard(':memory:', { now: () => new Date(AT) });+ t.after(() => store.closeBoard(board));+ store.register(board, { lane: 'coordinator', path: '/fixture' });+ store.register(board, { lane: 'web', path: '/fixture/web-1' });+ store.register(board, { lane: 'api', path: '/fixture/api-1' });+ const id = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Cross-lane review fixture' });+ store.claim(board, id, { agentId: 'web-1', lane: 'web', leaseMs: 3_600_000, head: BASE,+ freeze: () => ({ text: JSON.stringify({ rows: [], policy: { version: 1, commit: BASE, verify: { policy: 'any', family: 'off' } } }), digest: DIGEST }) });+ submitFixture(board, id, { agentId: 'web-1', commit: COMMIT, tree: TREE, files: ['web/feature.js'], policyCommit: BASE });+ return { board, id };+}++/** Open an independent replica of the seed through the public exchange format. */+function replica(t, seed) {+ const board = store.openBoard(':memory:', { now: () => new Date(AT) });+ t.after(() => store.closeBoard(board));+ importBoard(board, exportBoard(seed));+ return board;+}++/** An api-lane reviewer's acceptance that holds no review reservation, recorded at a given engine. */+function verdictAt(seed, id, engine) {+ const verdict = { agentId: 'api-1', decision: 'ACCEPT', note: 'Reviewed from another lane without a reservation.',+ head: COMMIT, digest: DIGEST, policy: 'any', familyPolicy: 'off', check: 'green' };+ return { ...prepareEngineMove(seed, 'verify', [id, verdict], { id: `cross-lane-verdict-${engine}` }), engine };+}++test('an unreserved cross-lane verdict is review from its engine on, and older ones replay refused [E21,V2,H16]', (t) => {+ const { board: seed, id } = submitted(t);+ const order = { sequence: 1, at: AT };++ const older = verdictAt(seed, id, REVIEW_GRANT_ENGINE - 1);+ const historical = [replica(t, seed), replica(t, seed)].map(board => applyEngineMove(board, older, order));+ assert.equal(historical[0].error?.code, 'AGENT_GRANT_LANE', 'a verdict recorded before this engine keeps its recorded refusal');+ assert.deepEqual(historical[1], historical[0], 'every fresh replica replays the older verdict identically');++ const current = verdictAt(seed, id, REVIEW_GRANT_ENGINE);+ const replicas = [replica(t, seed), replica(t, seed)];+ const outcomes = replicas.map(board => applyEngineMove(board, current, order));+ assert.equal(outcomes[0].error, undefined, 'from this engine on, a cross-lane verdict is review: ' + JSON.stringify(outcomes[0].error));+ assert.deepEqual(outcomes[1], outcomes[0]);+ for (const board of replicas) assert.equal(store.getItem(board, id).item_status, 'verified');+});