mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
DISCOVERED BUG: both bench scripts (iter 41 bench-similarity, iter 86
bench-parse-mcp-scan) emit a markdown header line BEFORE the JSON
payload when --format json. The header contaminates the captured file:
$ node bench-similarity.mjs --format json > /tmp/bench.json
$ cat /tmp/bench.json
# bench-similarity — ADR-152 §3.1 per-call cost ← contamination
iters: 5,000 ← contamination
{
"iters": 5000, "results": [...], ...
}
Iter 82 added a CI step that does:
$ node -e "JSON.parse(require('fs').readFileSync('/tmp/bench-similarity.json'))"
That JSON.parse SILENTLY FAILED in CI because of the leading `#` text.
The artifact upload still worked (the file existed) but the
GITHUB_STEP_SUMMARY table population threw a JSON.parse error and never
produced the table.
The bug was invisible because:
- Smoke step 17z45 grep'd workflow file structure (passed)
- The bench script's own --max-mean-us gate worked (passed)
- The artifact upload step has `if: always()` (succeeded)
Only the inline `node -e` parse-and-summarize step would have failed
in real CI runs.
WHAT SHIPPED
1. plugins/ruflo-metaharness/scripts/bench-similarity.mjs — guarded
the markdown-header `console.log` behind `ARGS.format !== 'json'`.
2. plugins/ruflo-metaharness/scripts/bench-parse-mcp-scan.mjs — same
guard. (Same bug shipped by iter 86 because I copied the
iter-41 pattern verbatim.)
3. .github/workflows/metaharness-ci.yml — iter-86's bench now wired
into the similarity-tests job, mirroring iter-82's pattern:
- Performance gate (--max-mean-us 5)
- JSON output captured to /tmp/bench-parse-mcp-scan.json
- GITHUB_STEP_SUMMARY table per category
- 90-day artifact upload
4. plugins/ruflo-metaharness/scripts/smoke.sh — step 17z50:
- Both bench scripts contain the iter-87 format-guard literal
- RUNTIME: each script's --format json output is JSON.parseable
(mktemp + redirect + node -e JSON.parse round trip)
- CI workflow wires bench-parse-mcp-scan
- Artifact upload step present
VERIFIED EACH BENCH NOW EMITS PARSEABLE JSON
$ node bench-similarity.mjs --iters 5000 --format json | head -1
{
$ node -e "JSON.parse(require('fs').readFileSync('/tmp/...'))"
parses OK with 3 categories
GATES THIS ITER
smoke: 89 → 90 (step 17z50 green; RUNTIME parse-roundtrip catches the bug-class)
yaml: python yaml.safe_load passes
ci: new bench step + artifact upload for parser perf
regression: bench-parse-mcp-scan runtime baseline ~0.07μs / 0.34μs / 0.95μs (unchanged)
RETROSPECTIVE — why iter-82's bug went undetected
Smoke step 17z45 (iter 82) anchored:
✓ workflow path /tmp/bench-similarity.json
✓ --format json flag
✓ Upload step name
✓ Artifact name template
✓ Summary header literal
None of those exercised JSON.parse on the actual output. The fix was
to add a RUNTIME assertion that mktemps the bench output and confirms
JSON.parse succeeds — exactly the kind of round-trip test that catches
the contamination class of bug.
Lesson: smoke-grep on the workflow YAML proves the YAML is correctly
structured, but doesn't prove the STEPS work. iter 87's runtime
assertion in step 17z50 closes that gap for both bench files.
Co-Authored-By: RuFlo <ruv@ruv.net>