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

2.4 KB
Raw Blame

tdd-repair smoke verification β€” 2026-06-22

End-to-end verification of plugins/ruflo-testgen/scripts/tdd-repair/tdd-repair.mjs

  • mcp__claude-flow__testgen_tdd_repair.

Setup

// /tmp/tdd-repair-smoke/add.mjs β€” INTENTIONALLY BUGGY
export function add(a, b) {
  return a - b;        // bug: should be a + b
}
// /tmp/tdd-repair-smoke/add.test.mjs
import { test, expect } from 'vitest';
import { add } from './add.mjs';
test('add(2, 3) === 5',   () => { expect(add(2, 3)).toBe(5);   });
test('add(10, 7) === 17', () => { expect(add(10, 7)).toBe(17); });

Pre-repair

$ npx vitest run add.test.mjs
Test Files  1 failed (1)
     Tests  2 failed (2)

Invocation

node plugins/ruflo-testgen/scripts/tdd-repair/tdd-repair.mjs \
  --repo /tmp/tdd-repair-smoke \
  --test add.test.mjs \
  --test-command "npx vitest run add.test.mjs" \
  --confirm

Headless claude -p spawned with --allowedTools Read,Edit,Bash, --max-budget-usd 5.00, --permission-mode acceptEdits, --model haiku.

Post-repair

// add.mjs β€” AFTER tdd-repair
export function add(a, b) {
  return a + b;        // fixed
}
$ npx vitest run add.test.mjs
Test Files  1 passed (1)
     Tests  2 passed (2)

Receipts

{
  "success": true,
  "data": {
    "repaired": true,
    "attemptsTaken": 1,
    "mode": "test-driven",
    "before": { "passed": false, "exitCode": 1 },
    "after":  { "passed": true,  "exitCode": 0, "durationMs": 367 }
  }
}

What this proves

  • Pre-flight rejects already-passing tests (verified separately by re-running on the fixed source β€” exits 2 with test-already-passes).
  • Headless claude -p invocation with capability-restricted toolset works.
  • The test's exit code IS the fitness function β€” no LLM-as-judge, no separate scorer.
  • The wrapper preserves the user's --test-command verbatim, so any test runner that exits non-zero on failure works (vitest, jest, pytest, go test, cargo test, etc.).

What this does NOT prove

  • Real-world repair success rate on novel bugs (this is a known-trivial bug).
  • Behavior on multi-file refactors.
  • Cost on harder bugs (Haiku at $0 for this trivial fix; real bugs land $0.10–$2.00 in expected range).
  • SWE-Bench Lite end-to-end (requires Docker; out of scope for this smoke).

Next validation step (deferred): once Docker is available, drive against MicroSWE-5 (5 astropy SWE-Bench Lite instances) and persist per-instance receipts.