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

@@ -13,7 +13,6 @@ import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { MindDB, SessionStore, FrameStore } from '@waggle/core';
import { buildLocalServer } from '../src/local/index.js';
import type { FastifyInstance } from 'fastify';
import { injectWithAuth, resetRateLimiter } from './test-utils.js';
@@ -26,15 +25,6 @@ describe('Backup Streaming (CQ-010)', () => {
beforeAll(async () => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-backup-stream-test-'));
// Create personal.mind with test data
const personalPath = path.join(tmpDir, 'personal.mind');
const mind = new MindDB(personalPath);
const sessions = new SessionStore(mind);
const frames = new FrameStore(mind);
const s1 = sessions.create('stream-test');
frames.createIFrame(s1.gop_id, 'Streaming backup test memory', 'normal');
mind.close();
// Create config.json
fs.writeFileSync(
path.join(tmpDir, 'config.json'),
@@ -73,7 +63,7 @@ describe('Backup Streaming (CQ-010)', () => {
describe('enumerateFiles', () => {
it('collects file metadata without loading content', () => {
const metas = enumerateFiles(tmpDir);
expect(metas.length).toBeGreaterThanOrEqual(28); // 25 batch files + mind + config + session + vault files
expect(metas.length).toBeGreaterThanOrEqual(28); // 25 batch files + waggle.db + config + session + vault files
// Every entry has path, fullPath, sizeBytes but no content property
for (const meta of metas) {
@@ -103,13 +93,6 @@ describe('Backup Streaming (CQ-010)', () => {
// a real test we just verify the 413 code path exists in the route)
const hugeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-huge-test-'));
// Create personal.mind (required)
const personalPath = path.join(hugeDir, 'personal.mind');
const mind = new MindDB(personalPath);
const sessions = new SessionStore(mind);
sessions.create('huge-test');
mind.close();
// Create a file just big enough to trigger the cap check
// We won't actually create 500MB — instead we create a small server and
// verify the route handler checks size properly via the header