test(e2e): support empty auth headers on mac bash #1648
Reference in New Issue
Block a user
Delete Branch "fix/e2e-bash32-empty-array"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes local E2E shell helpers so empty optional header arrays work on macOS
/bin/bash3.2 withset -u.Why
While completing SOP Stage C for the multi-external-workspace work, Docker restart fixed the local infra, but
tests/e2e/test_peer_visibility_mcp_local.shfailed before issuing MCP calls because emptyADMIN_AUTH[@]/org_header[@]expansions are unbound under macOS bash 3.2. The script explicitly claims macOS bash 3.2 compatibility, so the gate itself needed the portability fix.Brief-falsification log
[H1] Local Stage C was blocked only by Docker storage I/O.
Verification: Restarted Docker Desktop, confirmed active Postgres/Redis exec worked, started local platform, ran
BASE=http://localhost:8080 bash tests/e2e/test_peer_visibility_mcp_local.sh.Result: falsified/updated. Docker was one blocker; after restart, the E2E exposed a second blocker in the shell scripts: empty array expansion under
set -u.Updated working theory: use bash-3-safe optional-array expansion for optional curl headers.
Comprehensive testing performed
bash -n tests/e2e/_lib.sh && bash -n tests/e2e/lib/peer_visibility_assert.sh && bash -n tests/e2e/test_peer_visibility_mcp_local.sh->bash-syntax-oklocalhost:8080:BASE=http://localhost:8080 bash tests/e2e/test_poll_mode_e2e.sh->22 passed, 0 failedBASE=http://localhost:8080 bash tests/e2e/test_peer_visibility_mcp_local.sh->GATE PASSED (LOCAL)withhermes OK,openclaw OK,claude-code OKLocal-postgres E2E run
Local Postgres/Redis from Docker Desktop after restart, with
DATABASE_URL=postgres://dev:dev@localhost:5432/molecule?sslmode=disableandREDIS_URL=redis://localhost:6379. Evidence: poll-mode E2E passed22 passed, 0 failed; peer-visibility MCP local gate passed for hermes/openclaw/claude-code.Staging-smoke verified or pending
N/A for this PR: local E2E shell portability fix only. CI
E2E Peer Visibility (local)is the relevant gate and passed.Root-cause not symptom
Root cause was bash 3.2 +
set -utreating empty array expansions like${ADMIN_AUTH[@]}/${org_header[@]}as unbound when optional auth/org headers were absent in local dev mode.Five-Axis review walked
Correctness: only optional empty array expansions changed. Readability: uses established bash-3-compatible idiom. Architecture: no new abstraction. Security: does not add credential handling or logging. Performance: no meaningful runtime impact.
No backwards-compat shim / dead code added
Yes. This is a direct portability fix in the existing scripts; no shim or dead code path was added.
Memory/saved-feedback consulted
No task-specific saved memory hit for this repo/workflow in current memory search. Applied current AGENTS/SOP instructions and existing repo gates.
Verification
bash -n tests/e2e/_lib.sh && bash -n tests/e2e/lib/peer_visibility_assert.sh && bash -n tests/e2e/test_peer_visibility_mcp_local.sh->bash-syntax-oklocalhost:8080:BASE=http://localhost:8080 bash tests/e2e/test_poll_mode_e2e.sh->22 passed, 0 failedBASE=http://localhost:8080 bash tests/e2e/test_peer_visibility_mcp_local.sh->GATE PASSED (LOCAL)withhermes OK,openclaw OK,claude-code OKCoverage ledger
tests/e2e/_lib.sh::e2e_mint_test_tokenadmin_authempty when no admin bearer is configuredtest_peer_visibility_mcp_local.shvia token mint pathtests/e2e/lib/peer_visibility_assert.sh::pv_assert_runtimeorg_headerempty for local single-tenant backendtest_peer_visibility_mcp_local.shliteral MCP callsorg_header[@]: unbound variable; Green: every runtime got HTTP 200 and expected peerstests/e2e/test_peer_visibility_mcp_local.shADMIN_AUTHempty for local dev-mode admin calls / cleanuptest_peer_visibility_mcp_local.shpreflight, create, cleanupADMIN_AUTH[@]: unbound variable; Green: parent + siblings created, MCP checked, scoped cleanup ranIdempotency notes
E2E script cleanup remains scoped to workspaces created by that run. No blanket cleanup was added.
Loki query
N/A — local E2E shell portability only.
Tier
tier:low