diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh index 8f7aa33f6b..7dde2683b7 100755 --- a/plugins/ruflo-metaharness/scripts/smoke.sh +++ b/plugins/ruflo-metaharness/scripts/smoke.sh @@ -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 diff --git a/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs b/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs index 6162c694f4..6badf0a17d 100755 --- a/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs +++ b/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs @@ -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,