#!/usr/bin/env bash
# Verification gate for the funnel-psychology master.
# This is the anti-theater proof: it runs verify_funnel_psychology.py against a
# known-EXCELLENT sample (must PASS) and a deliberately-broken sample (must FAIL).
# If the gate ever passes the bad sample or fails the good one, this script exits
# nonzero โ that means the linter is decorative, not real, and must be fixed before
# any deliverable in this discipline can be trusted.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
echo "== funnel-psychology harness :: anti-theater gate =="
# --- toolchain check --------------------------------------------------------
if ! command -v python3 >/dev/null 2>&1; then
echo "FAIL: python3 not found on PATH" >&2
exit 1
fi
LINTER="$ROOT/verify_funnel_psychology.py"
if [ ! -f "$LINTER" ]; then
echo "FAIL: linter not found at $LINTER" >&2
exit 1
fi
GATE_RC=0
# --- good sample MUST pass ---------------------------------------------------
echo "-- samples/good/* must PASS --"
shopt -s nullglob
GOOD_FILES=("$ROOT"/samples/good/*)
shopt -u nullglob
if [ ${#GOOD_FILES[@]} -eq 0 ]; then
echo "FAIL: no files in samples/good/ โ nothing to prove the gate against" >&2
exit 1
fi
for f in "${GOOD_FILES[@]}"; do
echo " checking: $f"
if python3 "$LINTER" "$f" --type funnel-blueprint; then
echo " OK: $f passed (expected PASS)"
else
echo " GATE FAILURE: good sample '$f' did NOT pass โ linter is too strict or the sample regressed" >&2
GATE_RC=1
fi
done
# --- bad sample MUST fail ----------------------------------------------------
echo "-- samples/bad/* must FAIL --"
shopt -s nullglob
BAD_FILES=("$ROOT"/samples/bad/*)
shopt -u nullglob
if [ ${#BAD_FILES[@]} -eq 0 ]; then
echo "FAIL: no files in samples/bad/ โ nothing to prove the gate catches defects" >&2
exit 1
fi
for f in "${BAD_FILES[@]}"; do
echo " checking: $f"
if python3 "$LINTER" "$f" --type funnel-blueprint; then
echo " GATE FAILURE: bad sample '$f' PASSED โ linter is not catching known defects" >&2
GATE_RC=1
else
echo " OK: $f correctly failed (expected FAIL)"
fi
done
if [ "$GATE_RC" -ne 0 ]; then
echo "FAIL: anti-theater gate did not hold โ see failures above" >&2
exit 1
fi
echo "PASS: linter correctly passes the good sample and fails the bad sample."
exit 0