Skip to content

Commit 66ad7e5

Browse files
hyperpolymathclaude
andcommitted
fix(ci): repair aspect_tests.sh grep-count bash bug (baseline rot)
`Aspect — Thread Safety + ABI Contract + SPDX` has been red on `main`, gating every PR on these lines: tests/aspect_tests.sh: line 77: [[: 0 0: syntax error in expression (error token is "0") Root cause: `grep -c 'pattern' file 2>/dev/null || echo "0"`. When `grep -c` finds zero matches it outputs `0` to stdout **and** exits non-zero, which then triggers `|| echo "0"` — `has_export` ends up `"0\n0"`, and `[[ "0\n0" -gt 0 ]]` chokes on the embedded newline in arithmetic context. Swapped the `|| echo "0"` for `|| true` on all four call-sites; `grep -c` already prints `0` cleanly, the `|| true` just suppresses the exit code for `set -euo pipefail`. Verification: `bash -n tests/aspect_tests.sh` clean. (The companion `.github/workflows/e2e.yml` fix — Zig 0.15.0 → 0.15.1 and the `denoland/setup-deno` SHA refresh — is held out because the current OAuth token lacks the `workflow` scope GitHub requires for workflow-file edits. Will land separately once the token is rotated or via a token with the right scope.) Out of scope and deliberately not touched: - `governance / Language / package anti-pattern policy` — also red on main, but a parallel session is already diagnosing it under the Estate-drift-remediation 2026-05 campaign (parent standards#66). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1e60f60 commit 66ad7e5

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/aspect_tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ for zigfile in "$zig_ffi_dir"/*.zig; do
7171
;;
7272
esac
7373

74-
has_export=$(grep -cP '(?:pub )?export fn' "$zigfile" 2>/dev/null || echo "0")
75-
has_mutex=$(grep -c 'Mutex' "$zigfile" 2>/dev/null || echo "0")
74+
has_export=$(grep -cP '(?:pub )?export fn' "$zigfile" 2>/dev/null || true)
75+
has_mutex=$(grep -c 'Mutex' "$zigfile" 2>/dev/null || true)
7676

7777
if [[ "$has_export" -gt 0 && "$has_mutex" -eq 0 ]]; then
7878
fail "$basename_zig has $has_export C-ABI exports but no Mutex"
@@ -95,8 +95,8 @@ for cart_dir in "$PROJECT_DIR"/cartridges/*/ffi; do
9595
fi
9696

9797
if [[ -n "$ffi_zig" ]]; then
98-
has_export=$(grep -c 'pub export fn' "$ffi_zig" 2>/dev/null || echo "0")
99-
has_mutex=$(grep -c 'Mutex' "$ffi_zig" 2>/dev/null || echo "0")
98+
has_export=$(grep -c 'pub export fn' "$ffi_zig" 2>/dev/null || true)
99+
has_mutex=$(grep -c 'Mutex' "$ffi_zig" 2>/dev/null || true)
100100

101101
if [[ "$has_export" -gt 0 && "$has_mutex" -eq 0 ]]; then
102102
fail "$cart_name FFI: $has_export exports, no Mutex"

0 commit comments

Comments
 (0)