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): preserve stamped guards during restore [M3,A5,A6]
Corey Olson31428c3434cb
diff --git a/src/board-migrate.js b/src/board-migrate.jsindex 55118fda..fb95b331 100644--- a/src/board-migrate.js+++ b/src/board-migrate.js@@ -68,8 +68,15 @@ export function schemaDigest(schema, eventLogVersion) {* @param {string} digest* @returns {number}*/-function schemaStamp(db, digest) {+function schemaStamp(db, digest, guards = null) {const shape = db.prepare("SELECT type, name, tbl_name, sql FROM sqlite_master WHERE name NOT LIKE 'sqlite_%' ORDER BY type, name").all();+ if (guards) {+ const replacements = new Map(guards.map(entry => [entry.name, entry.sql]));+ const installed = shape.filter(entry => entry.type === 'trigger' && entry.name.startsWith('machine_'));+ // Missing or extra guards remain manual drift; only an exact installed-name set can recover.+ if (installed.length !== replacements.size || installed.some(entry => !replacements.has(entry.name))) return null;+ for (const entry of installed) entry.sql = replacements.get(entry.name);+ }const meta = shape.some((entry) => entry.type === 'table' && entry.name === 'board_meta')? db.prepare("SELECT meta_key, meta_value FROM board_meta WHERE meta_key IN ('board_id', 'event_log_version') ORDER BY meta_key").all().map((entry) => (entry.meta_key === 'board_id' ? 'board_id' : entry.meta_value))@@ -135,3 +142,9 @@ export function schemaMissing(error) {export function writeRefused(error) {return (error?.errcode & 0xff) === 8;}++/** Verify a guard-only recovery against the existing complete-shape stamp, without writing a new one. */+export function guardsMatchStoredStamp(db, digest, guards) {+ const stored = db.prepare('PRAGMA application_id').get().application_id;+ return stored !== 0 && stored === schemaStamp(db, digest, guards);+}diff --git a/src/board-store-guards.js b/src/board-store-guards.jsindex a090aef5..f9f6d0cc 100644--- a/src/board-store-guards.js+++ b/src/board-store-guards.js@@ -2,9 +2,13 @@import { atomic } from './board-event-log.js';import { logEvent } from './board-event-log.js';import { boardStanding } from './board-migrate.js';+import { guardsMatchStoredStamp } from './board-migrate.js';+import { Refused } from './refused.js';import { recordSchemaStamp } from './board-migrate.js';import { SCHEMA_DIGEST } from './board-schema-source.js';import { SCHEMA_VERSION } from './board-schema-source.js';+import { EVENT_LOG_VERSION } from './board-schema-source.js';+import { SIGNED_EVENT_LOG_VERSION } from './board-schema-source.js';import { storeTriggers } from './machine.js';const GUARDED = 1;@@ -43,15 +47,50 @@ export function guardStore(board) {}/**- * Refresh only a main-owned board whose installed shape still has its valid stamp. A new declaration may- * differ without changing table versions; a hand-edited shape fails this check and remains untouched.+ * Main may upgrade a valid old declaration or restore the exact guards attested by the stored stamp.+ * A missing guard or any additional table/index drift remains untouched, never approved by restamping.*/export function refreshStoreDeclarations(board) {- if (isWhole(differences(board.db, storeTriggers()))) return;- atomic(board, () => {- // Recheck after taking the write lock, before approving any declaration or replacing its guard SQL.- if (boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION) !== 'current') return;+ const wanted = storeTriggers();+ if (isWhole(differences(board.db, wanted))) return false;+ return atomic(board, () => {+ const standing = boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION);+ const recovery = standing === 'drifted' && guardsMatchStoredStamp(board.db, SCHEMA_DIGEST, wanted);+ if (standing !== 'current' && !recovery) return false;guardStore(board);- recordSchemaStamp(board.db, SCHEMA_DIGEST);+ if (!recovery) recordSchemaStamp(board.db, SCHEMA_DIGEST);+ if (boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION) !== 'current') {+ throw new Refused('SCHEMA_DRIFT', 'the restored guards do not match the stored board stamp; keep the board and ask the coordinator to inspect its schema');+ }+ return true;});}++/**+ * Called inside the restore transaction: verify and preserve the installed guards, never this caller's+ * declaration. Another connection may have upgraded the board since this connection was opened.+ */+export function suspendStoreGuards(board) {+ if (boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION) !== 'current') {+ throw new Refused('SCHEMA_DRIFT', 'cannot restore an unverified board shape; run pullboard inbox from the main checkout, then retry; preserve any remaining drift for the coordinator');+ }+ const shapeQuery = "SELECT type,name,tbl_name,sql FROM sqlite_master WHERE name NOT LIKE 'sqlite_%' ORDER BY type,name";+ const shape = JSON.stringify(board.db.prepare(shapeQuery).all());+ const installed = board.db.prepare("SELECT name, sql FROM sqlite_master WHERE type='trigger' AND name LIKE 'machine_%' ORDER BY name").all();+ if (!isWhole(differences(board.db, storeTriggers()))) {+ const diagnostic = 'pullboard: preserving the installed trunk guards; this caller has a different declaration; update this CLI from main';+ if (board.onDiagnostic) board.onDiagnostic(diagnostic);+ else process.stderr.write(`${diagnostic}\n`);+ }+ for (const { name } of installed) board.db.exec(`DROP TRIGGER "${name.replaceAll('"', '""')}"`);+ return () => {+ for (const { sql } of installed) board.db.exec(sql);+ const version = board.db.prepare("SELECT meta_value FROM board_meta WHERE meta_key='event_log_version'").get()?.meta_value;+ if (JSON.stringify(board.db.prepare(shapeQuery).all()) !== shape+ || ![String(EVENT_LOG_VERSION), String(SIGNED_EVENT_LOG_VERSION)].includes(version)) {+ throw new Refused('SCHEMA_DRIFT', 'restore changed the verified board shape or format; its transaction was rolled back; preserve the board and ask the coordinator to inspect it');+ }+ // Validated restore may change the signed-event format. The complete persistent SQL is unchanged.+ recordSchemaStamp(board.db, SCHEMA_DIGEST);+ };+}diff --git a/src/board.js b/src/board.jsindex e2acdbc2..5369edfe 100644--- a/src/board.js+++ b/src/board.js@@ -414,11 +414,11 @@ export function openBoard(file, clock = systemClock, { isMain, onDiagnostic, wridb = new DatabaseSync(file);db.exec(`PRAGMA busy_timeout = ${BOARD_BUSY_TIMEOUT_MS}`);if (file !== ':memory:' && isMain !== false) configureBoardJournal(db, writeContext);- const board = { db, clock, writeContext, gitRoot };+ const board = { db, clock, writeContext, gitRoot, onDiagnostic };let warmCounters = true;if (isMain !== false || file === ':memory:') {// Migrate and audit only a board whose version is behind; a drifted shape is reported and left alone (#1047).- const standing = boardStanding(db, SCHEMA_DIGEST, SCHEMA_VERSION, readEventLogVersion(db) < EVENT_LOG_VERSION);+ let standing = boardStanding(db, SCHEMA_DIGEST, SCHEMA_VERSION, readEventLogVersion(db) < EVENT_LOG_VERSION);if (standing === 'behind' || standing === 'unstamped') atomic(board, () => {if (standing === 'behind') {migrateEventLogVersion(db);@@ -429,7 +429,7 @@ export function openBoard(file, clock = systemClock, { isMain, onDiagnostic, wri}recordSchemaStamp(db, SCHEMA_DIGEST);});- if (standing === 'current') refreshStoreDeclarations(board);+ if (refreshStoreDeclarations(board)) standing = boardStanding(db, SCHEMA_DIGEST, SCHEMA_VERSION);// Index-only upgrades keep the data version/digest unchanged. Install and restamp together;// drifted or read-only stores never take this path, and old clients accept the resulting stamp.if (standing !== 'drifted' && missingAdditiveIndexes(db)) atomic(board, () => {diff --git a/src/exchange.js b/src/exchange.jsindex 48864a79..7fda1bf2 100644--- a/src/exchange.js+++ b/src/exchange.js@@ -1,3 +1,4 @@+import { suspendStoreGuards } from './board-store-guards.js';import { AGENT_GRANT_ENGINE } from './agent-grant-engine.js';import { beginCommandPhase } from './command-phase.js';import { LANDING_LOCAL_PREFIX } from './landing-local-lease.js';@@ -15,10 +16,7 @@ import {*/import { createHash } from 'node:crypto';import { Refused } from './refused.js';-import {- ENGINE_VERSION,- storeTriggers,-} from './machine.js';+import { ENGINE_VERSION } from './machine.js';import {EVENT_LOG_VERSION,SIGNED_EVENT_LOG_VERSION,@@ -270,9 +268,8 @@ function restoreDocument(board, document, replace = false, expectedNativeDigestthrow new Refused('IMPORT_NOT_EMPTY', `board tables already have rows (${occupied.join(', ')}); import into a repo with an empty board`);}// Signed person moves survive a restore: this board keeps its own relay key pin and its signing state [E22].+ const restoreGuards = suspendStoreGuards(board);const signing = guardRestore(db, document);- const triggers = db.prepare("SELECT name FROM sqlite_master WHERE type = 'trigger' AND name LIKE 'machine_%'").all();- for (const { name } of triggers) db.exec(`DROP TRIGGER ${identifier(name)}`);if (replace) {for (const table of [...names].reverse()) db.exec(`DELETE FROM ${identifier(table)}`);} else if (initCoordinator) {@@ -304,7 +301,7 @@ function restoreDocument(board, document, replace = false, expectedNativeDigestconst restoreLocal = db.prepare('INSERT OR REPLACE INTO board_meta(meta_key,meta_value) VALUES (?,?)');for (const row of localLanding) restoreLocal.run(row.meta_key, row.meta_value);rebuildProofCounters(board);- for (const { name, sql } of storeTriggers()) db.exec(sql);+ restoreGuards();db.exec('COMMIT');released = true;outcome = 'committed';diff --git a/src/person-signing.js b/src/person-signing.jsindex 25706f15..9993eca2 100644--- a/src/person-signing.js+++ b/src/person-signing.js@@ -27,6 +27,11 @@ import {rememberAttested,} from './person-attested.js';+import { boardStanding } from './board-migrate.js';+import { recordSchemaStamp } from './board-migrate.js';+import { SCHEMA_DIGEST } from './board-schema-source.js';+import { SCHEMA_VERSION } from './board-schema-source.js';+const PROPOSALS = 'person_proposals';const AUTHORITY = 'person_authority_local';const PROPOSAL_MS = 10 * 60_000;@@ -91,9 +96,11 @@ export function pinAuthority(board, origin, authority) {if (existing.origin === origin && existing.publicKey === authority.publicKey) return existing;throw new Refused('PERSON_AUTHORITY_CHANGED', `this board pinned the relay key of ${existing.origin}, and ${origin} now presents another; check which relay this board belongs to before linking it there`);}+ const current = boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION) === 'current';const pinned = { origin, publicKey: authority.publicKey };meta(board, AUTHORITY, JSON.stringify(pinned));for (const { sql } of AUTHORITY_TRIGGERS) board.db.exec(sql);+ if (current) recordSchemaStamp(board.db, SCHEMA_DIGEST);return pinned;});}@@ -211,8 +218,10 @@ export function setPersonSigning(board, { agentId, signed, request }) {const detail = presence ? { signed, request, presence, intent: JSON.parse(record.encoded) } : { signed };if (!signed && (agentId !== PERSON || !presence || !offIntent(detail))) throw signedRefusal('only the person turns signing off, on their passkey');return atomic(board, () => {+ const current = boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION) === 'current';logEvent(board, agentId, 'person_signing', null, detail);stampSigningFormat(board.db);+ if (current) recordSchemaStamp(board.db, SCHEMA_DIGEST);return { signed, by: agentId };});}diff --git a/src/relay-outbox-undo.js b/src/relay-outbox-undo.jsindex f082613b..cd4cea59 100644--- a/src/relay-outbox-undo.js+++ b/src/relay-outbox-undo.js@@ -4,7 +4,7 @@* inverted changesets, newest first, so the board is exactly as the relay last ordered it; replaying the relay's* records and making the queued moves again on top costs only the rows they touch, never a whole-board restore.*/-import { storeTriggers } from './machine.js';+import { suspendStoreGuards } from './board-store-guards.js';import { atomic } from './board-event-log.js';/** SQLite's changeset conflict type for a row whose values changed, and the answers to a conflict. */@@ -190,8 +190,7 @@ export function undoQueued(board, entries) {atomic(board, () => {// A move's rows come back table by table; references between them are checked once all are back.db.exec('PRAGMA defer_foreign_keys = ON');- const triggers = db.prepare("SELECT name FROM sqlite_master WHERE type = 'trigger' AND name LIKE 'machine_%'").all();- for (const { name } of triggers) db.exec(`DROP TRIGGER "${name.replaceAll('"', '""')}"`);+ const restoreGuards = suspendStoreGuards(board);// This connection lets an item's status change only under moveItem's token; taking a move back holds it too.db.exec('CREATE TEMP TABLE IF NOT EXISTS moving (token INTEGER); INSERT INTO temp.moving (token) VALUES (1)');for (const entry of [...entries].reverse()) {@@ -223,7 +222,7 @@ export function undoQueued(board, entries) {for (const row of counters) insert.run(row.name, row.seq);}db.exec('DELETE FROM temp.moving');- for (const { sql } of storeTriggers()) db.exec(sql);+ restoreGuards();});} catch (error) {if (conflict) return conflict;diff --git a/test/board-schema.test.js b/test/board-schema.test.jsindex b6dbc5d0..aebb3345 100644--- a/test/board-schema.test.js+++ b/test/board-schema.test.js@@ -19,19 +19,27 @@ import { boardStanding } from '../src/board-migrate.js';import { recordSchemaStamp } from '../src/board-migrate.js';import { createE2eHelpers } from './e2e-helpers.js';import { runFixtureChild } from './fixture-child.js';+import { exportBoard } from '../src/exchange.js';+import { importBoard } from '../src/exchange.js';+import { undoQueued } from '../src/relay-outbox-undo.js';+import { pinAuthority } from '../src/person-signing.js';+import { setPersonSigning } from '../src/person-signing.js';+import { localAuthority } from '../src/person-signing.js';+import { restoreRelaySnapshot } from '../src/exchange.js';+import { ENGINE_VERSION } from '../src/machine.js';const e2e = createE2eHelpers();after(e2e.cleanup);/** Install and stamp the real previous declaration in a private fixture, without changing its data version. */-function olderDeclaration(file) {+function olderDeclaration(file, stamp = true) {const db = new DatabaseSync(file);try {const old = storeTriggers({ ...MACHINE, moves: MACHINE.moves.filter(move => move.verb !== 'submit-merge') }).find(trigger => trigger.name === 'machine_item_move');assert.ok(!old.sql.includes("'claimed>verified'"));db.exec(`DROP TRIGGER machine_item_move; ${old.sql}`);- recordSchemaStamp(db, SCHEMA_DIGEST);+ if (stamp) recordSchemaStamp(db, SCHEMA_DIGEST);} finally { db.close(); }}@@ -167,3 +175,138 @@ test('a stamped pre-carry board upgrades on main open and completes a native merassert.equal(db.prepare("SELECT count(*) AS n FROM event WHERE item_id=? AND event_kind='merge-only-accept'").get(id).n, 1);} finally { db.close(); }});++/** Install a real future transition so the running module is genuinely older than the installed declaration. */+function newerDeclaration(db) {+ const future = { ...MACHINE, moves: [...MACHINE.moves,+ { ...MACHINE.moves.find(move => move.verb === 'claim'), verb: 'future-reopen', from: ['withdrawn'], to: 'open' }] };+ for (const { name } of storeTriggers()) db.exec(`DROP TRIGGER "${name}"`);+ for (const { sql } of storeTriggers(future)) db.exec(sql);+ recordSchemaStamp(db, SCHEMA_DIGEST);+}++/** Observe the exact guards and header stamp without reopening or refreshing the board. */+function guardImage(board) {+ return {+ stamp: board.db.prepare('PRAGMA application_id').get().application_id,+ triggers: board.db.prepare("SELECT name, sql FROM sqlite_master WHERE type='trigger' AND name LIKE 'machine_%' ORDER BY name").all(),+ };+}++test('an older checkpoint restore preserves newer installed guards and reports the declaration difference [M3,A5,A6,H16]', () => {+ const diagnostics = [];+ const board = store.openBoard(':memory:', undefined, { onDiagnostic: text => diagnostics.push(text) });+ const source = store.openBoard(':memory:');+ try {+ store.addItem(source, { by: 'coordinator', lane: 'web', title: 'Restored data under current guards' });+ // Install after opening: verification must occur under the restore transaction, not at open time.+ newerDeclaration(board.db);+ const before = guardImage(board);+ importBoard(board, exportBoard(source));+ assert.deepEqual(guardImage(board), before, 'the caller must not replace newer SQL with its own cached declaration');+ assert.equal(boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION), 'current');+ assert.equal(board.db.prepare('SELECT item_title FROM item').get().item_title, 'Restored data under current guards');+ assert.match(diagnostics.join('\n'), /preserving the installed trunk guards/u);+ } finally { store.closeBoard(board); store.closeBoard(source); }+});++test('an older queued undo restores exact newer guards, including when its transaction rolls back [M3,A5,A6,H16]', () => {+ const board = store.openBoard(':memory:');+ try {+ const session = board.db.createSession({ table: 'shout' });+ board.db.prepare('INSERT INTO shout(shout_from,shout_to,shout_text,shout_at) VALUES(?,?,?,?)')+ .run('coordinator', 'all', 'Queued private fixture', new Date().toISOString());+ const changes = session.changeset();+ session.close();+ newerDeclaration(board.db);+ const before = guardImage(board);+ const diagnostics = [];+ board.onDiagnostic = text => diagnostics.push(text);+ assert.equal(undoQueued(board, [{ changes: [Buffer.from(changes).toString('base64')] }]), null);+ assert.equal(board.db.prepare('SELECT count(*) AS n FROM shout').get().n, 0, 'the actual queued row was undone');+ assert.deepEqual(guardImage(board), before);+ assert.equal(boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION), 'current');+ assert.match(diagnostics.join('\n'), /preserving the installed trunk guards/u);+ assert.throws(() => undoQueued(board, [{ changes: [Buffer.from('invalid SQLite changeset').toString('base64')] }]));+ assert.deepEqual(guardImage(board), before, 'failed undo rolls back both the temporary guard suspension and its data');+ } finally { store.closeBoard(board); }+});++test('main recovers a guard-only downgrade only when the unchanged stamp attests its complete target shape [M3,A5,A6,C7]', t => {+ const file = legacyBoard(t);+ store.closeBoard(store.openBoard(file));+ const attested = observe(file);+ olderDeclaration(file, false);+ const drifted = observe(file);+ assert.equal(drifted.standing, 'drifted');+ assert.equal(drifted.stamp, attested.stamp);+ const readonly = store.openBoardReadOnly(file);+ readonly.close();+ store.closeBoard(store.openBoard(file, undefined, { isMain: false, onDiagnostic: () => {} }));+ assert.deepEqual(observe(file), drifted, 'only main may recover the previously attested declaration');+ store.closeBoard(store.openBoard(file));+ const recovered = observe(file);+ assert.equal(recovered.standing, 'current');+ assert.equal(recovered.stamp, attested.stamp, 'recovery must not invent a new stamp to bless drift');+ assert.deepEqual(recovered.schema, attested.schema);+ assert.deepEqual(recovered.items, attested.items);+ assert.equal(recovered.identity, attested.identity);+ assert.equal(recovered.guards.length, attested.guards.length + 1);+ const bytes = readFileSync(file);+ store.closeBoard(store.openBoard(file));+ assert.deepEqual(readFileSync(file), bytes, 'recovered declaration is idempotent');+});++test('unrecognized stamps and non-guard drift cannot be approved by main recovery or restoration [M3,A5,A6,H16]', t => {+ const file = legacyBoard(t);+ store.closeBoard(store.openBoard(file));+ olderDeclaration(file, false);+ const changed = new DatabaseSync(file);+ try { changed.exec('CREATE INDEX unexpected_item_name ON item(item_title)'); }+ finally { changed.close(); }+ const before = observe(file);+ const messages = [];+ const board = store.openBoard(file, undefined, { onDiagnostic: text => messages.push(text) });+ const source = store.openBoard(':memory:');+ try {+ assert.deepEqual(observe(file), before, 'a table or index change must not be hidden by guard repair');+ assert.throws(() => importBoard(board, exportBoard(source)), error => error.code === 'IMPORT_NOT_EMPTY');+ const empty = store.openBoard(':memory:');+ try {+ empty.db.exec('PRAGMA application_id = 123');+ const unknown = guardImage(empty);+ assert.throws(() => importBoard(empty, exportBoard(source)), error => error.code === 'SCHEMA_DRIFT');+ assert.deepEqual(guardImage(empty), unknown, 'checkpoint restore cannot approve an unrecognized stamp');+ } finally { store.closeBoard(empty); }+ assert.throws(() => undoQueued(board, []), error => error.code === 'SCHEMA_DRIFT');+ assert.deepEqual(observe(file), before, 'refused restores leave both rows and guards unchanged');+ assert.match(messages.join('\n'), /different shape/u);+ } finally { store.closeBoard(board); store.closeBoard(source); }+});+++test('normal authority pinning and signed-format restore keep a verified stamp without approving prior drift [M3,E22,H16]', () => {+ const board = store.openBoard(':memory:');+ const source = store.openBoard(':memory:');+ try {+ const authority = { version: 1, algorithm: 'Ed25519', publicKey: 'a'.repeat(43) };+ pinAuthority(board, 'https://relay.fixture', authority);+ assert.equal(boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION), 'current', 'authorized authority guards are stamped atomically');+ const guards = guardImage(board);+ importBoard(source, exportBoard(board));+ source.db.prepare('INSERT INTO board_meta(meta_key,meta_value) VALUES(?,?)').run('relay_applied_sequence', '0');+ source.db.prepare('INSERT INTO board_meta(meta_key,meta_value) VALUES(?,?)').run('relay_engine_version', String(ENGINE_VERSION));+ setPersonSigning(source, { agentId: 'coordinator', signed: true });+ assert.equal(boardStanding(source.db, SCHEMA_DIGEST, SCHEMA_VERSION), 'current', 'authorized signed format is stamped atomically');+ restoreRelaySnapshot(board, exportBoard(source), 0);+ assert.deepEqual(guardImage(board).triggers, guards.triggers);+ assert.equal(boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION), 'current', 'signed restore stamps only the unchanged complete SQL shape');+ assert.equal(localAuthority(board).origin, 'https://relay.fixture', 'restore retains the target authority');+ assert.equal(undoQueued(board, []), null, 'normal pinned boards remain usable for queued undo');+ board.db.exec('CREATE INDEX unexpected_signed_item ON item(item_title)');+ const badStamp = guardImage(board).stamp;+ setPersonSigning(board, { agentId: 'coordinator', signed: true });+ assert.equal(guardImage(board).stamp, badStamp, 'an authorized format operation must never bless pre-existing drift');+ assert.equal(boardStanding(board.db, SCHEMA_DIGEST, SCHEMA_VERSION), 'drifted');+ } finally { store.closeBoard(board); store.closeBoard(source); }+});diff --git a/test/relay-outbox-undo.test.js b/test/relay-outbox-undo.test.jsindex 54a15b55..68afd212 100644--- a/test/relay-outbox-undo.test.js+++ b/test/relay-outbox-undo.test.js@@ -5,6 +5,8 @@ import { join } from 'node:path';import test from 'node:test';import * as store from '../src/board.js';import { undoQueued } from '../src/relay-outbox-undo.js';+import { recordSchemaStamp } from '../src/board-migrate.js';+import { SCHEMA_DIGEST } from '../src/board-schema-source.js';/** A real board preserves undo's transaction, triggers and foreign-key behavior on each actual Node runtime. */function fixture(t, schema) {@@ -12,6 +14,7 @@ function fixture(t, schema) {const board = store.openBoard(join(directory, 'board.sqlite'));t.after(() => { store.closeBoard(board); rmSync(directory, { recursive: true, force: true }); });board.db.exec(schema);+ recordSchemaStamp(board.db, SCHEMA_DIGEST); // The explicit private fixture schema is trusted setup.return board;}