test(server): check waggle.db and the memory store instead of mind files (P1.5)

- trust wiring: read install_audit from waggle.db through the server; the
  old checks read a legacy personal.mind that nothing writes any more.
- data dir: a fresh install is marked by waggle.db, not personal.mind.
- backup: expect waggle.db and memory/ in the archive.
- cross-platform: replace the MindDB block with waggle.db checks (file, WAL,
  foreign keys) and memory round trips (plain, Unicode, 100 KB) through
  server.memory. FTS5 and session CRUD were legacy-engine features.
- store fixtures (install audit, cron) open WaggleDB instead of MindDB.
This commit is contained in:
shumeiko.it
2026-10-24 17:07:10 +02:00
parent 6573f817b0
commit f57d618bea
10 changed files with 76 additions and 183 deletions

View File

@@ -2,7 +2,7 @@
* MCP Hub REST API tests (UX-Refactor Phase 4, S08/S17).
*
* Harness mirrors the Phase-3 automations/agents style: bare Fastify + real
* stores (MindDB ':memory:' InstallAuditStore, real McpRuntime with the same
* stores (WaggleDB ':memory:' InstallAuditStore, real McpRuntime with the same
* DI'd PassThrough mock-spawn the agent runtime tests use, real tmp-dir
* .mcp.json store) + the REAL route plugins, exercised via server.inject.
*
@@ -19,7 +19,7 @@ import * as path from 'node:path';
import * as os from 'node:os';
import { PassThrough } from 'node:stream';
import Database from 'better-sqlite3';
import { MindDB } from '@waggle/core';
import { WaggleDB } from '@waggle/core';
import { InstallAuditStore } from '@waggle/core';
import { MCP_CATALOG } from '@waggle/shared';
import { SecurityGate } from '@waggle/marketplace';
@@ -200,7 +200,7 @@ function createFakeMarketplace() {
describe('MCP Hub routes (Phase 4)', () => {
let tmpDir: string;
let db: MindDB;
let db: WaggleDB;
let auditStore: InstallAuditStore;
let runtime: McpRuntime;
let processSettlementConfirmed: boolean;
@@ -236,7 +236,7 @@ describe('MCP Hub routes (Phase 4)', () => {
childProcess.execFileSync.mockReset();
mcpConfigFailure.remove = null;
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-mcps-'));
db = new MindDB(':memory:');
db = new WaggleDB(':memory:');
auditStore = new InstallAuditStore(db);
processSettlementConfirmed = true;
runtime = new McpRuntime({