From be271f65c1763ea827b31e964fe2597d95eac22a Mon Sep 17 00:00:00 2001 From: Marcos Paulo Date: Sun, 6 Sep 2026 09:14:38 +0000 Subject: [PATCH] ci: fail the gate when astro build logs an error `astro build` exits 0 on a vite asset-resolution failure. That is how a stale `@import` survived the cutover and stayed green through every gate run: the build printed `[ERROR]`, returned 0, and the gate believed it. Tee the build log and treat a logged error as a failure. Negative-tested by reintroducing the import -- GATE 1, with both the vite error and the new message. Co-Authored-By: Claude Opus 5 --- .agents/scripts/gate.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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