test: finish moving the root suites to the community edition (P1.5, P1.3b)
- The workspace isolation scenarios store memories through the memory store and check that one workspace's search never returns another's. - The Ollama manifest test covers the Linux x64 and arm64 artifacts added for P1.3b; an unsupported platform still resolves to nothing. - The root run leaves out the tests that only exercise excluded packages (the hook packages and the memory MCP server); they go with those packages in P2.2.
This commit is contained in:
@@ -13,9 +13,17 @@ import os from 'node:os';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import type { FastifyInstance } from 'fastify';
|
import type { FastifyInstance } from 'fastify';
|
||||||
import { startService } from '@waggle/server/local/service';
|
import { startService } from '@waggle/server/local/service';
|
||||||
import { FrameStore, SessionStore } from '@waggle/core';
|
import { PERSONAL_SCOPE, workspaceScope } from '@waggle/memory-contract';
|
||||||
import { injectWithAuth } from './test-utils.js';
|
import { injectWithAuth } from './test-utils.js';
|
||||||
|
|
||||||
|
/** Texts of the memories `/api/memory/search` returns for a query. */
|
||||||
|
async function searchTexts(server: FastifyInstance, q: string, scope: string, workspace?: string): Promise<string[]> {
|
||||||
|
const params = new URLSearchParams({ q, scope, ...(workspace && { workspace }) });
|
||||||
|
const res = await injectWithAuth(server, { method: 'GET', url: `/api/memory/search?${params}` });
|
||||||
|
expect(res.statusCode).toBe(200);
|
||||||
|
return (JSON.parse(res.payload) as { results: Array<{ content: string }> }).results.map((r) => r.content);
|
||||||
|
}
|
||||||
|
|
||||||
function makeTmpDir(): string {
|
function makeTmpDir(): string {
|
||||||
return fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-e2e-'));
|
return fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-e2e-'));
|
||||||
}
|
}
|
||||||
@@ -112,67 +120,17 @@ describe('Workspaces & Sessions E2E', () => {
|
|||||||
expect(ws1.group).toBe('Work');
|
expect(ws1.group).toBe('Work');
|
||||||
expect(ws2.group).toBe('Personal');
|
expect(ws2.group).toBe('Personal');
|
||||||
|
|
||||||
// Each workspace has its own .mind file on disk
|
// Workspace memory lives in the memory store, not in per-workspace files.
|
||||||
const mind1Path = path.join(dataDir, 'workspaces', ws1.id, 'workspace.mind');
|
expect(fs.existsSync(path.join(dataDir, 'workspaces', ws1.id, 'workspace.mind'))).toBe(false);
|
||||||
const mind2Path = path.join(dataDir, 'workspaces', ws2.id, 'workspace.mind');
|
|
||||||
expect(fs.existsSync(mind1Path)).toBe(true);
|
|
||||||
expect(fs.existsSync(mind2Path)).toBe(true);
|
|
||||||
|
|
||||||
// Switch to ws-A, store memory, verify it's found
|
await server.memory.remember({ scope: workspaceScope(ws1.id), text: 'Alpha project uses Kubernetes for deployment' });
|
||||||
server.multiMind.switchWorkspace(mind1Path);
|
await server.memory.remember({ scope: workspaceScope(ws2.id), text: 'Beta project uses Docker Compose locally' });
|
||||||
const wsASessions = new SessionStore(server.multiMind.workspace!);
|
|
||||||
const wsASession = wsASessions.create();
|
|
||||||
const wsAFrames = new FrameStore(server.multiMind.workspace!);
|
|
||||||
wsAFrames.createIFrame(wsASession.gop_id, 'Alpha project uses Kubernetes for deployment');
|
|
||||||
|
|
||||||
// Search ws-A scope — should find Kubernetes
|
// Each workspace finds its own memory and never the other's.
|
||||||
const searchA = await injectWithAuth(server, {
|
expect(await searchTexts(server, 'Kubernetes', 'workspace', ws1.id)).toContain('Alpha project uses Kubernetes for deployment');
|
||||||
method: 'GET',
|
expect(await searchTexts(server, 'Kubernetes', 'workspace', ws2.id)).not.toContain('Alpha project uses Kubernetes for deployment');
|
||||||
url: '/api/memory/search?q=Kubernetes&scope=workspace',
|
expect(await searchTexts(server, 'Docker', 'workspace', ws2.id)).toContain('Beta project uses Docker Compose locally');
|
||||||
});
|
expect(await searchTexts(server, 'Docker', 'workspace', ws1.id)).not.toContain('Beta project uses Docker Compose locally');
|
||||||
expect(searchA.statusCode).toBe(200);
|
|
||||||
const resultsA = JSON.parse(searchA.payload);
|
|
||||||
expect(resultsA.count).toBeGreaterThan(0);
|
|
||||||
|
|
||||||
// Switch to ws-B — search should NOT find ws-A's memory
|
|
||||||
server.multiMind.switchWorkspace(mind2Path);
|
|
||||||
const searchB = await injectWithAuth(server, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/memory/search?q=Kubernetes&scope=workspace',
|
|
||||||
});
|
|
||||||
expect(searchB.statusCode).toBe(200);
|
|
||||||
const resultsB = JSON.parse(searchB.payload);
|
|
||||||
expect(resultsB.count).toBe(0);
|
|
||||||
|
|
||||||
// Store different memory in ws-B
|
|
||||||
const wsBSessions = new SessionStore(server.multiMind.workspace!);
|
|
||||||
const wsBSession = wsBSessions.create();
|
|
||||||
const wsBFrames = new FrameStore(server.multiMind.workspace!);
|
|
||||||
wsBFrames.createIFrame(wsBSession.gop_id, 'Beta project uses Docker Compose locally');
|
|
||||||
|
|
||||||
// ws-B should find Docker but not Kubernetes
|
|
||||||
const searchB2 = await injectWithAuth(server, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/memory/search?q=Docker&scope=workspace',
|
|
||||||
});
|
|
||||||
expect(searchB2.statusCode).toBe(200);
|
|
||||||
expect(JSON.parse(searchB2.payload).count).toBeGreaterThan(0);
|
|
||||||
|
|
||||||
// Switch back to ws-A — should find Kubernetes, not Docker
|
|
||||||
server.multiMind.switchWorkspace(mind1Path);
|
|
||||||
const searchA2 = await injectWithAuth(server, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/memory/search?q=Kubernetes&scope=workspace',
|
|
||||||
});
|
|
||||||
expect(searchA2.statusCode).toBe(200);
|
|
||||||
expect(JSON.parse(searchA2.payload).count).toBeGreaterThan(0);
|
|
||||||
|
|
||||||
const searchA3 = await injectWithAuth(server, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/memory/search?q=Docker&scope=workspace',
|
|
||||||
});
|
|
||||||
expect(searchA3.statusCode).toBe(200);
|
|
||||||
expect(JSON.parse(searchA3.payload).count).toBe(0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Scenario 6: Memory search returns results from correct mind only
|
// Scenario 6: Memory search returns results from correct mind only
|
||||||
@@ -184,63 +142,23 @@ describe('Workspaces & Sessions E2E', () => {
|
|||||||
const { server } = await startService({ dataDir, port, skipLiteLLM: true });
|
const { server } = await startService({ dataDir, port, skipLiteLLM: true });
|
||||||
servers.push(server);
|
servers.push(server);
|
||||||
|
|
||||||
// Store a memory in the personal mind — need a session first (FK constraint)
|
await server.memory.remember({ scope: PERSONAL_SCOPE, text: 'Waggle architecture uses Tauri with React frontend' });
|
||||||
const personalSessions = new SessionStore(server.multiMind.personal);
|
|
||||||
const pSession = personalSessions.create();
|
|
||||||
const personalFrames = new FrameStore(server.multiMind.personal);
|
|
||||||
personalFrames.createIFrame(pSession.gop_id, 'Waggle architecture uses Tauri with React frontend');
|
|
||||||
|
|
||||||
// Create a workspace and store memory in its mind
|
|
||||||
const createRes = await injectWithAuth(server, {
|
const createRes = await injectWithAuth(server, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/workspaces',
|
url: '/api/workspaces',
|
||||||
payload: { name: 'Research', group: 'Study' },
|
payload: { name: 'Research', group: 'Study' },
|
||||||
});
|
});
|
||||||
const ws = JSON.parse(createRes.payload);
|
const ws = JSON.parse(createRes.payload);
|
||||||
|
await server.memory.remember({ scope: workspaceScope(ws.id), text: 'GraphContext uses SHACL validation for knowledge graphs' });
|
||||||
|
|
||||||
// Switch multiMind to workspace so workspace search works
|
expect(await searchTexts(server, 'Tauri', 'personal')).toContain('Waggle architecture uses Tauri with React frontend');
|
||||||
const wsMindPath = path.join(dataDir, 'workspaces', ws.id, 'workspace.mind');
|
expect(await searchTexts(server, 'SHACL', 'workspace', ws.id)).toContain('GraphContext uses SHACL validation for knowledge graphs');
|
||||||
server.multiMind.switchWorkspace(wsMindPath);
|
// Personal search never returns workspace-only memories.
|
||||||
|
expect(await searchTexts(server, 'SHACL', 'personal')).not.toContain('GraphContext uses SHACL validation for knowledge graphs');
|
||||||
// Store memory in workspace mind — need a session first (FK constraint)
|
// 'all' covers personal memory plus the named workspace.
|
||||||
const wsSessions = new SessionStore(server.multiMind.workspace!);
|
const all = await searchTexts(server, 'architecture', 'all', ws.id);
|
||||||
const wSession = wsSessions.create();
|
expect(all.length).toBeGreaterThanOrEqual(1);
|
||||||
const wsFrames = new FrameStore(server.multiMind.workspace!);
|
|
||||||
wsFrames.createIFrame(wSession.gop_id, 'GraphContext uses SHACL validation for knowledge graphs');
|
|
||||||
|
|
||||||
// Search personal scope — should find "Tauri" but not "SHACL"
|
|
||||||
const personalSearch = await injectWithAuth(server, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/memory/search?q=Tauri&scope=personal',
|
|
||||||
});
|
|
||||||
expect(personalSearch.statusCode).toBe(200);
|
|
||||||
const personalResults = JSON.parse(personalSearch.payload);
|
|
||||||
expect(personalResults.count).toBeGreaterThan(0);
|
|
||||||
|
|
||||||
// Search workspace scope — should find "SHACL" but not "Tauri"
|
|
||||||
const wsSearch = await injectWithAuth(server, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/memory/search?q=SHACL&scope=workspace',
|
|
||||||
});
|
|
||||||
expect(wsSearch.statusCode).toBe(200);
|
|
||||||
const wsResults = JSON.parse(wsSearch.payload);
|
|
||||||
expect(wsResults.count).toBeGreaterThan(0);
|
|
||||||
|
|
||||||
// Cross-check: personal scope should NOT find workspace-only content
|
|
||||||
const crossCheck = await injectWithAuth(server, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/memory/search?q=SHACL&scope=personal',
|
|
||||||
});
|
|
||||||
const crossResults = JSON.parse(crossCheck.payload);
|
|
||||||
expect(crossResults.count).toBe(0);
|
|
||||||
|
|
||||||
// Search all scope — should find both
|
|
||||||
const allSearch = await injectWithAuth(server, {
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/memory/search?q=architecture&scope=all',
|
|
||||||
});
|
|
||||||
const allResults = JSON.parse(allSearch.payload);
|
|
||||||
expect(allResults.count).toBeGreaterThanOrEqual(1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Scenario 8: Session CRUD — create, list, rename (switch), delete
|
// Scenario 8: Session CRUD — create, list, rename (switch), delete
|
||||||
|
|||||||
@@ -231,6 +231,26 @@ describe('managed Ollama supply-chain manifest', () => {
|
|||||||
targetSha256: '14462bd438815eb2c1d4c61224744637131ab744e858a2e2562e7fc7fc2c4f7d',
|
targetSha256: '14462bd438815eb2c1d4c61224744637131ab744e858a2e2562e7fc7fc2c4f7d',
|
||||||
targetSizeBytes: 145_790_989,
|
targetSizeBytes: 145_790_989,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
platform: 'linux',
|
||||||
|
arch: 'x64',
|
||||||
|
filename: 'ollama-linux-amd64.tar.zst',
|
||||||
|
executableName: 'ollama',
|
||||||
|
rollbackSha256: '56362d7609dfa9e35aaebb7c9cab25605d8f0528ec3d5d585dc83d6642002bab',
|
||||||
|
rollbackSizeBytes: 1_436_128_693,
|
||||||
|
targetSha256: '2597d74fbe654ef6a37db56f771cf37d4a85c6bde4018127874e3927d3113800',
|
||||||
|
targetSizeBytes: 1_421_853_873,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
platform: 'linux',
|
||||||
|
arch: 'arm64',
|
||||||
|
filename: 'ollama-linux-arm64.tar.zst',
|
||||||
|
executableName: 'ollama',
|
||||||
|
rollbackSha256: '2c1fbc47a5351c74f5400d7e4b1104bb470291af5d2f425c37c151487a477ad6',
|
||||||
|
rollbackSizeBytes: 1_556_234_636,
|
||||||
|
targetSha256: '61af0def977ffc9e76cc961f9505d621805653c63f444796de2f77b4eaaa7047',
|
||||||
|
targetSizeBytes: 1_542_500_407,
|
||||||
|
},
|
||||||
] as const;
|
] as const;
|
||||||
expect(OLLAMA_RUNTIME_ARTIFACTS).toHaveLength(supportedTargets.length * 2);
|
expect(OLLAMA_RUNTIME_ARTIFACTS).toHaveLength(supportedTargets.length * 2);
|
||||||
expect(new Set(OLLAMA_RUNTIME_ARTIFACTS.map(
|
expect(new Set(OLLAMA_RUNTIME_ARTIFACTS.map(
|
||||||
@@ -262,7 +282,7 @@ describe('managed Ollama supply-chain manifest', () => {
|
|||||||
sizeBytes: supported.targetSizeBytes,
|
sizeBytes: supported.targetSizeBytes,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
expect(resolveOllamaRuntimeArtifact('linux', 'x64')).toBeNull();
|
expect(resolveOllamaRuntimeArtifact('freebsd', 'x64')).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('binds the managed daemon to loopback and isolates its model store', () => {
|
it('binds the managed daemon to loopback and isolates its model store', () => {
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ export default defineConfig({
|
|||||||
'packages/hive-mind-*/**', 'packages/memory-mcp/**', 'packages/wiki-compiler/**',
|
'packages/hive-mind-*/**', 'packages/memory-mcp/**', 'packages/wiki-compiler/**',
|
||||||
'packages/team-server/**', 'packages/waggle-dance/**', 'packages/worker/**',
|
'packages/team-server/**', 'packages/waggle-dance/**', 'packages/worker/**',
|
||||||
'packages/weaver/**',
|
'packages/weaver/**',
|
||||||
|
// Tests of those packages kept outside them; they go with the packages (P2.2).
|
||||||
|
'packages/agent/tests/hook-packages-runtime.test.ts',
|
||||||
|
'tests/mcp-context-profile-security.test.ts',
|
||||||
|
'tests/mcp-import-path-security.test.ts',
|
||||||
|
'tests/mcp-save-memory-security.test.ts',
|
||||||
|
'tests/oss-subtree-split.test.ts',
|
||||||
...INFRA_TEST_SUITES,
|
...INFRA_TEST_SUITES,
|
||||||
// Copies the ~13MB pre-built packages/marketplace/marketplace.db fixture
|
// Copies the ~13MB pre-built packages/marketplace/marketplace.db fixture
|
||||||
// (createTempDb). Proper fix: regenerate it from sources-seed.ts in test
|
// (createTempDb). Proper fix: regenerate it from sources-seed.ts in test
|
||||||
|
|||||||
Reference in New Issue
Block a user