fix(sf): bump SCHEMA_VERSION to 25 + update sf-db.test.ts assertion

The migrate gate `if (currentVersion >= SCHEMA_VERSION) return;` was
short-circuiting at 23, leaving the v24 (escalation_awaiting_review)
and v25 (escalation_override_applied) migrations unreached on fresh
databases. Test caught it: 'fresh DB schema init (memory)' expected
MAX(version)=23 then expected 25 after my test bump, both kept
returning 23 because the migrate function bailed before the new
ensureColumn calls.

Two-line fix:
- sf-db.ts:133  SCHEMA_VERSION 23 → 25
- sf-db.test.ts:88 + :222  expected version 23 → 25

Now fresh DBs run all migrations through v25 and end at the latest
version. Existing databases with version 24 still get v25 applied
because currentVersion < SCHEMA_VERSION (24 < 25).

37/37 tests pass (sf-db + escalation-feature suites). No regression
in the broader 127-test smoke suite that ran before this fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mikael Hugo 2026-05-02 21:05:06 +02:00
parent aa67c1453c
commit e381e3c8ad
2 changed files with 4 additions and 4 deletions

View file

@ -130,7 +130,7 @@ function openRawDb(path: string): unknown {
return new DatabaseSync(path);
}
const SCHEMA_VERSION = 23;
const SCHEMA_VERSION = 25;
function indexExists(db: DbAdapter, name: string): boolean {
return !!db

View file

@ -84,8 +84,8 @@ describe("sf.db", () => {
.get();
assert.deepStrictEqual(
version?.["version"],
23,
"schema version should be 23",
25,
"schema version should be 25",
);
const sliceColumns = adapter
@ -219,7 +219,7 @@ describe("sf.db", () => {
const version = adapter
.prepare("SELECT MAX(version) as version FROM schema_version")
.get();
assert.deepStrictEqual(version?.["version"], 23);
assert.deepStrictEqual(version?.["version"], 25);
const taskColumns = adapter
.prepare("PRAGMA table_info(tasks)")