From d28ad31aca64a400da0097f9845e3fdac6492e44 Mon Sep 17 00:00:00 2001 From: IK Date: Fri, 11 Sep 2026 07:46:10 +0700 Subject: [PATCH] fix: fail closed on bootstrap migration inspection --- deploy/test-production-bootstrap.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deploy/test-production-bootstrap.sh b/deploy/test-production-bootstrap.sh index 8b8d8ef..2c8e9b2 100755 --- a/deploy/test-production-bootstrap.sh +++ b/deploy/test-production-bootstrap.sh @@ -44,7 +44,10 @@ $compose run --rm --no-deps community-scheduler python -c "import app.community_ echo "Community scheduler valid ✓" # A10: Extract Alembic revision ID programmatically, handle multiple heads -ALEMBIC_HEADS_OUTPUT=$($compose exec -T api alembic heads 2>/dev/null || true) +if ! ALEMBIC_HEADS_OUTPUT=$($compose exec -T api alembic heads 2>/dev/null); then + echo "ERROR: unable to read Alembic heads" >&2 + exit 1 +fi # Extract revision IDs (first field before space or '(head)'), handle multiple heads ALEMBIC_HEAD=$(echo "$ALEMBIC_HEADS_OUTPUT" | grep -oE '^[a-f0-9]+' | head -1) DB_VERSION=$($compose exec -T db psql -At -U rf4 -d rf4_spotter -c 'select version_num from alembic_version') @@ -60,7 +63,7 @@ if [ -z "$DB_VERSION" ]; then fi # Handle multiple heads: check if DB version matches any head -HEAD_COUNT=$(echo "$ALEMBIC_HEADS_OUTPUT" | grep -cE '^[a-f0-9]+' || true) +HEAD_COUNT=$(echo "$ALEMBIC_HEADS_OUTPUT" | grep -cE '^[a-f0-9]+') || HEAD_COUNT=0 if [ "$HEAD_COUNT" -gt 1 ]; then echo "WARNING: Multiple Alembic heads detected ($HEAD_COUNT), checking if DB version matches any..." if ! echo "$ALEMBIC_HEADS_OUTPUT" | grep -q "^$DB_VERSION"; then