test(server): move the remaining server tests onto the memory contract (P1.5)

- Workspace sessions, fleet runs, agent groups, loops, the file indexer,
  external tool runs, chat and the health endpoint are checked against the
  memory store instead of .mind files. Assertions on mind-cache pins and
  releases go with the pins; the drain and cancellation checks stay.
- Delete the sticky-erasure test (harvest import was removed) and the
  session-distillation test (distillation on workspace activation was
  removed).
- The saved-history retry test checks the conversation only: the failed
  user turn is kept in workspace memory by design (#3).
This commit is contained in:
shumeiko.it
2026-10-24 12:50:23 +02:00
parent 74a4e55be0
commit 122b45990e
12 changed files with 274 additions and 785 deletions

View File

@@ -5,7 +5,7 @@ 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, FrameStore, SessionStore } from '@waggle/core';
import { PERSONAL_SCOPE } from '@waggle/memory-contract';
import { buildLocalServer } from '../src/local/index.js';
import type { FastifyInstance } from 'fastify';
@@ -16,18 +16,10 @@ describe('Cockpit health endpoint enhancements', () => {
beforeAll(async () => {
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-cockpit-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('cockpit-test');
frames.createIFrame(s1.gop_id, 'Test frame 1', 'normal');
frames.createIFrame(s1.gop_id, 'Test frame 2', 'important');
frames.createPFrame(s1.gop_id, 'Test P-frame', 1, 'normal');
mind.close();
server = await buildLocalServer({ dataDir: tmpDir });
await server.memory.remember({ scope: PERSONAL_SCOPE, text: 'Test memory 1' });
await server.memory.remember({ scope: PERSONAL_SCOPE, text: 'Test memory 2', importance: 'important' });
await server.memory.remember({ scope: PERSONAL_SCOPE, text: 'Test memory 3' });
});
afterAll(async () => {
@@ -42,7 +34,7 @@ describe('Cockpit health endpoint enhancements', () => {
expect(body.memoryStats).toBeDefined();
expect(typeof body.memoryStats.frameCount).toBe('number');
expect(body.memoryStats.frameCount).toBeGreaterThanOrEqual(3); // We created 3 frames
expect(body.memoryStats.frameCount).toBeGreaterThanOrEqual(3); // We created 3 memories
expect(typeof body.memoryStats.mindSizeBytes).toBe('number');
expect(body.memoryStats.mindSizeBytes).toBeGreaterThan(0);
expect(typeof body.memoryStats.embeddingCoverage).toBe('number');