test(metaharness): positive-presence guard for all 3 compat tripwires (iter 84)

The 3 compat tripwires (router API / mcp-scan text / fingerprint schema)
each protect against silent upstream drift. But until iter 84, only the
CI workflow that RUNS them caught accidental deletion — and only AFTER
the metaharness-real-data job ran (~5 minutes per PR).

A smoke-level positive-presence guard catches deletion in ~50ms.

WHAT SHIPPED

plugins/ruflo-metaharness/scripts/smoke.sh — step 17z47:

  For each of the 3 tripwire scripts:
    ✓ file exists
    ✓ file is executable
    ✓ syntax-parses (node --check)
    ✓ supports --format json (CI-consumable contract)
    ✓ has process.exit(2) graceful-error path

  Plus 3 grep guards that the CI workflow actually invokes each:
    ✓ check-metaharness-compat.mjs referenced in metaharness-ci.yml
    ✓ check-mcp-scan-format.mjs referenced
    ✓ check-fingerprint-schema.mjs referenced

WHAT THIS CATCHES THAT THE EXISTING CI DOESN'T

   Today (pre-iter-84):
     1. Someone deletes scripts/check-mcp-scan-format.mjs
     2. PR opens
     3. PR runs smoke locally → passes (smoke doesn't reference the file)
     4. PR pushed → CI runs
     5. metaharness-real-data job hits the missing-file step → fails
        ~5min into the run
     6. Author scratches head, finds out which file disappeared

   Post-iter-84:
     1. Someone deletes scripts/check-mcp-scan-format.mjs
     2. PR opens
     3. Smoke runs → 17z47 fails IMMEDIATELY with "missing-check-mcp-scan-format.mjs"
     4. Author fixes before push

The smoke gate is ~5min faster + more specific (file name) than the
CI gate.

ITER 60 SMOKE STEP RELAXED

iter-83's ADR update bumped "sixty iterations" → "eighty-two iterations"
and "iters 33-59" → "iters 33-82". iter-60's smoke step 17z23 grep was
hard-coded to those old literals. Relaxed to regex form that accepts
ANY iter range and ANY iteration-count word, so future ADR refreshes
(iter 100, 200, etc.) don't break the iter-60 coverage assertion.

GATES THIS ITER
   smoke:    86 → 87 (step 17z47 green; 17z23 grep relaxed for forward-compat)
   no code changes — pure anti-regression infrastructure

POSITIVE + NEGATIVE GUARD COMPLETION

Negative guards (iter 73-74): "thing X must NOT exist"
Positive guards (iter 84): "thing Y must exist"

Together they form a complete shape-of-codebase contract: the smoke
gate fails iff someone adds something forbidden OR removes something
required.

Co-Authored-By: RuFlo <ruv@ruv.net>
This commit is contained in:
ruv committed 2026-06-16 22:55:58 -04:00
1 parent a4d1878df5
commit a6113fe8e2
1 file changed
+27 -2
+27 -2
View File
@@ -191,6 +191,28 @@ 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 "17z47. all 3 compat tripwires present + executable (iter 84)"
miss=""
# Catches accidental deletion of any tripwire — would otherwise only
# surface in CI after the metaharness-real-data job runs (~5min later).
SCRIPTS_DIR="$ROOT/../../scripts"
for t in check-metaharness-compat.mjs check-mcp-scan-format.mjs check-fingerprint-schema.mjs; do
F="$SCRIPTS_DIR/$t"
[[ -f "$F" ]] || miss="$miss missing-$t"
[[ -x "$F" ]] || miss="$miss not-executable-$t"
node --check "$F" 2>/dev/null || miss="$miss syntax-error-$t"
# Each tripwire must support --format json (CI-consumable contract)
grep -q -- "--format json" "$F" 2>/dev/null || miss="$miss no-format-json-$t"
# Each tripwire must have an exit-2 graceful-error path
grep -q "process.exit(2)" "$F" 2>/dev/null || miss="$miss no-exit-2-$t"
done
# CI workflow runs all 3
W="$ROOT/../../.github/workflows/metaharness-ci.yml"
grep -q "check-metaharness-compat.mjs\|router-compat" "$W" 2>/dev/null || miss="$miss compat-not-in-ci"
grep -q "check-mcp-scan-format.mjs" "$W" 2>/dev/null || miss="$miss mcp-scan-not-in-ci"
grep -q "check-fingerprint-schema.mjs" "$W" 2>/dev/null || miss="$miss fingerprint-not-in-ci"
[[ -z "$miss" ]] && ok || bad "$miss"
step "17z46. ADR-150 notes reflect iters 60-82 (iter 83)"
miss=""
ADR="$ROOT/../../v3/docs/adr/ADR-150-metaharness-integration-surfaces.md"
@@ -562,8 +584,11 @@ grep -q "iter 36-53 surfaces" "$DOC" 2>/dev/null || miss="$miss no-iter53-commen
step "17z23. ADR-150 implementation notes reflect iters 13-59 (iter 60)"
miss=""
ADR="$ROOT/../../v3/docs/adr/ADR-150-metaharness-integration-surfaces.md"
grep -q "Phase 3 §3.1 ✅ iters 33–59" "$ADR" 2>/dev/null || miss="$miss no-phase3-status"
grep -q "sixty iterations of /loop" "$ADR" 2>/dev/null || miss="$miss no-60-iter-marker"
# iter 83 bumped these markers from "33–59" / "sixty" → "33–82" / "eighty-two"
# Smoke accepts any iters-NN range and any N-iteration string so future ADR
# refreshes don't break iter-60's coverage assertion.
grep -qE "Phase 3 §3.1 ✅ iters 33–[0-9]+" "$ADR" 2>/dev/null || miss="$miss no-phase3-status"
grep -qE "[a-z]+(-[a-z]+)? iterations of /loop" "$ADR" 2>/dev/null || miss="$miss no-iter-count-marker"
grep -q "Phase 2 continued (iters 13–32)" "$ADR" 2>/dev/null || miss="$miss no-phase2-continued"
grep -q "Phase 3 §3.1 — Genome Similarity Search (iters 33–59)" "$ADR" 2>/dev/null || miss="$miss no-phase3-section"
grep -q "Real-data bug-discovery arc (iters 47-51)" "$ADR" 2>/dev/null || miss="$miss no-bug-arc"