test(server): stop seeding a legacy personal mind (P1.5)

The server no longer opens personal.mind, so tests build it on an empty
data directory. The /memory command test seeds its two memories through
server.memory and now checks that the seeded text is found.
This commit is contained in:
shumeiko.it
2026-10-24 17:07:10 +02:00
parent f1cde9a32f
commit 6573f817b0
26 changed files with 13 additions and 235 deletions

View File

@@ -2,7 +2,6 @@ import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import type { FastifyInstance } from 'fastify';
import { MindDB } from '@waggle/core';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { buildLocalServer } from '../../src/local/index.js';
import {
@@ -47,7 +46,6 @@ describe('Browser Companion pairing lifecycle', () => {
try {
fs.mkdirSync(path.join(dataDir, 'skills'), { recursive: true });
fs.writeFileSync(path.join(dataDir, 'skills', '.starter-installed'), 'test');
new MindDB(path.join(dataDir, 'personal.mind')).close();
server1 = await buildLocalServer({ dataDir });
const firstGlobalToken = server1.agentState.wsSessionToken;

View File

@@ -9,7 +9,6 @@ import { describe, it, expect, beforeAll, afterAll } 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 } from '../test-utils.js';
@@ -26,15 +25,6 @@ describe('Cost Dashboard API', () => {
fs.mkdirSync(path.join(tmpDir, 'skills'), { recursive: true });
fs.writeFileSync(path.join(tmpDir, 'skills', '.starter-installed'), 'test');
// Create personal.mind (required by buildLocalServer)
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('cost-test');
frames.createIFrame(s1.gop_id, 'Cost test frame', 'normal');
mind.close();
server = await buildLocalServer({ dataDir: tmpDir });
});
@@ -151,9 +141,6 @@ describe('Cost Dashboard API', () => {
path.join(restartDir, 'config.json'),
JSON.stringify({ tier: 'TEAMS', dailyBudget: 10 }),
);
const mind = new MindDB(path.join(restartDir, 'personal.mind'));
mind.close();
initialServer = await buildLocalServer({ dataDir: restartDir });
const traceId = initialServer.traceStore.start({
sessionId: 'persisted-cost-dashboard-source',

View File

@@ -12,7 +12,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 } from '../test-utils.js';
@@ -32,14 +31,6 @@ describe('Embedding routing API', () => {
fs.mkdirSync(path.join(tmpDir, 'skills'), { recursive: true });
fs.writeFileSync(path.join(tmpDir, 'skills', '.starter-installed'), 'test');
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('embrouting-test');
frames.createIFrame(s1.gop_id, 'Embedding routing test frame', 'normal');
mind.close();
server = await buildLocalServer({ dataDir: tmpDir });
});

View File

@@ -8,7 +8,6 @@ import { describe, it, expect, beforeAll, afterAll, vi } 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 type { FileEntry } from '../../src/local/storage/types.js';
@@ -23,15 +22,6 @@ describe('File Management API', () => {
beforeAll(async () => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-files-'));
// Create personal.mind (required by buildLocalServer)
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('files-test');
frames.createIFrame(s1.gop_id, 'File management test', 'normal');
mind.close();
server = await buildLocalServer({ dataDir: tmpDir });
// Create a test workspace

View File

@@ -33,7 +33,6 @@ import { describe, it, expect, beforeAll, afterAll } 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 } from '../test-utils.js';
@@ -47,15 +46,6 @@ describe('R6-001 — POST /api/chat session-persistence path traversal guard', (
beforeAll(async () => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-chat-traversal-'));
// Create personal.mind (required by buildLocalServer).
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('chat-traversal-test');
frames.createIFrame(s1.gop_id, 'chat traversal test frame', 'normal');
mind.close();
server = await buildLocalServer({ dataDir: tmpDir });
validWorkspaceId = (
server as unknown as { agentState: { activeWorkspaceId: string } }

View File

@@ -8,7 +8,6 @@ import { describe, it, expect, beforeAll, afterAll, vi } 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 } from '../test-utils.js';
@@ -73,13 +72,6 @@ describe('Provider API', () => {
prevOllamaHost = process.env.OLLAMA_HOST;
process.env.OLLAMA_HOST = 'http://127.0.0.1:1';
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-providers-'));
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('providers-test');
frames.createIFrame(s1.gop_id, 'Provider test', 'normal');
mind.close();
server = await buildLocalServer({ dataDir: tmpDir });
});
@@ -349,13 +341,6 @@ describe('Model Validation', () => {
beforeAll(async () => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-model-val-'));
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('model-val-test');
frames.createIFrame(s1.gop_id, 'Model validation test', 'normal');
mind.close();
// Set TRIAL tier so we're not capped at the FREE limit (5 workspaces).
// Without this, ensureDefault() + 4 test workspaces = 5, making the next
// POST hit the tier limit (403) before reaching model validation (400).

View File

@@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { MindDB, FrameStore, SessionStore } from '@waggle/core';
import { buildLocalServer } from '../../src/local/index.js';
import type { FastifyInstance } from 'fastify';
import { injectWithAuth } from '../test-utils.js';
@@ -14,15 +13,6 @@ describe('Permission settings API', () => {
beforeAll(async () => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-perms-test-'));
// Create personal.mind (required by server startup)
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('test-project');
frames.createIFrame(s1.gop_id, 'test content', 'normal');
mind.close();
server = await buildLocalServer({ dataDir: tmpDir });
});

View File

@@ -17,7 +17,6 @@ import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { EventEmitter } from 'node:events';
import { MindDB, SessionStore, FrameStore } from '@waggle/core';
import type { ToolDefinition } from '@waggle/agent';
import { buildLocalServer } from '../../src/local/index.js';
import type { FastifyInstance } from 'fastify';
@@ -50,15 +49,6 @@ describe('SSE Stream Resilience', () => {
beforeAll(async () => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-sse-resilience-'));
// Create personal.mind (required by buildLocalServer)
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('sse-test');
frames.createIFrame(s1.gop_id, 'SSE resilience test frame', 'normal');
mind.close();
server = await buildLocalServer({ dataDir: tmpDir });
});