#!/usr/bin/env bash # Test: tier validation scripts accept good fixtures and reject bad ones. # # This is the validation surface for the Plan 5 Task 4 tier exit suite — # verifies the shape of pass/fail logic on synthetic aggregate JSONs # without needing a real training run. set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "${HERE}/.." && pwd)" FIXTURES="${HERE}/fixtures" # ── Tier 1 ───────────────────────────────────────────────────────────────── # Bad metrics JSON should fail (exit code 1, masked by `if`). if python3 "${SCRIPT_DIR}/check_tier1.py" "${FIXTURES}/bad_tier1.json" --warmup-end 15; then echo "FAIL: tier1 check accepted bad metrics" exit 1 fi # Known-good metrics JSON should pass (exit code 0). python3 "${SCRIPT_DIR}/check_tier1.py" "${FIXTURES}/good_tier1.json" --warmup-end 15 # ── Tier 2 ───────────────────────────────────────────────────────────────── # Bad fixture lacks val_trades_per_bar / val_active_frac / dir-entropy entirely # → tier2 must FAIL with the missing-metric explanation. if python3 "${SCRIPT_DIR}/check_tier2.py" "${FIXTURES}/bad_tier1.json" --warmup-end 15; then echo "FAIL: tier2 check accepted aggregate without behavioural metrics" exit 1 fi # ── Tier 3 ───────────────────────────────────────────────────────────────── # Bad fixture lacks val_sharpe_annualised / val_win_rate / val_profit_factor # entirely → tier3 must FAIL with the missing-metric explanation. if python3 "${SCRIPT_DIR}/check_tier3.py" "${FIXTURES}/bad_tier1.json" --warmup-end 15; then echo "FAIL: tier3 check accepted aggregate without profitability metrics" exit 1 fi # ── all-tiers wrapper ────────────────────────────────────────────────────── # Wrapper must reject any aggregate that fails any tier (uses bad fixture). if python3 "${SCRIPT_DIR}/check_all_tiers.py" "${FIXTURES}/bad_tier1.json" --warmup-end 15; then echo "FAIL: check_all_tiers.py accepted aggregate that fails tier1+2+3" exit 1 fi echo "PASS"