Files
boshu2__agentops/scripts/check-quarantine-empty.sh
T
Boden Fuller 55a8531480 feat(gates): quarantine-empty enforcement gate (D3)
Closes soc-ymph.3 — GOALS.md directive D3 (Quarantine-empty enforcement gate).

Why
- tests/_quarantine/ is meant to be an inbox, not a parking lot. Without a
  gate, parked suites accumulate and the directive promise that "broken
  tests get fixed or deleted" silently drifts.

What
- scripts/check-quarantine-empty.sh: new gate (exit 1 when find returns any
  *.sh/*.bats under tests/_quarantine; exit 0 otherwise; ALLOW_QUARANTINE=1
  env var for single-cycle operator override). Uses set -euo pipefail and
  array-based output for portable enumeration.
- GOALS.md: new `quarantine-empty` row, weight 4 (mirrors bead spec).
  goal_count 22 -> 23.
- .github/workflows/validate.yml: new validate-quarantine-empty job (no
  changes filter — quarantine is shared infra, always check), registered
  in summary.needs[] and summary echo. Per learning
  2026-05-07-ci-workflow-additions-need-parity-co-execution, validated
  via scripts/validate-ci-policy-parity.sh.
- AGENTS.md: CI Jobs table row for validate-quarantine-empty.
- scripts/pre-push-gate.sh: new check 22c (quarantine empty), always-on so
  it catches pollution regardless of diff scope.
- tests/scripts/pre-push-gate.bats: stub check-quarantine-empty.sh per
  test-fixture parity rule.

Verification
- bash scripts/check-quarantine-empty.sh -> PASS (empty)
- Synthetic populated dir -> exit 1 with file list
- ALLOW_QUARANTINE=1 override -> exit 0 with SKIP banner
- ao goals measure -> quarantine-empty result=pass, weight=4
- bash scripts/validate-ci-policy-parity.sh -> PASS (49 jobs, 7 non-blocking)
- bash scripts/pre-push-gate.sh --fast Pass 1 -> PASSED
2026-05-11 09:35:49 -04:00

42 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# check-quarantine-empty.sh — Goal gate script (GOALS.md directive D3)
# Fails when tests/_quarantine/ holds any executable suite (*.sh or *.bats).
# Quarantine is an inbox, not a parking lot. Empty it or document the breakage
# in a tracked bead; do not let the directory accumulate dead tests.
#
# Override (single-cycle, explicit operator opt-out):
# ALLOW_QUARANTINE=1 bash scripts/check-quarantine-empty.sh
#
# Exit 0 = pass (empty or override), exit 1 = fail (populated without override).
set -euo pipefail
ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || { echo "Not in a git repo"; exit 1; }
QDIR="$ROOT/tests/_quarantine"
if [[ "${ALLOW_QUARANTINE:-0}" == "1" ]]; then
echo "SKIP: ALLOW_QUARANTINE=1 — quarantine bypass enabled (operator override)"
exit 0
fi
if [[ ! -d "$QDIR" ]]; then
echo "PASS: tests/_quarantine/ does not exist (nothing to enforce)"
exit 0
fi
# Portable enumeration: -print0 + xargs -0 avoids subshell pipe edge cases.
mapfile -d '' FOUND < <(find "$QDIR" -type f \( -name '*.sh' -o -name '*.bats' \) -print0 2>/dev/null)
COUNT=${#FOUND[@]}
if [[ "$COUNT" -gt 0 ]]; then
echo "FAIL: tests/_quarantine/ holds $COUNT shell/bats suite(s):"
for f in "${FOUND[@]}"; do
printf ' - %s\n' "${f#$ROOT/}"
done
echo
echo "Move them back into the tree, delete them, or set ALLOW_QUARANTINE=1 for a single-cycle override."
exit 1
fi
echo "PASS: tests/_quarantine/ contains no .sh or .bats suites"
exit 0