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:
@@ -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');
|
||||
|
||||
@@ -24,7 +24,7 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import os from 'node:os';
|
||||
import Fastify from 'fastify';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { MindDB, CronStore, type CronSchedule } from '@waggle/core';
|
||||
import { WaggleDB, CronStore, type CronSchedule } from '@waggle/core';
|
||||
import { LocalScheduler, makeRecordExecutionCallback } from '../../src/local/cron.js';
|
||||
import { cronRoutes } from '../../src/local/routes/cron.js';
|
||||
import { notificationRoutes } from '../../src/local/routes/notifications.js';
|
||||
@@ -32,7 +32,7 @@ import { automationRoutes } from '../../src/local/routes/automations.js';
|
||||
import { securityMiddleware } from '../../src/local/security-middleware.js';
|
||||
|
||||
describe('Automations alias routes (Phase 3)', () => {
|
||||
let db: MindDB;
|
||||
let db: WaggleDB;
|
||||
let cronStore: CronStore;
|
||||
let scheduler: LocalScheduler;
|
||||
let executed: CronSchedule[];
|
||||
@@ -42,7 +42,7 @@ describe('Automations alias routes (Phase 3)', () => {
|
||||
let literalGlobalIsViewer: boolean;
|
||||
|
||||
beforeEach(async () => {
|
||||
db = new MindDB(':memory:');
|
||||
db = new WaggleDB(':memory:');
|
||||
cronStore = new CronStore(db);
|
||||
executed = [];
|
||||
failNext = false;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* connect-audit, and the GET /api/connectors lastSyncAt enrichment.
|
||||
*
|
||||
* Real VaultStore in a tmpdir + real ConnectorRegistry with a BaseConnector
|
||||
* fake + real InstallAuditStore over MindDB(':memory:'), real route plugin,
|
||||
* fake + real InstallAuditStore over WaggleDB(':memory:'), real route plugin,
|
||||
* server.inject — same harness style as the Phase-3 suites.
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,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, InstallAuditStore, VaultStore, type SecretStore } from '@waggle/core';
|
||||
import { WaggleDB, InstallAuditStore, VaultStore, type SecretStore } from '@waggle/core';
|
||||
import {
|
||||
ConnectorRegistry,
|
||||
BaseConnector,
|
||||
@@ -68,7 +68,7 @@ describe('Connector routes — Phase 4 extensions', () => {
|
||||
let vault: VaultStore;
|
||||
let registry: ConnectorRegistry;
|
||||
let connector: TestConnector;
|
||||
let db: MindDB;
|
||||
let db: WaggleDB;
|
||||
let auditStore: InstallAuditStore;
|
||||
let server: ReturnType<typeof Fastify>;
|
||||
|
||||
@@ -78,7 +78,7 @@ describe('Connector routes — Phase 4 extensions', () => {
|
||||
connector = new TestConnector();
|
||||
registry = new ConnectorRegistry(vault);
|
||||
registry.register(connector);
|
||||
db = new MindDB(':memory:');
|
||||
db = new WaggleDB(':memory:');
|
||||
auditStore = new InstallAuditStore(db);
|
||||
|
||||
server = Fastify({ logger: false });
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import Fastify from 'fastify';
|
||||
import { MindDB, InstallAuditStore, type RecordAuditInput } from '@waggle/core';
|
||||
import { WaggleDB, InstallAuditStore, type RecordAuditInput } from '@waggle/core';
|
||||
import { extendRoutes } from '../../src/local/routes/extend.js';
|
||||
import { marketplaceRoutes } from '../../src/local/routes/marketplace.js';
|
||||
|
||||
describe('Extend routes (Phase 4)', () => {
|
||||
let db: MindDB;
|
||||
let db: WaggleDB;
|
||||
let auditStore: InstallAuditStore;
|
||||
let server: ReturnType<typeof Fastify>;
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('Extend routes (Phase 4)', () => {
|
||||
}
|
||||
|
||||
beforeEach(async () => {
|
||||
db = new MindDB(':memory:');
|
||||
db = new WaggleDB(':memory:');
|
||||
auditStore = new InstallAuditStore(db);
|
||||
|
||||
server = Fastify({ logger: false });
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user