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

@@ -3,7 +3,7 @@ import Fastify from 'fastify';
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as os from 'node:os';
import { MindDB, CronStore } from '@waggle/core';
import { WaggleDB, CronStore } from '@waggle/core';
import { approvalRoutes } from '../../src/local/routes/approval.js';
import { securityMiddleware } from '../../src/local/security-middleware.js';
import {
@@ -14,7 +14,7 @@ import {
describe('approval routes — held actions (L2 union)', () => {
let tmpDir: string;
let db: MindDB;
let db: WaggleDB;
let store: CronStore;
let server: ReturnType<typeof Fastify>;
let pendingApprovals: Map<string, { toolName: string; input: Record<string, unknown>; timestamp: number; riskLevel?: 'low' | 'medium' | 'high' | 'critical'; resolve: (v: boolean) => void }>;
@@ -25,7 +25,7 @@ describe('approval routes — held actions (L2 union)', () => {
beforeEach(async () => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-appr-'));
db = new MindDB(path.join(tmpDir, 'test.mind'));
db = new WaggleDB(path.join(tmpDir, 'waggle.db'));
store = new CronStore(db);
pendingApprovals = new Map();
execSpy = vi.fn(async () => 'email sent');