mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-25 06:36:49 +09:00
fix(metaharness): 5 smoke contract failures (iter 124)
5 metaharness smoke contracts had grown out of sync with the source.
Local + CI smoke now goes 119/0 (was 5/120 failing).
(1) 17i — audit-trend severity rank grep was stale
Old check: literal `SEVERITY_RANK = { clean: 0, low: 1, medium: 2, high: 3 }`
But iter 63 refactored to shared `import { SEVERITY_RANK } from './_harness.mjs'`.
Updated grep to accept either form.
(2) 17z — ADR-152 §3.1 oia-audit fingerprint grep was stale
Old check: `score = runOne(['score'` / `genome = runOne(['genome'`
But iter 56 parallelized to `runMetaharnessAsync(['score', path])`.
Updated grep to accept either form.
(3) 17z14 — roundtrip Stage 7 hardcoded the assertion count
Old check: `node test-pipeline-roundtrip.mjs | grep "31 passed, 0 failed"`
But stages have been added since iter-51; count is now 66.
Updated to gate on "≥ 31 passed AND 0 failed" — no failures + floor.
(4) 17z6 — test-mcp-tools.mjs metaharness_audit_list intermittent 30s timeout
The first MCP tool that shells out via npx pays the cold-cache warmup
(~25s observed); 30s was tight. Bumped default per-tool timeout 30s
→ 60s (chain-tools like drift_from_history stay at 90s).
(5) test-mcp-tools.mjs mcp_scan first-finding message string
Upstream metaharness@0.1.x JSON path emits {id, severity, title, detail};
our parseMcpScanText emits {severity, message}. The test asserted
`message` only. Normalized both paths in mcp-scan.mjs to a unified
shape: {severity, message, title?, detail?} where `message` falls
back to `title || detail || ''` when the upstream path doesn't
supply one. Downstream consumers (audit-trend fingerprint diff,
test-mcp-tools assertions) now don't care which parser ran.
Local smoke runs: was 115/5, now 119/0 (and counts will grow further
as stages get added — the assertion-count floor protects against
regressions, the literal exact-match did not).
Co-Authored-By: RuFlo <ruv@ruv.net>
This commit is contained in:
1 parent
b76afb2e7a
commit
0215e7b633
3 files changed
+38
-11
No files matched your search
@@ -53,13 +53,24 @@ function main() {
|
||||
// diff actually works. If a future upstream version DOES emit
|
||||
// findings[], the parsed-text findings are overridden.
|
||||
const parsed = parseMcpScanText(r.stdout);
|
||||
// iter 124 — normalize finding shape so consumers see a stable contract.
|
||||
// Upstream metaharness@0.1.x JSON path emits {id, severity, title, detail};
|
||||
// our parseMcpScanText emits {severity, message}. Project both into a
|
||||
// unified {severity, message, title?, detail?} so audit-trend's fingerprint
|
||||
// diff and test-mcp-tools' assertions don't care which path produced them.
|
||||
const rawFindings = Array.isArray(r.json?.findings) ? r.json.findings : parsed.findings;
|
||||
const findings = rawFindings.map((f) => ({
|
||||
...f,
|
||||
message: typeof f.message === 'string' && f.message
|
||||
? f.message
|
||||
: (f.title || f.detail || ''),
|
||||
}));
|
||||
const payload = {
|
||||
...(r.json ?? {}),
|
||||
findings: Array.isArray(r.json?.findings) ? r.json.findings : parsed.findings,
|
||||
findings,
|
||||
summary: r.json?.summary ?? parsed.summary,
|
||||
rawStdout: r.stdout.slice(0, 400),
|
||||
};
|
||||
const findings = payload.findings;
|
||||
const threshold = SEVERITY_RANK[ARGS.failOn];
|
||||
// iter 63 — rankSeverity() safe lookup. Pre-iter-63 `undefined >= 3`
|
||||
// was false → unknown-severity findings (e.g., warn / error) were
|
||||
|
||||
@@ -1502,8 +1502,14 @@ grep -q "iter-51-marker" "$F" 2>/dev/null || miss="$miss no-jaccard-mutation"
|
||||
grep -q "drift detected — verdict !== near-identical" "$F" 2>/dev/null || miss="$miss no-verdict-flip"
|
||||
grep -q "drift detected — distance > 0" "$F" 2>/dev/null || miss="$miss no-distance-positive"
|
||||
grep -q "drift alert at threshold" "$F" 2>/dev/null || miss="$miss no-drift-alert"
|
||||
# Runtime: 31/31 (was 25/25 pre-iter-51)
|
||||
node "$F" 2>&1 | grep -q "31 passed, 0 failed" || miss="$miss roundtrip-not-31"
|
||||
# Runtime: assertion count has grown as stages added (was 25→31→… → 66 at
|
||||
# iter 79). Smoke gates on "0 failed" with a passed count ≥ 31, not the
|
||||
# specific number — keeps the gate from breaking every time a new stage
|
||||
# adds assertions.
|
||||
ROUNDTRIP_OUT=$(node "$F" 2>&1)
|
||||
echo "$ROUNDTRIP_OUT" | grep -qE "^[0-9]+ passed, 0 failed$" || miss="$miss roundtrip-has-failures"
|
||||
ROUNDTRIP_COUNT=$(echo "$ROUNDTRIP_OUT" | grep -oE "^[0-9]+ passed" | grep -oE "[0-9]+" | head -1)
|
||||
[[ "${ROUNDTRIP_COUNT:-0}" -ge 31 ]] || miss="$miss roundtrip-count-regressed:$ROUNDTRIP_COUNT"
|
||||
[[ -z "$miss" ]] && ok || bad "$miss"
|
||||
|
||||
step "17z13. mcp-scan findings parsed from text → audit-trend diff works (iter 50)"
|
||||
@@ -1720,10 +1726,15 @@ node "$F" >/dev/null 2>&1 || miss="$miss unit-tests-fail"
|
||||
|
||||
step "17z. ADR-152 §3.1 deep integration — oia-audit fingerprint + audit-trend structuralDistance (iter 38)"
|
||||
miss=""
|
||||
# oia-audit captures score + genome AND surfaces a fingerprint{score,genome}
|
||||
# oia-audit captures score + genome AND surfaces a fingerprint{score,genome}.
|
||||
# iter 56 refactored sequential runOne(...) → parallel
|
||||
# runMetaharnessAsync(['score'/'genome', path]); accept either form so smoke
|
||||
# survives the refactor.
|
||||
OIA="$ROOT/scripts/oia-audit.mjs"
|
||||
grep -q "score = runOne(\['score'" "$OIA" 2>/dev/null || miss="$miss no-score-capture"
|
||||
grep -q "genome = runOne(\['genome'" "$OIA" 2>/dev/null || miss="$miss no-genome-capture"
|
||||
grep -qE "score = runOne\\(\\['score'|runMetaharnessAsync\\(\\['score', path\\]\\)" "$OIA" 2>/dev/null \
|
||||
|| miss="$miss no-score-capture"
|
||||
grep -qE "genome = runOne\\(\\['genome'|runMetaharnessAsync\\(\\['genome', path\\]\\)" "$OIA" 2>/dev/null \
|
||||
|| miss="$miss no-genome-capture"
|
||||
grep -q "fingerprint: {" "$OIA" 2>/dev/null || miss="$miss no-fingerprint-field"
|
||||
# audit-trend imports the production similarity module and surfaces a verdict
|
||||
AT="$ROOT/scripts/audit-trend.mjs"
|
||||
@@ -2075,8 +2086,10 @@ F="$ROOT/scripts/audit-trend.mjs"
|
||||
miss=""
|
||||
[[ -x "$F" ]] || miss="$miss not-executable"
|
||||
node --check "$F" 2>/dev/null || miss="$miss syntax-error"
|
||||
# Severity rank present + correct ordering
|
||||
grep -q "SEVERITY_RANK = { clean: 0, low: 1, medium: 2, high: 3 }" "$F" || miss="$miss no-severity-rank"
|
||||
# Severity rank present + correct ordering — iter 63 refactored to shared
|
||||
# SEVERITY_RANK from _harness.mjs; accept either the import OR the literal.
|
||||
grep -qE "SEVERITY_RANK.*from.*_harness|SEVERITY_RANK = \{ clean: 0, low: 1, medium: 2, high: 3 \}" "$F" \
|
||||
|| miss="$miss no-severity-rank"
|
||||
# Both file-input AND memory-key-input paths
|
||||
grep -q "baseline-key\|baselineKey" "$F" || miss="$miss no-mem-key-input"
|
||||
grep -q "current-key\|currentKey" "$F" || miss="$miss no-current-key"
|
||||
|
||||
@@ -135,8 +135,11 @@ async function main() {
|
||||
input = { dryRun: true, threshold: 0.5 };
|
||||
}
|
||||
|
||||
// 30s budget per tool by default; 90s for chain-tools like drift_from_history.
|
||||
const timeoutMs = tool.name === 'metaharness_drift_from_history' ? 90_000 : 30_000;
|
||||
// iter 124 — bumped default 30s → 60s. The first MCP tool that shells
|
||||
// out via npx pays the cold-cache warmup cost (~25s observed), which
|
||||
// pushed metaharness_audit_list past the prior 30s budget intermittently.
|
||||
// 90s for chain-tools like drift_from_history that compose 3 subprocesses.
|
||||
const timeoutMs = tool.name === 'metaharness_drift_from_history' ? 90_000 : 60_000;
|
||||
const handlerPromise = tool.handler(input);
|
||||
const timeoutPromise = new Promise((_, reject) =>
|
||||
setTimeout(() => reject(new Error(`${timeoutMs / 1000}s handler timeout`)), timeoutMs));
|
||||
|
||||
Reference in new issue
Block a user