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:
@@ -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 } from '@waggle/core';
|
||||
import { buildLocalServer } from '../../src/local/index.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import { injectWithAuth } from '../test-utils.js';
|
||||
@@ -19,9 +18,6 @@ describe('Approval Flow — Server Side', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-approval-test-'));
|
||||
const personalPath = path.join(tmpDir, 'personal.mind');
|
||||
const mind = new MindDB(personalPath);
|
||||
mind.close();
|
||||
server = await buildLocalServer({ dataDir: tmpDir });
|
||||
});
|
||||
|
||||
|
||||
@@ -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, SessionStore, FrameStore } from '@waggle/core';
|
||||
import { buildLocalServer } from '../../src/local/index.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import { injectWithAuth } from '../test-utils.js';
|
||||
@@ -13,16 +12,6 @@ describe('Capabilities Route', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-caps-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('test');
|
||||
frames.createIFrame(s1.gop_id, 'Test content', 'normal');
|
||||
mind.close();
|
||||
|
||||
server = await buildLocalServer({ dataDir: tmpDir });
|
||||
});
|
||||
|
||||
|
||||
@@ -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, SessionStore, FrameStore } from '@waggle/core';
|
||||
import { buildLocalServer } from '../../src/local/index.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import { injectWithAuth } from '../test-utils.js';
|
||||
@@ -13,13 +12,6 @@ describe('Capability Packs API', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-packs-'));
|
||||
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');
|
||||
frames.createIFrame(s1.gop_id, 'Test content', 'normal');
|
||||
mind.close();
|
||||
server = await buildLocalServer({ dataDir: tmpDir });
|
||||
});
|
||||
|
||||
|
||||
@@ -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, SessionStore } from '@waggle/core';
|
||||
import { buildLocalServer } from '../../src/local/index.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import { injectWithAuth } from '../test-utils.js';
|
||||
@@ -13,10 +12,6 @@ describe('POST /api/command/interpret', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-interpret-test-'));
|
||||
const mind = new MindDB(path.join(tmpDir, 'personal.mind'));
|
||||
const sessions = new SessionStore(mind);
|
||||
sessions.create('test');
|
||||
mind.close();
|
||||
server = await buildLocalServer({ dataDir: tmpDir });
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ 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 { PERSONAL_SCOPE } from '@waggle/memory-contract';
|
||||
import { buildLocalServer } from '../../src/local/index.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import { injectWithAuth } from '../test-utils.js';
|
||||
@@ -14,17 +14,16 @@ describe('Command Execution Route', () => {
|
||||
beforeAll(async () => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-cmd-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('test');
|
||||
frames.createIFrame(s1.gop_id, 'Test memory about architecture decisions', 'normal');
|
||||
frames.createIFrame(s1.gop_id, 'Another memory about deployment', 'important');
|
||||
mind.close();
|
||||
|
||||
server = await buildLocalServer({ dataDir: tmpDir });
|
||||
await server.memory.remember({
|
||||
scope: PERSONAL_SCOPE,
|
||||
text: 'Test memory about architecture decisions',
|
||||
});
|
||||
await server.memory.remember({
|
||||
scope: PERSONAL_SCOPE,
|
||||
text: 'Another memory about deployment',
|
||||
importance: 'important',
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -75,7 +74,7 @@ describe('Command Execution Route', () => {
|
||||
const body = JSON.parse(res.body);
|
||||
expect(body.command).toBe('/memory architecture decisions');
|
||||
expect(body.result).toContain('Memory Search');
|
||||
expect(body.result).toContain('architecture decisions');
|
||||
expect(body.result).toContain('Test memory about architecture decisions');
|
||||
});
|
||||
|
||||
it('POST /api/commands/execute with /catchup returns workspace state', async () => {
|
||||
|
||||
@@ -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 } from '@waggle/core';
|
||||
import { buildLocalServer } from '../../src/local/index.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import { injectWithAuth } from '../test-utils.js';
|
||||
@@ -20,12 +19,6 @@ describe('Cron REST API Routes', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-cron-api-'));
|
||||
|
||||
// Create personal.mind
|
||||
const personalPath = path.join(tmpDir, 'personal.mind');
|
||||
const mind = new MindDB(personalPath);
|
||||
mind.close();
|
||||
|
||||
server = await buildLocalServer({ dataDir: tmpDir });
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,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 } from '@waggle/core';
|
||||
import { buildLocalServer } from '../../src/local/index.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
|
||||
@@ -12,10 +11,6 @@ describe('Health Endpoint', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-health-test-'));
|
||||
const personalPath = path.join(tmpDir, 'personal.mind');
|
||||
const mind = new MindDB(personalPath);
|
||||
mind.close();
|
||||
|
||||
server = await buildLocalServer({
|
||||
dataDir: tmpDir,
|
||||
port: 38123,
|
||||
|
||||
@@ -2,7 +2,6 @@ import { describe, it, expect, afterAll } from 'vitest';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import os from 'node:os';
|
||||
import { MindDB } from '@waggle/core';
|
||||
import { buildLocalServer } from '../../src/local/index.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import { injectWithAuth } from '../test-utils.js';
|
||||
@@ -26,12 +25,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => {
|
||||
return dir;
|
||||
}
|
||||
|
||||
function initMind(dataDir: string): void {
|
||||
const personalPath = path.join(dataDir, 'personal.mind');
|
||||
const mind = new MindDB(personalPath);
|
||||
mind.close();
|
||||
}
|
||||
|
||||
afterAll(() => {
|
||||
for (const dir of tmpDirs) {
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
@@ -42,7 +35,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => {
|
||||
|
||||
it('installed skill survives server restart', async () => {
|
||||
const dataDir = makeTmpDir();
|
||||
initMind(dataDir);
|
||||
|
||||
// 1. Build server, install a skill
|
||||
const server1 = await buildLocalServer({ dataDir });
|
||||
@@ -79,7 +71,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => {
|
||||
|
||||
it('multiple installed skills all survive restart', async () => {
|
||||
const dataDir = makeTmpDir();
|
||||
initMind(dataDir);
|
||||
|
||||
const skillsToInstall = ['retrospective', 'daily-plan', 'brainstorm'];
|
||||
|
||||
@@ -115,7 +106,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => {
|
||||
|
||||
it('all endpoints agree on skill state after install', async () => {
|
||||
const dataDir = makeTmpDir();
|
||||
initMind(dataDir);
|
||||
|
||||
const server = await buildLocalServer({ dataDir });
|
||||
|
||||
@@ -163,7 +153,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => {
|
||||
|
||||
it('all endpoints agree after restart', async () => {
|
||||
const dataDir = makeTmpDir();
|
||||
initMind(dataDir);
|
||||
|
||||
// Install, then restart
|
||||
const server1 = await buildLocalServer({ dataDir });
|
||||
@@ -200,8 +189,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => {
|
||||
it('different dataDirs have independent skill state', async () => {
|
||||
const dataDir1 = makeTmpDir();
|
||||
const dataDir2 = makeTmpDir();
|
||||
initMind(dataDir1);
|
||||
initMind(dataDir2);
|
||||
|
||||
// Install a skill in dataDir1 only
|
||||
const server1 = await buildLocalServer({ dataDir: dataDir1 });
|
||||
@@ -226,7 +213,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => {
|
||||
|
||||
it('deleting skill file from disk makes it unavailable after restart', async () => {
|
||||
const dataDir = makeTmpDir();
|
||||
initMind(dataDir);
|
||||
|
||||
// Install
|
||||
const server1 = await buildLocalServer({ dataDir });
|
||||
|
||||
@@ -2,7 +2,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 } from '@waggle/core';
|
||||
import { buildLocalServer } from '../../src/local/index.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import { injectWithAuth } from '../test-utils.js';
|
||||
@@ -16,9 +15,6 @@ describe('Starter Skill Catalog', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-catalog-test-'));
|
||||
const personalPath = path.join(tmpDir, 'personal.mind');
|
||||
const mind = new MindDB(personalPath);
|
||||
mind.close();
|
||||
server = await buildLocalServer({ dataDir: tmpDir });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user