diff --git a/.agents/scripts/gate.sh b/.agents/scripts/gate.sh index 1732354..344f8c0 100755 --- a/.agents/scripts/gate.sh +++ b/.agents/scripts/gate.sh @@ -43,7 +43,20 @@ step "types" pnpm exec astro check step "build" -pnpm run build +# `astro build` exits 0 even when vite fails to resolve an asset: the cutover +# left a stale `@import` in a moved stylesheet and every gate stayed green for +# it. Treat a logged error as a failed build. +build_log=$(mktemp) +if ! pnpm run build 2>&1 | tee "$build_log"; then + rm -f "$build_log" + exit 1 +fi +if grep -q '\[ERROR\]' "$build_log"; then + echo "gate: astro build logged an error and still exited 0. See above." >&2 + rm -f "$build_log" + exit 1 +fi +rm -f "$build_log" step "content contracts" pnpm run verify