Use bounded verification wrappers in the app landing gate

This commit is contained in:
2026-11-05 14:03:00 +00:00
parent c7e57973a0
commit ea98a7ae2d
4 changed files with 176 additions and 47 deletions
+24 -21
View File
@@ -1,25 +1,28 @@
#!/bin/sh
# Landing gate for app/ changes: analyze, then the full test suite.
#
# Usage (from app/): sh tool/check_full.sh
# Exits 0 only when `flutter analyze` reports no issues and the full suite
# prints `All tests passed!`. A piped `tail` cannot hide a failure here: the
# verdict comes from the suite's own final line, which is echoed with the
# totals. Logs go to build/check/ for the caller's evidence.
set -u
FLUTTER="${FLUTTER:-flutter}"
# Usage: sh app/tool/check_full.sh (or sh tool/check_full.sh from app/).
# The wrappers bound output and test memory. Trust their exit statuses, never
# success-looking text in a failed command's log. Keep their summaries in
# build/check/; each summary also names the underlying full log.
set -eu
cd "$(dirname "$0")/.."
mkdir -p build/check
"$FLUTTER" analyze > build/check/analyze.log 2>&1
if ! grep -q "No issues found" build/check/analyze.log; then
grep -E " • " build/check/analyze.log
echo "CHECK FAILED: flutter analyze reported issues (build/check/analyze.log)"
exit 1
fi
"$FLUTTER" test > build/check/test.log 2>&1
verdict=$(grep -E "All tests passed!|Some tests failed" build/check/test.log | tail -1)
if ! echo "$verdict" | grep -q "All tests passed!"; then
grep -E "\[E\]" build/check/test.log | head -20
echo "CHECK FAILED: $verdict (build/check/test.log)"
exit 1
fi
echo "CHECK PASSED: analyze clean; $verdict"
check() {
name=$1
log=$2
shift 2
if "$@" > "$log" 2>&1; then
cat "$log"
else
status=$?
cat "$log"
echo "CHECK FAILED: $name exited $status ($log)"
return "$status"
fi
}
check analyze build/check/analyze.log tool/analyze.sh
check test build/check/test.log tool/memwatch/full.sh test
echo "CHECK PASSED: analyze and memory-watched test suite passed"