diff --git a/CHANGELOG.md b/CHANGELOG.md index b9b4026..ad3cb84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,10 @@ from existing transcripts. MEMORY.md is no longer read; move facts into INDEX.md - Schema 14 (MP-78): `sessions` gains the scope `org` and the column `org_id`; `mypi db init` is required. `mypi org remove` refuses while an organization session or an event with its slug exists. - Pipeline texts (MP-116): `docs/PLAN-FORMAT.md` no longer names a `/review` command (a rework plan comes from `/plan`; Acceptance is walked at the manual check before `/ship`) and gains the «Execution» section, mandatory for plans the Pi `/flow` runs and absent from Claude plans; `docs/PIPELINE.md` says a pi-subagents child's `PI_SESSION_ID` is its own id, so its scope falls back to `MYPI_SCOPE`, then `global`. +### Fixed + +- Merged status in fresh databases (MP-122): a database created by `pnpm bootstrap` now has the non-terminal status `merged` that `/ship` and `docs/PIPELINE.md` rely on, so `mp-task status merged` works on a fresh install. Existing databases are not changed and need no `db init`; a database without `merged` (created by v0.11.0 or earlier) adds it once with `mypi status add merged`. + ### Removed - Memory (MP-104): `MEMORY.md` files, the MCP tool and CLI command `memory` and the warmup's memory zones and fact hiding are removed; durable facts live on a level's entry or in a branch it links. diff --git a/src/infrastructure/database/migrations/001-initial.sql b/src/infrastructure/database/migrations/001-initial.sql index d96d5f4..494b643 100644 --- a/src/infrastructure/database/migrations/001-initial.sql +++ b/src/infrastructure/database/migrations/001-initial.sql @@ -51,4 +51,5 @@ END; INSERT INTO request_statuses(code, is_terminal) VALUES ('new', 0), ('research', 0), ('planning', 0), ('in_progress', 0), ('review', 0), - ('blocked', 0), ('paused', 0), ('done', 1), ('failed', 1), ('cancelled', 1); + ('blocked', 0), ('paused', 0), ('done', 1), ('failed', 1), ('cancelled', 1), + ('merged', 0); diff --git a/test/fast/database.test.ts b/test/fast/database.test.ts index be371f2..8c20fa0 100644 --- a/test/fast/database.test.ts +++ b/test/fast/database.test.ts @@ -61,10 +61,12 @@ test('initialization is a no-op on a current database and rejects a newer schema let db = openDatabase(filename); assert.equal(db.pragma('journal_mode', { simple: true }), 'wal'); assert.deepEqual(db.prepare('SELECT code, is_terminal FROM task_statuses ORDER BY id').all(), - ['new', 'research', 'planning', 'in_progress', 'review', 'blocked', 'paused', 'done', 'failed', 'cancelled'] + ['new', 'research', 'planning', 'in_progress', 'review', 'blocked', 'paused', 'done', 'failed', 'cancelled', 'merged'] .map(code => ({ code, is_terminal: ['done', 'failed', 'cancelled'].includes(code) ? 1 : 0 }))); db.prepare("UPDATE task_statuses SET code = 'fresh' WHERE code = 'new'").run(); db.prepare("INSERT INTO task_statuses(code, is_terminal) VALUES ('custom', 0)").run(); + db.prepare("DELETE FROM task_statuses WHERE code = 'merged'").run(); + db.prepare("INSERT INTO task_statuses(code, is_terminal) VALUES ('merged', 0)").run(); const expected = db.prepare('SELECT * FROM task_statuses ORDER BY id').all(); db.close(); initializeDatabase(filename); @@ -84,6 +86,21 @@ test('initialization is a no-op on a current database and rejects a newer schema } finally { unsupported.close(); } }); +test('a fresh database lets a task go review → merged → done', t => { + const { filename } = state(t); + const app = createApp(filename, false); + try { + const project = app.projects.add('one/project', 'MP'); + const task = app.tasks.create({ projectId: project.id, slug: 'ship', title: 'ship', status: 'review' }, () => {}); + const merged = app.tasks.change(task.id, { status: 'merged' }, 'merged'); + assert.equal(merged.changed, true); + assert.equal(merged.after.isTerminal, false); + const done = app.tasks.change(task.id, { status: 'done' }, 'accepted'); + assert.equal(done.changed, true); + assert.equal(done.after.isTerminal, true); + } finally { app.close(); } +}); + test('schemas 6 and 7 upgrade a v0.7.0 database: work_chats dropped, requests renamed to tasks, journal literals mapped, ids and paths kept', async t => { const dir = mkdtempSync(join(tmpdir(), 'mypi-')); t.after(() => rmSync(dir, { recursive: true, force: true }));