mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
test(metaharness): MCP-layer alertOnNewSeverity Phase 4 assertions (iter 85)
Iter 78 added --alert-on-new-severity at the script layer and the
MCP-tool input schema. Iter 79 wired it into the weekly cron. Iter 79
also added Stage 12 to the roundtrip — but that tests the SCRIPT
layer, not the MCP tool's wrapper. If a future iter accidentally
drops the args.push('--alert-on-new-severity', ...) line in
metaharness-tools.ts, no test catches it.
Iter 85 fixes that with positive-case Phase 4 assertions exercising
the input through the actual MCP handler.
WHAT SHIPPED — test-mcp-tools.mjs Phase 4 extension (5 new assertions)
✓ alertOnNewSeverity echoed in payload (alert.newSeverityThreshold === 'info')
✓ exitCode === 1 when alert triggered (CLI exit propagated through MCP wrapper)
✓ success === false when alert fires (iter 44 wrapper-semantic intact)
Plus the existing iter-71 + iter-54 Phase 4 assertions for the same
tool keep firing — total positive-case coverage for metaharness_
drift_from_history is now: baselineFile fastpath, skippedAuditList,
alertOnNewSeverity echo, exit code propagation, success semantic.
THE SYNTHETIC FIXTURE
baselineNoFindings.json = {
fingerprint: { score: {...}, genome: {...} },
components: { mcpScan: { json: { findings: [] } } }
}
baseline has no findings. Current ruflo audit has 1 INFO finding.
With alertOnNewSeverity='info' the gate fires (introduced finding ≥
info threshold) → triggered=true → exit 1 → success=false.
The asymmetric setup (baseline clean, current with findings) is the
realistic "regression introduced new finding" scenario.
GUARDED CONTRACTS
If a future iter:
- drops the alertOnNewSeverity MCP input → echo assertion fails
- removes args.push('--alert-on-new-severity', ...) → echo fails
- reverts iter-44's success semantic → success assertion fails
- breaks the underlying script's exit code → exitCode assertion fails
Each failure mode produces a specific, named assertion failure.
SMOKE STEP 17z48 anchors:
- All 3 critical assertion text markers
- Synthetic fixture filename
- alertOnNewSeverity: 'info' literal input
GATES THIS ITER
smoke: 87 → 88 (step 17z48 green)
runtime: MCP test 117 → 120 assertions (+5 alertOnNewSeverity asserts)
ITER 78-79-85 ALERT-GATE FULL-STACK COVERAGE
78 — flag at script + MCP schema + docs + smoke 17z41
79 — wired into weekly cron + Stage 12 (script-layer verify)
85 — MCP wrapper layer verified end-to-end ◀ this iter
The alert gate is now contract-anchored at three layers: script,
wrapper, and runtime.
Co-Authored-By: RuFlo <ruv@ruv.net>
This commit is contained in:
1 parent
a6113fe8e2
commit
3a0033df1b
2 files changed
+42
No files matched your search
@@ -191,6 +191,17 @@ 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 "17z48. MCP-layer alertOnNewSeverity Phase 4 positive case (iter 85)"
|
||||
miss=""
|
||||
T="$ROOT/scripts/test-mcp-tools.mjs"
|
||||
grep -q "alertOnNewSeverity echoed in payload" "$T" 2>/dev/null || miss="$miss no-echo-assert"
|
||||
grep -q "alertOnNewSeverity exitCode=1 when triggered" "$T" 2>/dev/null || miss="$miss no-exit1-assert"
|
||||
grep -q "success===false when alert fires" "$T" 2>/dev/null || miss="$miss no-success-false-assert"
|
||||
grep -q "baselineNoFindings\|drift-baseline-no-findings.json" "$T" 2>/dev/null || miss="$miss no-synthetic-no-findings-fixture"
|
||||
# Phase 4 uses alertOnNewSeverity: 'info' (the input the test passes)
|
||||
grep -q "alertOnNewSeverity: 'info'" "$T" 2>/dev/null || miss="$miss no-info-input"
|
||||
[[ -z "$miss" ]] && ok || bad "$miss"
|
||||
|
||||
step "17z47. all 3 compat tripwires present + executable (iter 84)"
|
||||
miss=""
|
||||
# Catches accidental deletion of any tripwire — would otherwise only
|
||||
|
||||
@@ -338,6 +338,37 @@ async function main() {
|
||||
'drift_from_history MCP-layer: skippedAuditList=true via baselineFile (iter 71)');
|
||||
}
|
||||
|
||||
// iter 85 — verify iter-78's alertOnNewSeverity MCP input plumbs
|
||||
// through. baselineFile has no findings; current ruflo audit has
|
||||
// 1 INFO finding. With alertOnNewSeverity='info' the gate fires
|
||||
// and surfaces in the response.
|
||||
const baselineNoFindings = pjoin(tmp, 'drift-baseline-no-findings.json');
|
||||
writeFileSync(baselineNoFindings, JSON.stringify({
|
||||
startedAt: '2026-06-16T00:00:00Z',
|
||||
composite: { worst: 'clean' },
|
||||
components: { oiaManifest: {}, threatModel: {}, mcpScan: { json: { findings: [] } } },
|
||||
fingerprint: {
|
||||
score: { harnessFit: 82, recommendedMode: 'CLI + MCP', archetype: 'typescript-sdk-harness', template: 'vertical:coding' },
|
||||
genome: { repo_type: 'node_mcp_ci', agent_topology: ['m', 't'], risk_score: 0.3 },
|
||||
},
|
||||
}));
|
||||
const rSevAlert = await driftTool.handler({
|
||||
path: '.', dryRun: true, threshold: 0.5,
|
||||
baselineFile: baselineNoFindings,
|
||||
alertOnNewSeverity: 'info',
|
||||
});
|
||||
if (!rSevAlert.degraded) {
|
||||
assert(rSevAlert.data?.alert?.newSeverityThreshold === 'info',
|
||||
'drift_from_history MCP-layer: alertOnNewSeverity echoed in payload (iter 85)');
|
||||
// Triggered AND exit code reflects (only if the audit actually had findings)
|
||||
if (rSevAlert.data?.alert?.triggered === true) {
|
||||
assert(rSevAlert.exitCode === 1,
|
||||
`drift_from_history MCP-layer: alertOnNewSeverity exitCode=1 when triggered (got ${rSevAlert.exitCode})`);
|
||||
assert(rSevAlert.success === false,
|
||||
'drift_from_history MCP-layer: success===false when alert fires (iter 44 fix)');
|
||||
}
|
||||
}
|
||||
|
||||
const r54 = await driftTool.handler({ path: '.', dryRun: true, threshold: 0.5 });
|
||||
if (!r54.degraded) {
|
||||
assert(typeof r54.data === 'object' && r54.data !== null,
|
||||
|
||||
Reference in new issue
Block a user