Skip to content

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.

fix(core): trust installed source upgrades [A5,A6]

Corey Olson2efe9935bb5e
diff --git a/src/api.js b/src/api.js
index b2d08ccf..e32690bf 100644
--- a/src/api.js
+++ b/src/api.js
@@ -19,7 +19,7 @@ const CODE_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
/** Whether this API module came from a Git main checkout, rather than a linked worktree. */
function codeIsFromMain() {
- return tryGit(CODE_ROOT, ['rev-parse', '--show-toplevel']).status === 0 && repoInfo(CODE_ROOT).isMain;
+ return tryGit(CODE_ROOT, ['rev-parse', '--show-toplevel']).status !== 0 || repoInfo(CODE_ROOT).isMain;
}
/** Read a registered board and release its SQLite connection on every path.
diff --git a/src/cli.js b/src/cli.js
index e1b46cbe..a1d01b95 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -350,7 +350,7 @@ function sayBrief(io, brief) {
function context(io) {
const info = repoInfo(io.cwd);
const codeIsInGit = tryGit(CODE_ROOT, ['rev-parse', '--show-toplevel']).status === 0;
- const allowSchemaUpgrade = codeIsInGit && repoInfo(CODE_ROOT).isMain;
+ const allowSchemaUpgrade = !codeIsInGit || repoInfo(CODE_ROOT).isMain;
const config = configHere(info);
const file = join(info.commonDir, 'pullboard', 'board.sqlite');
return { info, config, file, allowSchemaUpgrade, doctrine: loadDoctrine(info.root, config), io, clock: io.clock ?? store.systemClock };
diff --git a/test/api.test.js b/test/api.test.js
index 3b212424..9358bfae 100644
--- a/test/api.test.js
+++ b/test/api.test.js
@@ -185,6 +185,23 @@ test('[A5, A6] a future-schema worktree cannot migrate the shared board; main ca
assert.equal(prior.prepare('PRAGMA user_version').get().user_version, 2);
prior.close();
+ const installed = join(box.dir, 'installed-pullboard');
+ mkdirSync(installed);
+ for (const name of ['bin', 'src']) cpSync(join(sourceRoot, name), join(installed, name), { recursive: true });
+ cpSync(join(sourceRoot, 'package.json'), join(installed, 'package.json'));
+ const olderInstalled = new DatabaseSync(dbFile);
+ olderInstalled.exec('ALTER TABLE item DROP COLUMN item_files; PRAGMA user_version = 1');
+ olderInstalled.close();
+ const installedRun = spawnSync(process.execPath, [join(installed, 'bin/pullboard.js'), 'status', '--json'], {
+ cwd: repo, env: box.env, encoding: 'utf8',
+ });
+ assert.equal(installedRun.status, 0, installedRun.stderr + installedRun.stdout);
+ const migratedInstalled = new DatabaseSync(dbFile, { readOnly: true });
+ assert.equal(migratedInstalled.prepare('PRAGMA user_version').get().user_version, 2,
+ 'a copied installed release without Git metadata can upgrade an older board');
+ assert.ok(migratedInstalled.prepare('PRAGMA table_info(item)').all().some((column) => column.name === 'item_files'));
+ migratedInstalled.close();
+
const older = new DatabaseSync(dbFile);
older.exec('ALTER TABLE item DROP COLUMN item_files; PRAGMA user_version = 1');
older.close();