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 version warnings and isolate hook fixtures [A5,A6]
Corey Olson4fdd6ef97adf
diff --git a/src/api.js b/src/api.jsindex f3dfa447..94cf85b8 100644--- a/src/api.js+++ b/src/api.js@@ -52,7 +52,7 @@ function apiBoardListing(projects = listApiProjects, isMain) {try {boards.push(withBoard(project.root, (board) => ({ ...project, id: store.boardId(board) }), isMain));} catch (cause) {- const error = cause.code === 'EVENT_LOG_VERSION' ? cause : new Refused('BOARD_UNAVAILABLE', `registered project ${project.root} cannot be read; restore the repo or run pullboard forget ${project.root}`);+ const error = ['EVENT_LOG_VERSION', 'UNMERGED_SCHEMA'].includes(cause.code) ? cause : new Refused('BOARD_UNAVAILABLE', `registered project ${project.root} cannot be read; restore the repo or run pullboard forget ${project.root}`);warnings.push({ ...project, error: refusalDocument(error) });}}diff --git a/src/doctor.js b/src/doctor.jsindex a361897a..25d47176 100644--- a/src/doctor.js+++ b/src/doctor.js@@ -26,12 +26,13 @@ export function doctorProblems(file, root, tryGit, config, { isMain = true } = {try {const schemaProblems = versionProblems(db, isMain);if (schemaProblems.length) return schemaProblems;+ const eventProblems = [];try {const version = readEventLogVersion(db);if (version < EVENT_LOG_VERSION) {const next = isMain ? 'run pullboard status to upgrade this event log': 'merge this code into the main checkout first, then run pullboard status there; or test it against a throwaway board';- return [finding('EVENT_LOG_VERSION', `event log version is ${version}; this pullboard expects ${EVENT_LOG_VERSION}`, next)];+ eventProblems.push(finding('EVENT_LOG_VERSION', `event log version is ${version}; this pullboard expects ${EVENT_LOG_VERSION}`, next));}}catch (error) {@@ -40,6 +41,7 @@ export function doctorProblems(file, root, tryGit, config, { isMain = true } = {}const layout = layoutProblems(db);return [+ ...eventProblems,...triggerProblems(db),...layout.problems,...(layout.itemFields ? itemProblems(db) : []),diff --git a/test/api.test.js b/test/api.test.jsindex 84987b4f..d57d6aed 100644--- a/test/api.test.js+++ b/test/api.test.js@@ -389,6 +389,7 @@ test('[A5, A6] a future-schema worktree cannot migrate the shared board; main caconst listing = await fetch(api.url).then((response) => response.json());console.log(JSON.stringify({apiWarnings: listing.warnings?.map((warning) => warning.error.error.code) ?? [],+ apiNext: listing.warnings?.map((warning) => warning.error.error.next) ?? [],}));} finally {await api.close();@@ -401,7 +402,8 @@ test('[A5, A6] a future-schema worktree cannot migrate the shared board; main ca});assert.equal(surfaces.status, 0, surfaces.stderr + surfaces.stdout);const surfaceResult = JSON.parse(surfaces.stdout);- assert.deepEqual(surfaceResult.apiWarnings, ['BOARD_UNAVAILABLE'], 'API reads must report a future-schema board as unavailable');+ assert.deepEqual(surfaceResult.apiWarnings, ['UNMERGED_SCHEMA'], 'API warnings retain the actionable source-version refusal');+ assert.match(surfaceResult.apiNext[0], /merge this code into the main checkout first/);assert.deepEqual(readFileSync(dbFile), before, 'API reads from the linked worktree must not migrate the shared board');const refused = runFixture(linked, 'status', '--json');diff --git a/test/doctor.test.js b/test/doctor.test.jsindex b02cc321..24e8e0ec 100644--- a/test/doctor.test.js+++ b/test/doctor.test.js@@ -1,7 +1,7 @@/** Integrity checks use throwaway git repositories and real board databases (A6). */import assert from 'node:assert/strict';import { execFileSync, spawnSync } from 'node:child_process';-import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join, resolve } from 'node:path';import { after, test } from 'node:test';@@ -27,6 +27,8 @@ function boardBox({ initialize = true, repoName = 'repo' } = {}) {for (const name of Object.keys(env)) if (name.startsWith('GIT_')) delete env[name];Object.assign(env, {PULLBOARD_HOME: join(dir, 'home'),+ HOME: join(dir, 'private-home'),+ PULLBOARD_MACHINE_HOME: join(dir, 'machine-home'),GIT_CONFIG_GLOBAL: '/dev/null',GIT_CONFIG_NOSYSTEM: '1',GIT_AUTHOR_NAME: 'Doctor Test',@@ -34,6 +36,7 @@ function boardBox({ initialize = true, repoName = 'repo' } = {}) {GIT_COMMITTER_NAME: 'Doctor Test',GIT_COMMITTER_EMAIL: '[email protected]',});+ delete env.PULLBOARD_RELAY_TOKEN;const git = (...args) => execFileSync('git', args, { cwd: root, env, encoding: 'utf8' }).trim();const run = (...args) => spawnSync(process.execPath, [BIN, ...args], { cwd: root, env, encoding: 'utf8' });git('init', '-q', '-b', 'main');@@ -46,6 +49,14 @@ function boardBox({ initialize = true, repoName = 'repo' } = {}) {return { dir, root, env, git, run, dbFile };}+/** Exercise installed-release repair advice independently of the checkout running this test. */+function runRelease(box, ...args) {+ const release = join(box.dir, 'installed-release');+ mkdirSync(release, { recursive: true });+ for (const name of ['bin', 'src', 'package.json']) cpSync(resolve(import.meta.dirname, '..', name), join(release, name), { recursive: true });+ return spawnSync(process.execPath, [join(release, 'bin/pullboard.js'), ...args], { cwd: box.root, env: box.env, encoding: 'utf8' });+}+/*** Open the test board directly so a fixture can model corruption that normal triggers prevent.*/@@ -189,7 +200,7 @@ test('doctor reports verdicts whose commit object is gone [A6]', () => {test('doctor reports older and newer schema versions without migrating either [A6]', () => {const box = boardBox();mutate(box, (db) => db.exec('PRAGMA user_version = 0'));- const older = box.run('doctor');+ const older = runRelease(box, 'doctor');assert.equal(older.status, 1);assert.match(older.stdout, new RegExp(`schema version is 0; this pullboard expects ${SCHEMA_VERSION}; repair: run pullboard status to upgrade this board`));mutate(box, (db) => db.exec(`PRAGMA user_version = ${SCHEMA_VERSION + 1}`));@@ -210,7 +221,7 @@ test('doctor reports an older empty SQLite layout without querying current tabledb.exec('PRAGMA user_version = 0');db.close();const before = readFileSync(box.dbFile);- const result = box.run('doctor');+ const result = runRelease(box, 'doctor');assert.equal(result.status, 1);assert.match(result.stdout, new RegExp(`schema version is 0; this pullboard expects ${SCHEMA_VERSION}; repair: run pullboard status to upgrade this board`));assert.doesNotMatch(result.stderr, /no such table|SQLITE_ERROR|Error:/);diff --git a/test/shared-version.test.js b/test/shared-version.test.jsindex e302dc94..dc13db58 100644--- a/test/shared-version.test.js+++ b/test/shared-version.test.js@@ -1,7 +1,7 @@/** Unmerged source protects both shared formats, including indirect openers and real hooks [A5,A6]. */import assert from 'node:assert/strict';import { spawnSync } from 'node:child_process';-import { cpSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';+import { chmodSync, cpSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join, resolve } from 'node:path';import { DatabaseSync } from 'node:sqlite';@@ -12,9 +12,12 @@ function fixture(t) {const dir = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-shared-version-')));t.after(() => rmSync(dir, { recursive: true, force: true }));const root = join(dir, 'repo'); const lane = join(dir, 'lane');+ const executables = join(dir, 'executables'); mkdirSync(executables);+ writeFileSync(join(executables, 'pullboard'), `#!/bin/sh\nexec "${process.execPath}" "$(git rev-parse --show-toplevel)/bin/pullboard.js" "$@"\n`);+ chmodSync(join(executables, 'pullboard'), 0o755);mkdirSync(root);for (const name of ['bin', 'src', 'skills', 'package.json']) cpSync(resolve(import.meta.dirname, '..', name), join(root, name), { recursive: true });- const env = { ...process.env, HOME: join(dir, 'home'), PULLBOARD_HOME: join(dir, 'board-home'), PULLBOARD_MACHINE_HOME: join(dir, 'machine-home') };+ const env = { ...process.env, HOME: join(dir, 'home'), PULLBOARD_HOME: join(dir, 'board-home'), PULLBOARD_MACHINE_HOME: join(dir, 'machine-home'), PATH: executables + ':' + process.env.PATH };for (const name of Object.keys(env)) if (name.startsWith('GIT_')) delete env[name];delete env.PULLBOARD_RELAY_TOKEN;Object.assign(env, { GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1', GIT_AUTHOR_NAME: 'Version Fixture', GIT_AUTHOR_EMAIL: '[email protected]', GIT_COMMITTER_NAME: 'Version Fixture', GIT_COMMITTER_EMAIL: '[email protected]' });