gsxdsm
5ae6332563
refactor: collapse dead SQLite dual-path code; keep migration-only readers (#2454)
# Remove dead SQLite dual-path code; keep migration-only readers
## Summary
PostgreSQL cutover left hundreds of production dual-path branches
(`backendMode ? PG : SQLite/store.db`) whose SQLite arms only hit
throwing `Database`/`ArchiveDatabase`/`CentralDatabase` stubs. This
change mechanically collapses those unreachable arms so production
authority is AsyncDataLayer/PostgreSQL only, while preserving the six
authorized read-only migration/recovery `DatabaseSync` seams.
## Dual-path mass removed
| Metric | Before | After |
|---|---|---|
| `if (…backendMode)` (non-test) | ~328 | ~70 |
| `store.db` / `this.db` refs in core (non-test) | ~570+ | ~375 (mostly
pure legacy MissionStore/eval/insight SQLite classes + thin getters) |
| Net diff | — | **~6.7k lines removed** across 41 files |
Remaining `backendMode` checks are intentional (incomplete-PG sync
safe-defaults, settings-sync disabled-on-PG, symbol-lock PG-only gates,
“requires PostgreSQL” config versioning throws), not live SQLite
authority.
## Subsystems cleaned
- **Core TaskStore / task-store/***: collapsed if/else and early-return
dual-path across reads, moves, lifecycle, mutations, workflow, archive,
branch/PR, artifacts, comments, audit, project ops, etc. `initImpl` is
PostgreSQL-only (SQLite startup tail deleted).
- **Satellite stores**: automation, agent, routine, plugin, secrets,
approval-request, central-core dual-path arms collapsed.
- **Plugins**: reports async methods, compound-engineering pipeline +
session stores, CLI Printing Press store — SQLite fallbacks removed; PG
required.
- **Engine**: no functional dual-path change beyond whitespace
(settings-sync / peer-exchange PG-disabled behavior kept).
## Six migration-only readers retained (allowlist unchanged)
1. `packages/core/src/postgres/sqlite-migrator.ts`
2. `packages/core/src/project-identity.ts`
3. `packages/core/src/sqlite-validation.ts`
4. `packages/core/src/postgres/startup-factory.ts`
5. `packages/cli/src/commands/db.ts`
6. `scripts/lib/start-local-project.mjs`
Plus low-level `sqlite-adapter` and migrator/startup-import tests.
Inventory ratchet still requires exactly these six `new DatabaseSync(`
production sites, all `readOnly: true`.
## Not treated as SQLite
- `.fusion/project.json`, `task.json`, `agent-log.jsonl` file storage
- AsyncDataLayer / Drizzle PG paths
- Incomplete-PG sync safe-default stubs (still return empty/false/null
under backend without consulting SQLite)
## Verification
- `sqlite-production-reader-inventory.test.ts` — 15/15 pass
- `incomplete-pg-ports.pg.test.ts` — 6/6 pass
- Targeted PG tests (create-task, move, handoff, runtime-persistence,
agent, mission, insight, central-core) — green
- `tsc --noEmit` for `@fusion/core`, `@fusion/engine`,
`@fusion/dashboard` — green
- `scripts/check-no-getdatabase.mjs` — clean
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Improvements**
* Improved end-to-end consistency by making PostgreSQL/async persistence
the standard across core task/workflow, automation, agents, plugins,
routines, secrets, approvals, central operations, and session storage.
* Unified scheduling, settings, configuration revision writes,
run/workflow selection, queues/leases/transitions, and audit/lifecycle
updates around consistent async transaction behavior.
* **Bug Fixes**
* Fixed edge cases for archived/deleted reads, unarchive/recovery flows,
not-found handling, and task/artifact/document/log/comment operations,
including more reliable emissions and hydration across search/list and
lifecycle operations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-26 23:28:42 -07:00
..
2026-07-23 17:27:59 -07:00
2026-07-26 20:33:25 -07:00
2026-07-26 12:01:19 -07:00
2026-07-26 12:01:19 -07:00
2026-07-24 18:09:32 -07:00
2026-07-26 23:28:42 -07:00
2026-07-26 22:38:58 -07:00
2026-07-15 10:36:10 -07:00
2026-07-26 12:01:19 -07:00
2026-06-07 18:51:46 -07:00
2026-07-15 16:17:37 -07:00
2026-07-04 10:42:21 -07:00
2026-05-14 13:59:10 -07:00
2026-07-09 19:58:05 -07:00
2026-07-26 09:42:24 -07:00
2026-07-19 13:47:38 -07:00
2026-07-26 23:28:42 -07:00
2026-07-13 19:07:58 -07:00
2026-06-02 18:46:33 -07:00
2026-07-26 12:01:19 -07:00
2026-07-01 16:19:03 -07:00
2026-07-19 13:34:25 -07:00
2026-07-26 23:28:42 -07:00
2026-07-21 23:10:08 -07:00
2026-07-16 17:05:29 -07:00
2026-07-14 08:23:11 -07:00
2026-07-16 16:01:29 -07:00
2026-07-23 20:19:18 -07:00
2026-07-14 08:16:42 -07:00
2026-07-14 22:13:30 -07:00
2026-07-14 08:16:42 -07:00
2026-07-14 22:13:30 -07:00
2026-07-16 05:33:55 -07:00
2026-07-24 18:09:32 -07:00
2026-07-18 11:34:42 -07:00
2026-07-16 00:30:59 -07:00
2026-07-16 16:01:29 -07:00
2026-07-13 19:07:58 -07:00
2026-07-18 13:18:08 -07:00
2026-07-18 13:18:08 -07:00
2026-07-16 00:30:59 -07:00
2026-07-14 22:13:30 -07:00
2026-07-21 00:00:08 -07:00
2026-07-23 16:12:44 -07:00
2026-07-26 12:01:19 -07:00
2026-07-13 19:07:58 -07:00
2026-07-16 16:01:29 -07:00
2026-07-14 12:41:10 -07:00
2026-07-26 12:01:19 -07:00
2026-07-17 01:23:32 -07:00
2026-07-14 13:36:08 -07:00
2026-07-26 23:28:42 -07:00
2026-07-12 19:43:41 -07:00
2026-06-21 13:32:19 -07:00
2026-07-16 16:34:09 -07:00
2026-07-16 16:34:09 -07:00
2026-05-14 15:49:55 -07:00
2026-06-07 20:43:44 -07:00
2026-06-03 13:51:13 -07:00
2026-06-03 09:23:44 -07:00
2026-07-05 11:31:48 -07:00
2026-06-29 14:00:32 -07:00
2026-06-29 18:41:43 -07:00
2026-07-21 13:36:05 -07:00
2026-07-05 16:58:42 -07:00
2026-07-01 16:43:08 -07:00
2026-06-29 11:07:11 -07:00
2026-06-29 12:23:20 -07:00
2026-06-30 13:12:27 -07:00
2026-06-29 12:23:20 -07:00
2026-07-05 16:58:42 -07:00
2026-07-26 02:04:40 -07:00
2026-06-30 12:25:43 -07:00
2026-06-08 23:38:32 -07:00
2026-06-26 00:26:03 -07:00
2026-06-29 11:24:41 -07:00
2026-07-26 22:38:58 -07:00
2026-07-19 11:50:52 -07:00
2026-05-13 06:29:35 -07:00
2026-07-26 23:28:42 -07:00
2026-07-14 22:13:30 -07:00
2026-07-24 18:09:32 -07:00
2026-07-24 18:09:32 -07:00
2026-07-16 00:30:59 -07:00
2026-06-04 22:52:20 -07:00
2026-06-05 00:57:49 -07:00
2026-06-05 13:59:50 -07:00
2026-07-20 09:57:38 -07:00
2026-07-16 21:42:44 -07:00
2026-07-18 11:34:42 -07:00
2026-05-27 21:31:12 -07:00
2026-07-13 19:07:58 -07:00
2026-07-13 19:07:58 -07:00
2026-07-26 02:28:04 -07:00
2026-05-19 03:21:16 -07:00
2026-07-18 12:32:07 -07:00
2026-06-26 14:55:01 -07:00
2026-05-12 18:33:13 -07:00
2026-07-26 12:01:19 -07:00
2026-06-04 08:00:33 -07:00
2026-07-25 23:44:56 -07:00
2026-07-22 19:28:51 -07:00
2026-05-18 08:02:21 -07:00
2026-07-22 08:53:31 -07:00
2026-07-14 08:16:42 -07:00
2026-05-14 05:35:12 -07:00
2026-07-14 08:16:42 -07:00
2026-07-14 08:16:42 -07:00
2026-07-13 19:07:58 -07:00
2026-05-14 00:12:03 -07:00
2026-06-26 08:40:59 -07:00
2026-07-26 10:23:00 -07:00
2026-07-21 18:00:35 -07:00
2026-05-23 04:18:55 -07:00
2026-07-16 16:01:29 -07:00
2026-06-12 09:24:02 -07:00
2026-07-14 22:13:30 -07:00
2026-07-19 18:45:27 -07:00
2026-07-17 23:56:34 -07:00
2026-07-18 00:33:14 -07:00
2026-07-17 23:56:34 -07:00
2026-07-13 19:07:58 -07:00
2026-07-02 19:01:09 -07:00
2026-07-13 19:07:58 -07:00
2026-07-02 11:38:34 -07:00
2026-07-16 16:34:09 -07:00
2026-07-18 11:34:42 -07:00
2026-05-30 22:53:24 -07:00
2026-05-28 10:32:16 -07:00
2026-05-28 10:32:16 -07:00
2026-07-09 21:36:14 -07:00
2026-07-18 13:18:08 -07:00
2026-06-28 16:51:49 -07:00
2026-07-16 14:31:59 -07:00
2026-07-15 10:36:10 -07:00
2026-07-26 16:16:27 -07:00
2026-07-26 16:16:27 -07:00
2026-07-13 19:07:58 -07:00
2026-07-13 19:07:58 -07:00
2026-07-22 18:16:00 -07:00
2026-07-22 17:35:14 -07:00
2026-07-26 09:50:43 -07:00
2026-07-16 20:37:05 -07:00
2026-07-26 12:01:19 -07:00
2026-07-22 15:25:20 -07:00
2026-06-26 11:56:12 -07:00
2026-07-11 17:16:49 -07:00
2026-07-26 12:01:19 -07:00
2026-07-26 12:01:19 -07:00
2026-07-26 17:48:46 -07:00
2026-07-21 00:00:08 -07:00
2026-07-26 12:01:19 -07:00
2026-07-14 22:13:30 -07:00
2026-07-26 12:01:19 -07:00
2026-07-23 16:12:44 -07:00
2026-07-18 19:18:57 -07:00
2026-05-23 03:09:00 -07:00
2026-07-16 19:48:11 -07:00
2026-07-22 08:53:31 -07:00
2026-06-15 19:57:20 -07:00
2026-06-11 20:53:01 -07:00
2026-06-14 15:29:35 -07:00
2026-06-25 03:44:22 -07:00
2026-07-16 19:36:02 -07:00
2026-06-13 02:54:57 -07:00
2026-07-26 12:01:19 -07:00
2026-07-07 22:06:20 -07:00
2026-06-13 23:20:06 -07:00
2026-07-09 23:12:02 -07:00
2026-07-18 11:49:11 -07:00
2026-07-15 02:19:19 -07:00
2026-07-04 19:29:47 +00:00
2026-07-14 20:27:35 -07:00
2026-07-14 20:27:35 -07:00
2026-07-14 22:13:30 -07:00
2026-07-15 21:33:11 -07:00
2026-07-04 13:51:09 -07:00
2026-07-14 22:13:30 -07:00
2026-07-14 20:27:35 -07:00
2026-07-14 20:27:35 -07:00
2026-07-11 22:16:48 -07:00
2026-07-20 17:35:06 -07:00
2026-07-13 19:07:58 -07:00
2026-06-04 01:43:26 -07:00
2026-07-26 08:35:04 -07:00
2026-07-26 08:35:04 -07:00
2026-07-10 07:46:52 -07:00
2026-07-12 11:52:24 -07:00
2026-07-26 23:28:42 -07:00
2026-07-22 15:25:20 -07:00
2026-07-20 01:54:42 -07:00
2026-06-15 19:44:17 -07:00
2026-07-26 09:50:43 -07:00
2026-07-20 13:40:50 -07:00
2026-07-16 16:01:29 -07:00
2026-05-14 13:59:10 -07:00
2026-07-14 22:13:30 -07:00
2026-07-23 11:41:15 -07:00
2026-06-05 03:56:29 -07:00
2026-07-26 12:01:19 -07:00
2026-07-18 16:18:15 -07:00
2026-07-13 19:07:58 -07:00
2026-07-18 16:18:15 -07:00
2026-07-15 20:53:05 -07:00
2026-05-15 12:51:41 -07:00
2026-07-19 11:50:52 -07:00
2026-07-26 23:28:42 -07:00
2026-05-19 17:19:02 -07:00
2026-05-15 12:02:44 -07:00
2026-05-15 22:56:31 -07:00
2026-05-15 12:02:44 -07:00
2026-05-17 00:21:12 -07:00
2026-05-16 21:00:48 -07:00
2026-07-26 23:28:42 -07:00
2026-07-13 19:07:58 -07:00
2026-05-17 07:26:21 -07:00
2026-07-14 20:27:35 -07:00
2026-07-14 22:13:30 -07:00
2026-07-26 22:38:58 -07:00
2026-07-16 15:37:42 -07:00
2026-07-15 13:32:33 -07:00
2026-06-26 00:28:31 -07:00
2026-07-15 10:38:04 -07:00
2026-07-16 20:37:05 -07:00
2026-07-14 22:13:30 -07:00
2026-07-14 22:13:30 -07:00
2026-05-20 14:29:07 -07:00
2026-05-20 14:29:07 -07:00
2026-05-13 06:29:34 -07:00
2026-06-30 07:31:59 -07:00
2026-07-26 23:28:42 -07:00
2026-07-19 15:20:39 -07:00
2026-07-18 19:31:30 -07:00
2026-06-21 13:32:19 -07:00
2026-06-04 08:00:33 -07:00
2026-05-15 21:08:04 -07:00
2026-07-26 13:15:36 -07:00
2026-07-26 13:15:36 -07:00
2026-07-22 08:30:12 -07:00
2026-06-04 13:19:55 -07:00
2026-06-28 01:43:08 -07:00
2026-05-19 05:16:37 -07:00
2026-06-19 06:51:57 -07:00
2026-06-18 03:24:57 -07:00
2026-07-19 11:50:52 -07:00
2026-07-18 14:54:54 -07:00
2026-06-24 10:45:21 -07:00
2026-07-15 10:36:10 -07:00
2026-07-19 21:19:56 -07:00
2026-07-20 13:40:50 -07:00
2026-05-18 15:01:20 -07:00
2026-07-13 19:07:58 -07:00
2026-07-16 00:30:59 -07:00
2026-07-14 08:16:42 -07:00
2026-07-26 16:16:27 -07:00
2026-06-04 02:13:48 -07:00
2026-06-04 00:19:57 -07:00
2026-06-04 00:19:58 -07:00
2026-06-04 00:19:58 -07:00
2026-07-25 02:17:31 -07:00
2026-07-26 12:01:19 -07:00
2026-06-03 13:48:02 -07:00
2026-07-13 19:07:58 -07:00
2026-07-19 11:50:52 -07:00
2026-06-23 08:21:10 -07:00
2026-07-14 13:36:08 -07:00
2026-06-07 21:19:10 -07:00
2026-06-07 20:43:44 -07:00
2026-07-19 11:50:52 -07:00
2026-07-22 22:37:51 -07:00
2026-07-22 22:37:51 -07:00
2026-07-19 11:50:52 -07:00
2026-07-01 16:43:08 -07:00
2026-07-26 09:40:37 -07:00
2026-07-21 12:17:47 -07:00
2026-06-04 02:13:48 -07:00
2026-06-21 21:23:41 -07:00
2026-06-04 12:03:29 -07:00
2026-07-23 08:53:06 -07:00
2026-07-16 01:32:23 -07:00
2026-07-26 12:24:29 -07:00
2026-07-10 01:49:15 -07:00
2026-07-19 11:50:52 -07:00
2026-06-04 00:41:12 -07:00
2026-07-16 15:27:03 -07:00
2026-05-16 07:16:05 -07:00
2026-06-13 21:17:20 -07:00