Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

test(session): isolate default snapshot memory fixtures

Rudy Mizrahi Celeklib8bec72c443e
diff --git a/v3/@claude-flow/cli/__tests__/session-save-defaults-r50.test.ts b/v3/@claude-flow/cli/__tests__/session-save-defaults-r50.test.ts
index 7c1480a759..64c1adf3ec 100644
--- a/v3/@claude-flow/cli/__tests__/session-save-defaults-r50.test.ts
+++ b/v3/@claude-flow/cli/__tests__/session-save-defaults-r50.test.ts
@@ -8,14 +8,23 @@ import { sessionTools } from '../src/mcp-tools/session-tools.js';
const save = (input: object) => sessionTools.find(t => t.name === 'session_save')!.handler({ name: 'snapshot', ...input }) as Promise<any>;
beforeEach(() => {
state.cwd = mkdtempSync(join(tmpdir(), 'ruflo-save-defaults-'));
+ // Live memory resolves its DB separately from the mocked MCP project cwd.
+ // Keep both the primary and sibling DB paths inside this owned fixture.
+ vi.stubEnv('CLAUDE_FLOW_DB_PATH', join(state.cwd, '.swarm', 'memory.db'));
+ vi.stubEnv('CLAUDE_FLOW_ENCRYPT_AT_REST', '0');
for (const [kind, data] of Object.entries({ tasks: { tasks: { task1: { taskId: 'task1' } } }, agents: { agents: { agent1: { agentId: 'agent1' } } }, memory: { entries: { key1: { key: 'key1', value: 'value' } } } })) {
const dir = join(state.cwd, '.claude-flow', kind); mkdirSync(dir, { recursive: true }); writeFileSync(join(dir, 'store.json'), JSON.stringify(data));
}
});
-afterEach(() => rmSync(state.cwd, { recursive: true, force: true }));
+afterEach(() => {
+ vi.unstubAllEnvs();
+ rmSync(state.cwd, { recursive: true, force: true });
+});
it('saves existing stores when MCP callers omit include flags', async () => {
const result = await save({});
expect(result.stats).toMatchObject({ tasks: 1, agents: 1, memoryEntries: 1 });
+ expect(result.memoryCapture).toMatchObject({ requested: true, status: 'captured', entries: 1,
+ sources: { memoryDb: 0, agentdb: 0, legacyJson: 1 } });
expect(Object.keys(JSON.parse(readFileSync(result.path, 'utf8')).data).sort()).toEqual(['agents', 'memory', 'tasks']);
});
it.each(['includeTasks', 'includeAgents', 'includeMemory'])('honors explicit false for %s while keeping other stores', async flag => {