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(metaharness): roundtrip exercises drift-from-history end-to-end (iter 68)

ruva5540a0dba86
diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh
index 25c2a04b57..45d307076f 100755
--- a/plugins/ruflo-metaharness/scripts/smoke.sh
+++ b/plugins/ruflo-metaharness/scripts/smoke.sh
@@ -191,6 +191,19 @@ grep -q "execCli(\[\s*'-y'\s*,\s*'metaharness@latest'" "$F" 2>/dev/null || \
grep -q "cwd: opts" "$F" || miss="$miss no-cwd-passthrough"
[[ -z "$miss" ]] && ok || bad "$miss"
+step "17z31. roundtrip Stage 8 β€” drift-from-history end-to-end (iter 68)"
+miss=""
+F="$ROOT/scripts/test-pipeline-roundtrip.mjs"
+grep -q "Stage 8 β€” drift-from-history end-to-end" "$F" 2>/dev/null || miss="$miss no-stage-8"
+grep -q "drift-from-history --baseline-file β†’ skippedAuditList === true" "$F" 2>/dev/null || miss="$miss no-iter66-assert"
+grep -q "drift-from-history --baseline-file β†’ usedBaselineFile === true" "$F" 2>/dev/null || miss="$miss no-iter67-assert"
+grep -q "fastpath wall < 30s" "$F" 2>/dev/null || miss="$miss no-wall-budget"
+grep -q "drift-from-history self-match overall === 1" "$F" 2>/dev/null || miss="$miss no-self-match-assert"
+grep -q "alert NOT triggered at default threshold" "$F" 2>/dev/null || miss="$miss no-alert-not-fired"
+# Runtime: roundtrip passes (β‰₯38 β€” iter 68 took it from 31, future iters keep climbing)
+node "$F" 2>&1 | grep -qE "(3[8-9]|[4-9][0-9]+) passed, 0 failed" || miss="$miss roundtrip-fewer-than-38"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
step "17z30. drift-from-history --baseline-file fastest-path (iter 67)"
miss=""
F="$ROOT/scripts/drift-from-history.mjs"
diff --git a/plugins/ruflo-metaharness/scripts/test-pipeline-roundtrip.mjs b/plugins/ruflo-metaharness/scripts/test-pipeline-roundtrip.mjs
index 5e69096bd7..23754f53a5 100755
--- a/plugins/ruflo-metaharness/scripts/test-pipeline-roundtrip.mjs
+++ b/plugins/ruflo-metaharness/scripts/test-pipeline-roundtrip.mjs
@@ -304,6 +304,42 @@ try {
assert(trend.delta?.findings?.clearedCount === 0,
`self-roundtrip clearedCount === 0 (got ${trend.delta?.findings?.clearedCount})`);
+ // ──────────────────────────────────────────────────────────────
+ // STAGE 8 (iter 68) β€” drift-from-history end-to-end via --baseline-file
+ //
+ // Every prior stage tested audit-trend (the underlying primitive).
+ // None tested drift-from-history (the iter-53 user-facing wrapper).
+ // This stage runs the iter-67 fastest path: baseline from a file,
+ // skipping audit-list AND memory roundtrip entirely.
+ // ──────────────────────────────────────────────────────────────
+ console.log('\nStage 8 β€” drift-from-history end-to-end (iter 68)');
+ const driftFromHistoryRun = runNode('drift-from-history.mjs', [
+ '--baseline-file', basePath,
+ '--dry-run',
+ '--format', 'json',
+ ], 120_000);
+ const driftFromHistoryMatch = /\{[\s\S]*\}/.exec(driftFromHistoryRun.stdout);
+ assert(driftFromHistoryMatch !== null, 'drift-from-history produced JSON');
+ const dfh = JSON.parse(driftFromHistoryMatch[0]);
+
+ // Iter-66/iter-67 contract: the fastest-path flags are surfaced in timing
+ assert(dfh.timing?.skippedAuditList === true,
+ 'drift-from-history --baseline-file β†’ skippedAuditList === true (iter 66)');
+ assert(dfh.timing?.usedBaselineFile === true,
+ 'drift-from-history --baseline-file β†’ usedBaselineFile === true (iter 67)');
+ // Wall-clock fastpath proof: must be under 30s with file inputs
+ // (vs ~26s minimum for the audit-list-loading slow path)
+ assert(typeof dfh.timing?.parallelWallMs === 'number' && dfh.timing.parallelWallMs < 30000,
+ `drift-from-history fastpath wall < 30s (got ${dfh.timing?.parallelWallMs}ms)`);
+ // Same-file self-match β†’ similarity 1.0
+ assert(dfh.drift?.structuralDistance?.overall === 1,
+ `drift-from-history self-match overall === 1 (got ${dfh.drift?.structuralDistance?.overall})`);
+ assert(dfh.drift?.structuralDistance?.verdict === 'near-identical',
+ `drift-from-history self-match verdict === near-identical (got ${dfh.drift?.structuralDistance?.verdict})`);
+ // Alert chain end-to-end
+ assert(dfh.alert?.triggered === false,
+ 'drift-from-history self-match alert NOT triggered at default threshold (0.95)');
+
} finally {
try { rmSync(tmp, { recursive: true, force: true }); } catch { /* ignore */ }
}