test(core,dashboard): expand in-memory SQLite to more store tests

Extends the inMemoryDb opt-in established in 4fc58e0bb to single-instance
TaskStore/AgentStore/RoutineStore/PluginStore tests that were still
opening disk-backed fusion.db files. Cross-instance persistence tests
(open store A, close, open store B on same dir) and migration tests that
seed via a sibling Database instance keep their disk-backed stores —
swapping those would silently drop data between instances.

Sites flipped:
- core: store.test.ts (RunMutationContext, memory-toggle, diagnostics
  blocks), store-sort, settings-export, backup, plugin-loader,
  agent-instructions, agent-instructions-bundle, mission-store (all 10
  triage subtests), mission-planning-context.integration
- dashboard: routes.test.ts (Messaging routes block),
  session-reconnect, session-cross-tab, planning

Sites left disk-backed (cross-instance or sibling-Database dependency):
- run-audit*, task-documents, fts5-guard (sibling Database at same dir)
- mission-integration, mission-factory-parity (taskStore2 reopens)
- agent-store checkout-leasing (TaskStore + AgentStore at same dir)
- routes.test.ts AgentStore seed pattern (route handler opens its own)
- cli/extension.test.ts (makeCtx opens its own TaskStore)

All disk-backed tests continue to write to mkdtemp temp dirs — no live-db
risk introduced. Wall-clock impact: core 149s → 19s.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-26 20:56:31 -07:00
parent 4ccc8aed11
commit 330545d45c
13 changed files with 32 additions and 32 deletions

View File

@@ -2087,7 +2087,7 @@ describe("planning routes lock enforcement", () => {
setupMockAgent();
tmpRoot = mkdtempSync(join(tmpdir(), "kb-planning-lock-routes-"));
taskStore = new TaskStore(tmpRoot, join(tmpRoot, ".fusion-global-settings"));
taskStore = new TaskStore(tmpRoot, join(tmpRoot, ".fusion-global-settings"), { inMemoryDb: true });
await taskStore.init();
db = new Database(join(tmpRoot, ".fusion-locks"));

View File

@@ -17172,7 +17172,7 @@ describe("Messaging Routes", () => {
rootDir = mkdtempSync(join(tmpdir(), "kb-message-routes-"));
const { TaskStore, MessageStore } = await import("@fusion/core");
store = new TaskStore(rootDir, join(rootDir, ".fusion-global-settings"));
store = new TaskStore(rootDir, join(rootDir, ".fusion-global-settings"), { inMemoryDb: true });
await store.init();
messageStore = new MessageStore(store.getDatabase());

View File

@@ -46,7 +46,7 @@ describe("cross-tab session locking", () => {
beforeEach(async () => {
tmpRoot = mkdtempSync(join(tmpdir(), "kb-session-cross-tab-"));
taskStore = new TaskStore(tmpRoot, join(tmpRoot, ".fusion-global-settings"));
taskStore = new TaskStore(tmpRoot, join(tmpRoot, ".fusion-global-settings"), { inMemoryDb: true });
await taskStore.init();
aiSessionStore = new AiSessionStore(taskStore.getDatabase());

View File

@@ -91,7 +91,7 @@ describe("session reconnect + replay", () => {
__resetMissionInterviewState();
tmpRoot = mkdtempSync(join(tmpdir(), "kb-session-reconnect-"));
store = new TaskStore(tmpRoot, join(tmpRoot, ".fusion-global-settings"));
store = new TaskStore(tmpRoot, join(tmpRoot, ".fusion-global-settings"), { inMemoryDb: true });
await store.init();
aiSessionStore = new AiSessionStore(store.getDatabase());