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
chore(merge): integrate main for checked verdicts [E8,H16]
Corey Olson3bffd617eaa9
diff --cc docs/api.mdindex 5f11bf9a,822eacaf..3ea0c754--- a/docs/api.md+++ b/docs/api.md@@@ -20,14 -22,10 +22,16 @@@ When `add` or `edit` supplies a new nonAn item's HTTP detail, and each item in the full board state, include `check` and, when recorded, `checkBaseline` with the same observation fields. A green result carries `warning: "CRITERION_PROVES_NOTHING"`; text output names that warning when showing or reserving the item for review, and when filing it with `--wait`. An exact match with the project gate configured at that main commit records green with `reason: "repo gate"` without running it again. A missing main records unavailable with `reason: "no main"` and still files the item. Changing the check replaces this observation; clearing it removes the observation. Captured observations and completions travel through ordered board moves, so replicas store results without executing commands. A completed result awaiting relay delivery stays on the measuring device and is retried by the next normal CLI command.+An accepted item that has not landed can carry `item_verdict_state` in CLI `show`, `list`, and `resume` JSON. Its `code` is `STALE_VERDICT`; `file` and `commit` identify the first known main change to one of the submitted candidate's files, and `reviewedTrunk` and `main` identify the compared tips. HTTP board states, summaries, and item details expose the same observation as optional `verdictState`. Moving main invalidates both cached state and live change notifications even when the served worktree's HEAD stays fixed. Unrelated files leave acceptance current; reverting a relevant main change still requires re-review. Missing reviewed history also fails closed, with a `reason` and null file/commit instead of an invented change.++Freshness never rewrites the stored ACCEPT or its verdict row. New accept/reject event details carry `review: {commit, trunk, paths}`: the original submitted commit, the known reviewed trunk, and sorted unique submitted paths. Existing receipts replay with their recorded engine and remain unchanged. Older acceptances without captured review metadata use a conservative claim-base bound and may require a new review after upgrading. Recorded or physically landed work no longer needs this freshness check.++For a stale acceptance, merge current main into the submitted work and commit a clean review HEAD. Another agent runs `pullboard verify <id> accept --note "what was re-reviewed"`; its frozen check runs at that combined HEAD, and a new verdict appends to the history while retaining the original submitted commit. A main move during the check refuses `VERDICT_TRUNK_MOVED` and requires another review. `resume` keeps stale acceptances out of its merge list. `land` excludes stale items (and reports their file and commit); when none remain ready, it refuses `STALE_VERDICT`. Nothing in this observation changes the approved criterion or grants person authority.+`pullboard stats [--since <date>] --json` returns `{version: 1, stats: {...}}` from the append-only event log. `submissions` and `rejections` count moves, including repeated attempts; `rejectionShare` is rejections divided by submissions (zero when the window has no submissions). `merged` counts distinct items with a merge move; `mergedWithoutAccept` counts those whose merge lacks an earlier acceptance of the latest submitted commit. That audit uses earlier history even when the acceptance falls before the selected window. Current item and verdict rows do not replace event evidence.+ `stats.bars` counts bar corrections, keyed by agent: `{corrections, barRejects, buildRejects}`. A correction is an `edit --criterion` or `--check` on an item that was ever claimed. It must carry `--reason "what the old bar got wrong"` (HTTP `args.reason`); without one it is refused with `BAR_REASON`. A correction that follows the item's newest, unexplained reject marks that reject as caused by the bar, counted to the correcting agent; every other reject counts to the build, under the agent who added the item. Text `stats` prints one `bars:` line per agent, and text `show` prints each correction with its reason.+`stats.flow` adds the flow through the board:- `asOf` is the ISO UTC timestamp of this observation, shared by every queue age.@@@ -367,13 -369,3 +375,13 @@@ Runner storage keeps one repository objEach checkout with a committed npm lockfile runs `npm ci`, including lifecycle scripts. Only npm's content cache is shared; installed dependencies and generated files stay in the fresh checkout. Other lock managers are refused. Combined command output and transport diagnostics are bounded at 64 MiB; exceeding that limit refuses the run.Post-run cleanup reports `RUNNER_CLEANUP_TIMEOUT` after 30 seconds instead of leaving the controller waiting indefinitely. That failure does not retry the command. The physical runner slot is released after its known children have drained and no unresolved live process remains; an unresolved live process keeps the slot occupied until cleanup can be verified.+- New acceptances seal the exact checked commit in `review.head`. A stale re-review lands that checked composition while retaining the original submitted commit as the item identity; landing snapshots record `reviewedCommit` when it differs. Adoption and publishing refuse if that proof changes. Historical released-engine receipts retain their original replay meaning. The checked commit is pinned at `refs/pullboard/items/<id>/<first-12-sha>`; another replica must fetch that ref's Git objects before the sealed re-review can clear its stale state. Missing objects fail closed. The checked-head meaning uses the next free release engine number, currently 15 on this candidate under the coordinator's release reservation.++New acceptances seal the exact checked commit in `review.head`. A stale re-review lands that checked composition while retaining the original submitted commit as the item identity; landing snapshots record `reviewedCommit` when it differs. Adoption and publishing refuse if that proof changes. Historical released-engine receipts retain their original replay meaning. The checked commit is pinned at `refs/pullboard/items/<id>/<first-12-sha>`; another replica must fetch that ref's Git objects before the sealed re-review can clear its stale state. Missing objects fail closed. The checked-head meaning starts at engine 20 on this composition. Before landing, merge the current trunk and take its next engine number; no number is reserved and earlier records retain their original meaning.++A re-review seals the union of the original item paths and paths changed by the checked repair against its reviewed trunk. Files added by a repair therefore participate in later stale-verdict detection.++Device-sealed presentations carry the same derived `verdictState`, including Git-only trunk movement and re-review, without changing native tables. Browser snapshot decoding preserves it. Repeated unchanged sealed snapshots reuse derived values and start no Git process after warm-up; staged supplied boards bypass that cache.++Cold freshness reads query first-parent history limited to the item’s literal paths, then inspect matching commits. Unrelated main revisions do not each start a file-diff process; merge and revert changes still count.++Unavailable Git-object verdict projections are retried on the next read, so fetching the sealed reviewed commit clears that uncertainty without a board event or trunk move. Known freshness projections remain cached.diff --cc docs/formats.mdindex 3e89d79d,56cc62a3..1ec703af--- a/docs/formats.md+++ b/docs/formats.md@@@ -102,7 -102,7 +102,7 @@@ The board file is in the repository's G| `row grammar` | `1` | `SPEC_GRAMMAR_VERSION` in `src/spec.js`; optional `<!-- pullboard-grammar N -->` line in either file (absence means the current grammar) | Both files share the version. A declared version must match; an incompatible grammar change requires a coordinated version bump and compatible files. No automatic conversion occurs. || `board schema` | `2` | `SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version` | Create missing tables and indexes, add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. || `event log` | `1` | `EVENT_LOG_VERSION` in `src/board.js`, persisted in `board_meta` as `event_log_version` | Older event-log versions upgrade in place; newer versions are refused with `EVENT_LOG_VERSION`. Preserve event rows when the board schema changes. |- | `move engine` | `15` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |-| `move engine` | `19` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |++| `move engine` | `20` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |<!-- format-versions:end -->Pullboard 0.6.1 released engine 1. Engine 2 records a fresh explicit-build claim's skipped-review snapshot. Pullboard 0.8.1 released engine 3, including lane-sensitive graft refusals and authenticated relay senders. Engine 4 adds captured background-baseline completions through `completeCheckBaseline`; released engine-3 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Engine 5 requires a one-line reason when releasing a review and gives that reviewer a one-hour cooldown for the current submission. Each sealed move replays under its recorded engine version: engines 1 through 4 retain the original release event and review-reservation behavior. Engine 5 retains support for older moves, including engine-4 baseline completions. Pullboard 0.8.3 released engine 6, adding board-scoped machine credentials and permitting machine execution only for one exact, earlier authenticated phone request, including its payload digest. Engine 7 adds ordered item holds through `holdItem` and `releaseItemHold`; engine-6 clients stop with `ENGINE_VERSION` before interpreting either operation or advancing their replay cursor. Engine 8, shared by the 0.8.5 move changes, retains merged-item exception notes, selects the next review in roadmap order, and adds coordinator-only `reopen` for a submission returned without a verdict; engine-7 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Recorded engines 1 through 7 retain their original tier-first review selection. Engine 8 also adds durable refusal recovery for blocked relay positions; each explicit skip publishes the readable prefix even when another unsupported record follows. Engine 8 also permits coordinator criterion/check edits on a live claim as pending corrections; the holder cannot renew or submit until a refreeze adopts the correction while preserving the claim. Older request receipts retain their recorded engine semantics. Upgrade every linked device before using the new moves. Each release shares one engine bump across its changed moves. Engine 8 also retains declared model labels on registration and records each registered agent move's model snapshot; engines 1 through 7 retain their original registration and event details without these model fields. Pullboard 0.8.8 released engine 9, which allows resubmitting the same rejected commit after a corrected criterion is refrozen, but only when the rejection names a different frozen digest. Engine 8 retains its HEAD_NOT_NEW refusal and prior submit-event detail. Engine-9 submit events add `criterionDigest`, and engine-8 boards replay with the original refusal and event history.@@@ -113,7 -113,7 +113,9 @@@ Engine 11 permits resubmitting the samEngine 12 records declined person row decisions without replacing the exact source text: the row becomes `wont` and the reason stays in the decision record. Engine-11 decline receipts retain their original reason-as-row-text validation and replay outcome. Engine-11 clients refuse engine-12 moves before interpreting them; upgrade linked clients before recording new decline decisions.- Engine 15 binds a review to the immutable submitted commit, the exact checked composition, its reviewed trunk and sorted candidate paths. A stale, unmerged acceptance can be re-reviewed without rewriting the submission; landing uses its accepted checked composition. New review metadata and landing batches carrying `reviewedCommit` require engine 15, including later updates to those batches. Previously recorded outcomes replay before this state-dependent version check, and previously released engines retain their original review and landing behavior. Older clients refuse engine-15 moves before changing their board or replay cursor; upgrade linked clients before using checked-composition reviews. This number is the allocated unreleased engine and must follow the next available engine at landing.-Engine 19 makes a corrected bar record why the old one was wrong. Once an item has ever been claimed, an `editItem` that changes its criterion or check must carry `reason`, the text of what the old bar got wrong; without one it is refused with `BAR_REASON`, naming `--reason`. The edit event then records `reason` and `barCorrection: {fields, reject}`: `fields` lists `criterion` and/or `check`, and `reject` is `{verdict, by, reason, at}` when the item's newest verdict is a reject no earlier correction already explained, or `null`. That reject is counted as caused by the bar. The board derives `barCorrection` from its own rows; a move supplies only `reason`. An edit before any claim needs no reason and records one only if given. `pullboard stats` JSON adds `bars`, keyed by agent: `{corrections, barRejects, buildRejects}`. Corrections and the rejects they explain count to the agent who corrected the bar; any other reject counts as the build's, to the agent who added the item. An `editItem` move carrying `reason` requires engine 19, and older engines refuse it with `RELAY_MOVE` before changing their board or cursor. Moves recorded under engines 18 and earlier replay without the reason rule. Engine numbers 13 to 18 are allocated to other changes; whichever lands later renumbers, keeping every earlier engine's replay unchanged.++Engine 19 makes a corrected bar record why the old one was wrong. Once an item has ever been claimed, an `editItem` that changes its criterion or check must carry `reason`, the text of what the old bar got wrong; without one it is refused with `BAR_REASON`, naming `--reason`. The edit event then records `reason` and `barCorrection: {fields, reject}`: `fields` lists `criterion` and/or `check`, and `reject` is `{verdict, by, reason, at}` when the item's newest verdict is a reject no earlier correction already explained, or `null`. That reject is counted as caused by the bar. The board derives `barCorrection` from its own rows; a move supplies only `reason`. An edit before any claim needs no reason and records one only if given. `pullboard stats` JSON adds `bars`, keyed by agent: `{corrections, barRejects, buildRejects}`. Corrections and the rejects they explain count to the agent who corrected the bar; any other reject counts as the build's, to the agent who added the item. An `editItem` move carrying `reason` requires engine 19, and older engines refuse it with `RELAY_MOVE` before changing their board or cursor. Moves recorded under engines 18 and earlier replay without the reason rule. Trunk skipped engine numbers 13 through 18. A later engine change takes the current trunk's next number, keeping every earlier recorded engine's replay unchanged.++++Engine 20 binds a review to the immutable submitted commit, the exact checked composition, its reviewed trunk and sorted candidate paths. A stale, unmerged acceptance can be re-reviewed without rewriting the submission; landing uses its accepted checked composition. New review metadata and landing batches carrying `reviewedCommit` require engine 20, including later updates to those batches. Previously recorded outcomes replay before this state-dependent version check, and previously released engines retain their original review and landing behavior. Older clients refuse engine-20 moves before changing their board or replay cursor; upgrade linked clients before using checked-composition reviews. Before landing, merge the current trunk and take its next engine number; no number is reserved.The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.A linked board requires at least engine 3 after issuing any agent token, includingdiff --cc src/board.jsindex 821fc9dc,090581bb..c0fc39d1--- a/src/board.js+++ b/src/board.js@@@ -15,8 -13,9 +15,9 @@@ import { DatabaseSync } from 'node:sqliimport { boardNotWritable } from './board-access.js';import { briefFiles, briefSections } from './brief.js';import { COORDINATOR } from './config.js';-import { ENGINE_VERSION, GUARDS, IN_STATE, MOVES, STATES, UNKNOWN_MOVE, effectiveGuards, storeTriggers } from './machine.js';+import { ENGINE_VERSION, VERDICT_REVIEW_ENGINE, GUARDS, IN_STATE, MOVES, STATES, UNKNOWN_MOVE, effectiveGuards, storeTriggers } from './machine.js';import { Refused } from './refused.js';+ import { barCorrectionFields } from './bar-corrections.js';import { parseSpec } from './spec.js';export const ACCEPT_REASON = 'CRITERION_MET';diff --cc src/engine.jsindex 48e19787,8f1c9ca0..95228b39--- a/src/engine.js+++ b/src/engine.js@@@ -2,7 -2,8 +2,8 @@@import { createHash, randomUUID } from 'node:crypto';import * as store from './board.js';import { recordedRefusal } from './recorded-refusal.js';+ import { BAR_ENGINE, carriesBarReason } from './bar-corrections.js';-import { ENGINE_VERSION } from './machine.js';+import { ENGINE_VERSION, VERDICT_REVIEW_ENGINE } from './machine.js';import { Refused } from './refused.js';import { requestMoveProblem, recordRequestMove } from './relay-requests.js';import { relayMoveActor, relaySenderProblem, validRelaySender } from './relay-sender.js';@@@ -22,17 -23,10 +23,18 @@@ export const ENGINE_OPERATIONS = Object/** Engine version at which each ordered operation first has stable replay semantics. */const OPERATION_ENGINE = Object.freeze({ reopen: 8, recordLandingBatch: 8, recordLandingWaiver: 8, recordLandingFlake: 8, finishLandingBatch: 8 });- /** Dependency edits and sealed review metadata need their own engine meanings; historical envelopes retain theirs. */-/** Dependency edits add engine-10 meaning, and edit reasons engine-19 meaning, without changing ordinary historical edit envelopes. */-function minimumOperationEngine(operation, args) {++/** Dependency edits, bar reasons and sealed review metadata retain their distinct recorded engine meanings. */+function minimumOperationEngine(operation, args, board) {const options = args[1];+ if (board && ['recordLandingBatch', 'finishLandingBatch'].includes(operation)) {+ const id = operation === 'recordLandingBatch' ? args[0]?.batch?.id : args[0]?.id;+ const prior = id && store.landingBatches(board).find(batch => batch.id === id);+ if (prior && ['items', 'candidates'].some(key => Array.isArray(prior[key]) && prior[key].some(entry => entry && Object.hasOwn(entry, 'reviewedCommit')))) return VERDICT_REVIEW_ENGINE;+ }+ if (operation === 'verify' && options && Object.hasOwn(options, 'review')) return VERDICT_REVIEW_ENGINE;+ if (operation === 'recordLandingBatch' && args[0]?.batch+ && ['items', 'candidates'].some(key => Array.isArray(args[0].batch[key]) && args[0].batch[key].some(entry => entry && typeof entry === 'object' && Object.hasOwn(entry, 'reviewedCommit')))) return VERDICT_REVIEW_ENGINE;+ if (carriesBarReason(operation, args)) return BAR_ENGINE;return operation === 'editItem' && options && Object.hasOwn(options, 'after') && options.after !== undefined? 10 : OPERATION_ENGINE[operation] ?? 1;}diff --cc src/machine.jsindex 21e84bd1,bbd1cfb9..05c1a0c3--- a/src/machine.js+++ b/src/machine.js@@@ -10,11 -10,7 +10,11 @@@*//** Executable move semantics, carried by every sealed move and retained during replay [H16]. */- export const ENGINE_VERSION = 15;-export const ENGINE_VERSION = 19;++export const ENGINE_VERSION = 20;++/** First released engine binding the checked composition, review trunk and paths [E8,H16]. */- export const VERDICT_REVIEW_ENGINE = 15;++export const VERDICT_REVIEW_ENGINE = 20;+/** @typedef {'agent' | 'coordinator' | 'clock'} Role */diff --cc test/agent-model-engine.test.jsindex a37c0d00,ba92a56d..15cfc238--- a/test/agent-model-engine.test.js+++ b/test/agent-model-engine.test.js@@@ -10,9 -10,9 +10,9 @@@ import { mkdtempSync, rmSync, writeFileimport { tmpdir } from 'node:os';import { join } from 'node:path';- test('model declarations and event snapshots retain engines 1 through 12 semantics [O8,O3,H16]', (t) => {- assert.ok(ENGINE_VERSION > 12, 'the new writer preserves released model behavior through engine 12');- for (const version of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ENGINE_VERSION]) {-test('model declarations and event snapshots retain engines 1 through 11 semantics [O8,O3,H16]', (t) => {- assert.equal(ENGINE_VERSION, 19, 'engine 19 preserves the released engine-8 through engine-11 model behavior');- for (const version of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ENGINE_VERSION]) {++test('model declarations and event snapshots retain engines 1 through 19 semantics [O8,O3,H16]', (t) => {++ assert.equal(ENGINE_VERSION, 20, 'the next writer preserves every historical model snapshot through main engine 19');++ for (const version of Array.from({ length: ENGINE_VERSION }, (_, index) => index + 1)) {const board = store.openBoard(':memory:');t.after(() => store.closeBoard(board));const registration = prepareEngineMove(board, 'register', [{ lane: 'web', path: '/web', model: 'First Model' }]);diff --cc test/pending-refreeze.test.jsindex 99dc9c84,7191bfc2..569e28c3--- a/test/pending-refreeze.test.js+++ b/test/pending-refreeze.test.js@@@ -261,7 -261,7 +261,7 @@@ async function checkDependencyLegacyCli}test('dependency edits replay the same on every engine [B3,V2,H16]', async (t) => {- assert.ok(ENGINE_VERSION > 12);- assert.equal(ENGINE_VERSION, 19);++ assert.equal(ENGINE_VERSION, 20, 'the next writer retains all recorded dependency-edit behavior');const directory = mkdtempSync(join(tmpdir(), 'pullboard-dependency-engines-'));const cleanup = [];t.after(() => {diff --cc test/team-engine.test.jsindex 4e497cd6,00000000..d0b41e4fmode 100644,000000..100644--- a/test/team-engine.test.js+++ b/test/team-engine.test.js@@@ -1,186 -1,0 +1,186 @@@+/** Sealed re-reviews bind the original work without changing released receipts [E8,H16,V8]. */+import assert from 'node:assert/strict';+import { mkdtempSync, mkdirSync, rmSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { pathToFileURL } from 'node:url';+import { test } from 'node:test';+import * as store from '../src/board.js';+import { exportBoard, importBoard } from '../src/exchange.js';+import { applyEngineMove, appliedSequence, engineReceipt, prepareEngineMove } from '../src/engine.js';+import { VERDICT_REVIEW_ENGINE } from '../src/machine.js';+import { unpackRelease } from './release-archive.js';++const BASE = 'a'.repeat(40);+const COMMIT = 'b'.repeat(40);+const TRUNK = 'c'.repeat(40);+const DIGEST = 'd'.repeat(64);+const AT = '2026-10-16T00:00:00.000Z';++/** Build a submitted, registered board entirely through public engine/store operations. */+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: 'web', path: '/fixture/web-2' });+ const id = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Sealed 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 }) });+ store.submit(board, id, { agentId: 'web-1', commit: COMMIT, tree: TRUNK, files: ['web/feature.js'], policyCommit: BASE });+ return board;+}++/** Produce one independent replica through the public board exchange format. */+function replica(t, seed) {+ const board = store.openBoard(':memory:');+ t.after(() => store.closeBoard(board));+ importBoard(board, exportBoard(seed));+ return board;+}++/** The normal verifier's typed arguments, with optional new review metadata. */+function verdict(review) {+ return { agentId: 'web-2', decision: 'ACCEPT', note: 'The verifier checked the original work with the known trunk.',+ head: COMMIT, digest: DIGEST, policy: 'any', familyPolicy: 'off', check: 'green',+ ...(review === undefined ? {} : { review }) };+}++/** A writer-version marker is intentionally newer; all historical semantic rows must still match. */+function withoutWriterMarker(document) {+ const copy = structuredClone(document);+ copy.tables.board_meta = copy.tables.board_meta.filter(row => row.meta_key !== 'relay_engine_version');+ return copy;+}++test('engine 12 acceptance receipts stay exact and sealed re-review needs a newer engine [E8,H16,V8]', async t => {+ const directory = mkdtempSync(join(tmpdir(), 'pullboard-review-engines-'));+ const archived = join(directory, 'engine12');+ mkdirSync(archived);+ unpackRelease('59a6e2b286ee852add0d68a659f1a1e6b3257c44', archived);+ const oldStore = await import(pathToFileURL(join(archived, 'src/board.js')).href);+ const oldEngine = await import(pathToFileURL(join(archived, 'src/engine.js')).href);+ const oldExchange = await import(pathToFileURL(join(archived, 'src/exchange.js')).href);+ const oldMachine = await import(pathToFileURL(join(archived, 'src/machine.js')).href);+ assert.equal(oldMachine.ENGINE_VERSION, 12, 'this is the actual released executable, not a retagged new engine');+ const seed = submitted(t);+ const one = replica(t, seed);+ const two = replica(t, seed);+ const old = oldStore.openBoard(join(directory, 'old.sqlite'));+ t.after(() => { oldStore.closeBoard(old); rmSync(directory, { recursive: true, force: true }); });+ oldExchange.importBoard(old, exportBoard(seed));+ const accept = oldEngine.prepareEngineMove(old, 'verify', [1, verdict()], { id: 'old-engine12-accept' });+ const repeated = oldEngine.prepareEngineMove(old, 'verify', [1, verdict()], { id: 'old-engine12-repeated-accept' });+ for (const [index, move] of [accept, repeated].entries()) {+ const order = { sequence: index + 1, at: `2026-10-16T00:00:0${index + 1}.000Z` };+ const original = oldEngine.applyEngineMove(old, move, order);+ assert.equal(original.error?.code, index === 0 ? undefined : 'NOT_SUBMITTED');+ for (const board of [one, two]) {+ assert.deepEqual(applyEngineMove(board, move, order), original);+ assert.deepEqual(engineReceipt(board, move.id), oldEngine.engineReceipt(old, move.id));+ assert.deepEqual(withoutWriterMarker(exportBoard(board)), withoutWriterMarker(oldExchange.exportBoard(old)));+ }+ }+ const originalVerdicts = store.verdictsFor(one, 1);+ const reReview = { ...prepareEngineMove(one, 'verify', [1, verdict({ commit: COMMIT, head: COMMIT, trunk: TRUNK, paths: ['web/feature.js'] })], { id: 'sealed-new-review' }), engine: VERDICT_REVIEW_ENGINE };- assert.equal(reReview.engine, 15, 'the feature replays at its introduction version even after a later writer upgrade');++ assert.equal(reReview.engine, 20, 'the feature replays at its introduction version even after a later writer upgrade');+ const oldBefore = oldExchange.exportBoard(old);+ assert.throws(() => oldEngine.applyEngineMove(old, reReview, { sequence: 3, at: AT }), { code: 'ENGINE_VERSION' });+ assert.deepEqual(oldExchange.exportBoard(old), oldBefore, 'an actual old client refuses the future envelope before changing its prefix');+ const before = exportBoard(one);+ assert.throws(() => applyEngineMove(one, { ...reReview, engine: 12 }, { sequence: 3, at: AT }), { code: 'RELAY_MOVE' });+ assert.deepEqual(exportBoard(one), before, 'new metadata cannot acquire old-engine meaning by changing the tag');+ const order = { sequence: 3, at: '2026-10-16T00:00:03.000Z' };+ assert.deepEqual(applyEngineMove(one, reReview, order), applyEngineMove(two, reReview, order));+ assert.equal(appliedSequence(one), 3);+ assert.equal(store.verdictsFor(one, 1).length, 2);+ assert.deepEqual(store.verdictsFor(one, 1).slice(0, 1), originalVerdicts, 'the old proof remains byte-for-byte unchanged');+ assert.deepEqual(exportBoard(one), exportBoard(two));+});++test('malformed sealed reviews cannot append proof or bind a different submission [E8,H16,V8]', t => {+ const one = submitted(t);+ const two = replica(t, one);+ const valid = { commit: COMMIT, head: COMMIT, trunk: TRUNK, paths: ['web/feature.js'] };+ const invalid = [{ commit: COMMIT, trunk: TRUNK, paths: ['web/feature.js'] }, { ...valid, head: 'not-a-commit' }, null, { ...valid, commit: BASE }, { ...valid, trunk: 'not-a-commit' },+ { ...valid, paths: 'web/feature.js' }, { ...valid, paths: ['web/feature.js', 'web/feature.js'] },+ { ...valid, paths: ['web/z.js', 'web/a.js'] }, { ...valid, paths: ['/web/feature.js'] },+ { ...valid, paths: ['web/../feature.js'] }, { ...valid, paths: ['web//feature.js'] },+ { ...valid, unexpected: true }];+ for (const [index, review] of invalid.entries()) {+ const move = prepareEngineMove(one, 'verify', [1, verdict(review)], { id: `invalid-review-${index}` });+ const order = { sequence: index + 1, at: AT };+ const first = applyEngineMove(one, move, order);+ assert.equal(first.error?.code, 'BAD_VERDICT_REVIEW', JSON.stringify(first));+ assert.deepEqual(first, applyEngineMove(two, move, order));+ assert.deepEqual(store.verdictsFor(one, 1), []);+ assert.equal(store.getItem(one, 1).item_status, 'submitted');+ assert.deepEqual(exportBoard(one), exportBoard(two));+ }+});+++test('a landing snapshot binds the checked composition through replay and final receipts [E8,H16,R3]', t => {+ const one = submitted(t);+ const two = replica(t, one);+ const reviewed = { commit: COMMIT, head: TRUNK, trunk: BASE, paths: ['web/feature.js'] };+ /** Capture the same acceptance timestamp in both replicas through their ordered public engine. */+ const acceptAt = (head, sequence) => {+ const move = prepareEngineMove(one, 'verify', [1, { ...verdict({ ...reviewed, head }), head }], { id: `checked-review-${sequence}` });+ const first = applyEngineMove(one, move, { sequence, at: AT });+ assert.equal(first.error, undefined, JSON.stringify(first));+ assert.deepEqual(first, applyEngineMove(two, move, { sequence, at: AT }));+ };+ acceptAt(TRUNK, 1);+ const entry = { id: 1, commit: COMMIT, reviewedCommit: TRUNK, merge: TRUNK };+ const batch = { version: 1, id: 'reviewed-landing', state: 'pushed', base: BASE, tip: TRUNK,+ branch: 'refs/heads/main', root: '/fixture/landing', owner: 'fixture', logPath: '/fixture/landing.log',+ candidates: [entry], items: [entry], revision: 0 };+ const record = prepareEngineMove(one, 'recordLandingBatch', [{ agentId: 'coordinator', batch }], { id: 'checked-landing-snapshot' });+ assert.equal(record.engine, VERDICT_REVIEW_ENGINE);+ const before = exportBoard(one);+ assert.throws(() => applyEngineMove(one, { ...record, engine: 12 }, { sequence: 2, at: AT }), { code: 'RELAY_MOVE' });+ assert.deepEqual(exportBoard(one), before, 'a downgraded checked-head snapshot cannot mutate the prefix');+ assert.deepEqual(applyEngineMove(one, record, { sequence: 2, at: AT }), applyEngineMove(two, record, { sequence: 2, at: AT }));+ acceptAt(COMMIT, 3);+ const finish = prepareEngineMove(one, 'finishLandingBatch', [{ agentId: 'coordinator', id: batch.id, tip: TRUNK }], { id: 'stale-checked-landing' });+ const beforeFinish = exportBoard(one);+ assert.throws(() => applyEngineMove(one, { ...finish, engine: 12 }, { sequence: 4, at: AT }), { code: 'RELAY_MOVE' });+ assert.deepEqual(exportBoard(one), beforeFinish, 'a legacy-tagged finish cannot bypass the checked snapshot binding');+ const refused = applyEngineMove(one, finish, { sequence: 4, at: AT });+ assert.equal(refused.error?.code, 'LAND_ITEM_MOVED', 'a later re-review cannot inherit a prior checked tree gate');+ assert.deepEqual(refused, applyEngineMove(two, finish, { sequence: 4, at: AT }));+ assert.equal(store.getItem(one, 1).item_merged_commit, null);+ assert.equal(store.landingBatches(one)[0].state, 'pushed', 'a refused receipt leaves the exact prior snapshot intact');+ acceptAt(TRUNK, 5);+ const restored = { ...finish, id: 'matching-checked-landing' };+ const landed = applyEngineMove(one, restored, { sequence: 6, at: AT });+ assert.equal(landed.error, undefined, JSON.stringify(landed));+ assert.deepEqual(landed, applyEngineMove(two, restored, { sequence: 6, at: AT }));+ assert.equal(store.getItem(one, 1).item_commit, COMMIT);+ assert.equal(store.getItem(one, 1).item_merged_commit, TRUNK);+ assert.equal(store.landingBatches(one)[0].items[0].reviewedCommit, TRUNK);+ assert.deepEqual(exportBoard(one), exportBoard(two));+});++test('an older landing refusal remains exact after its snapshot acquires checked-head binding [E8,H16,R3]', t => {+ const board = submitted(t);+ store.verify(board, 1, verdict({ commit: COMMIT, head: COMMIT, trunk: BASE, paths: ['web/feature.js'] }));+ const batch = { version: 1, id: 'upgraded-snapshot', state: 'gating', base: BASE, tip: COMMIT,+ branch: 'refs/heads/main', root: '/fixture/landing', owner: 'fixture', logPath: '/fixture/landing.log',+ candidates: [{ id: 1, commit: COMMIT }], items: [{ id: 1, commit: COMMIT }], revision: 0 };+ const legacy = { ...prepareEngineMove(board, 'recordLandingBatch', [{ agentId: 'coordinator', batch }], { id: 'legacy-snapshot' }), engine: 12 };+ assert.equal(applyEngineMove(board, legacy, { sequence: 1, at: AT }).error, undefined);+ const finish = { ...prepareEngineMove(board, 'finishLandingBatch', [{ agentId: 'coordinator', id: batch.id, tip: COMMIT }], { id: 'legacy-not-pushed' }), engine: 12 };+ const original = applyEngineMove(board, finish, { sequence: 2, at: AT });+ assert.equal(original.error?.code, 'LAND_NOT_PUSHED');+ const saved = engineReceipt(board, finish.id);+ const checked = { ...batch, revision: 1, candidates: [{ id: 1, commit: COMMIT, reviewedCommit: TRUNK }], items: [{ id: 1, commit: COMMIT, reviewedCommit: TRUNK }] };+ const update = prepareEngineMove(board, 'recordLandingBatch', [{ agentId: 'coordinator', batch: checked, revision: 1 }], { id: 'checked-snapshot' });+ assert.equal(applyEngineMove(board, update, { sequence: 3, at: AT }).error, undefined);+ assert.deepEqual(applyEngineMove(board, finish, { sequence: 2, at: AT }), original);+ assert.deepEqual(engineReceipt(board, finish.id), saved, 'a new snapshot meaning cannot alter an existing refusal receipt');+ const before = exportBoard(board);+ assert.throws(() => applyEngineMove(board, { ...finish, id: 'new-legacy-attempt' }, { sequence: 4, at: AT }), { code: 'RELAY_MOVE' });+ assert.deepEqual(exportBoard(board), before);+});