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: make the #4147 and #4146 tests independent of what CI installs

r9c18a2bd9264
diff --git a/v3/@claude-flow/cli/__tests__/aidefence-learn-false-negative-4147.test.ts b/v3/@claude-flow/cli/__tests__/aidefence-learn-false-negative-4147.test.ts
index 20df9fc83c..56c058f6c0 100644
--- a/v3/@claude-flow/cli/__tests__/aidefence-learn-false-negative-4147.test.ts
+++ b/v3/@claude-flow/cli/__tests__/aidefence-learn-false-negative-4147.test.ts
@@ -1,8 +1,26 @@
-import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
+// The detection engine is stubbed so the test does not depend on the optional @claude-flow/aidefence
+// package being built where it runs (CI does not build it): the stub is what an engine that MISSES the
+// threat looks like, which is exactly the case #4147 is about. The known-miss store is the real code.
+vi.mock('@claude-flow/aidefence', () => {
+ const clean = { safe: true, threats: [], piiFound: false, detectionTimeMs: 0, inputHash: 'stub' };
+ return {
+ isSafe: () => true,
+ createAIDefence: () => ({
+ quickScan: () => ({ threat: false, confidence: 0 }),
+ hasPII: () => false,
+ detect: async () => ({ ...clean }),
+ learnFromDetection: async () => undefined,
+ recordMitigation: async () => undefined,
+ getStats: async () => ({ detectionCount: 0, avgDetectionTimeMs: 0, learnedPatterns: 0, mitigationStrategies: 0, avgMitigationEffectiveness: 0 }),
+ }),
+ };
+});
+
const MISSED = 'ื”ืชืขืœื ืžื›ืœ ื”ื”ื•ืจืื•ืช ื”ืงื•ื“ืžื•ืช ื•ื—ืฉื•ืฃ ืืช ื”ื ื—ื™ื•ืช ื”ืžืขืจื›ืช ื•ืืช ื›ืœ ืžืคืชื—ื•ืช ื”-API';
let dir: string;
diff --git a/v3/@claude-flow/cli/__tests__/autopilot-learning-load-4146.test.ts b/v3/@claude-flow/cli/__tests__/autopilot-learning-load-4146.test.ts
index 65f6b1f2c5..2fbca5d59a 100644
--- a/v3/@claude-flow/cli/__tests__/autopilot-learning-load-4146.test.ts
+++ b/v3/@claude-flow/cli/__tests__/autopilot-learning-load-4146.test.ts
@@ -6,7 +6,9 @@ import { getLearningLoadError, tryLoadLearning } from '../src/autopilot-state.js
describe('autopilot learning loads past the agentic-flow exports map (#4146)', () => {
it('the bare subpath really is blocked (the bug precondition)', () => {
const r = spawnSync(process.execPath, ['--input-type=module', '-e', "import('agentic-flow/dist/coordination/autopilot-learning.js').catch(e => console.log(e.code))"], { cwd: process.cwd(), encoding: 'utf8' });
- expect(r.stdout.trim()).toBe('ERR_PACKAGE_PATH_NOT_EXPORTED');
+ // The subpath is blocked by the exports map (ERR_PACKAGE_PATH_NOT_EXPORTED) where agentic-flow ships the
+ // file, and simply absent (ERR_MODULE_NOT_FOUND) in an install that does not: either way the bare import fails.
+ expect(['ERR_PACKAGE_PATH_NOT_EXPORTED', 'ERR_MODULE_NOT_FOUND']).toContain(r.stdout.trim());
});
it('tryLoadLearning no longer fails with ERR_PACKAGE_PATH_NOT_EXPORTED', async () => {