๐Ÿ— KeyzHub
19Keys ยท community archive
2289 bytes raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
# Verification gate for the email-marketing (email-strategist) master harness.
# THE ANTI-THEATER GATE: this proves verify_email_marketing.py actually catches
# bullshit, not just prints green. It runs the linter against a known-EXCELLENT
# sample (must PASS, exit 0) AND a deliberately-broken sample (must FAIL,
# nonzero). If the gate passes the bad sample or fails the good sample, this
# script exits nonzero โ€” the harness is not trustworthy until both hold.
set -euo pipefail

ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"

echo "== email-marketing harness :: verifying [email-strategist] =="

# --- toolchain check --------------------------------------------------------
if ! command -v python3 >/dev/null 2>&1; then
  echo "FAIL: python3 not found on PATH" >&2
  exit 1
fi

if [ ! -f verify_email_marketing.py ]; then
  echo "FAIL: verify_email_marketing.py not found in $ROOT" >&2
  exit 1
fi

# --- anti-theater gate: good samples must PASS ------------------------------
GOOD_FILES=(samples/good/*)
if [ ! -e "${GOOD_FILES[0]}" ]; then
  echo "FAIL: samples/good/ is empty โ€” no known-excellent deliverable to prove the gate" >&2
  exit 1
fi

RC=0
for f in "${GOOD_FILES[@]}"; do
  [ -f "$f" ] || continue
  echo "-- checking GOOD sample must PASS: $f --"
  if ! python3 verify_email_marketing.py "$f"; then
    echo "FAIL: good sample '$f' did NOT pass the linter โ€” the gate is too strict or broken" >&2
    RC=1
  fi
done

# --- anti-theater gate: bad samples must FAIL -------------------------------
BAD_FILES=(samples/bad/*)
if [ ! -e "${BAD_FILES[0]}" ]; then
  echo "FAIL: samples/bad/ is empty โ€” no deliberately-broken deliverable to prove the gate" >&2
  exit 1
fi

for f in "${BAD_FILES[@]}"; do
  [ -f "$f" ] || continue
  echo "-- checking BAD sample must FAIL: $f --"
  if python3 verify_email_marketing.py "$f"; then
    echo "FAIL: bad sample '$f' PASSED the linter โ€” the gate is too loose (catches nothing)" >&2
    RC=1
  fi
done

if [ "$RC" -ne 0 ]; then
  echo "FAIL: anti-theater gate did not hold โ€” fix verify_email_marketing.py before trusting it" >&2
  exit 1
fi

echo "PASS: verify_email_marketing.py correctly passes good samples and fails bad samples."
echo "PASS: email-marketing harness gate is trustworthy."
exit 0