fix(tests): guard empty arrays, cap output, kill orphaned children

- bash 3.2: guard BLOCKERS/PATH_ARGS empty-array expansion under set -u
- run-coverage-lane: surface collectLaneFiles errors instead of throwing
- run-test-lane: cap per-file output at 1 MB; track and SIGKILL children on SIGINT/SIGTERM
This commit is contained in:
2026-07-06 23:58:42 -07:00
parent a4927a3bbd
commit db9121a5f9
3 changed files with 55 additions and 5 deletions
@@ -255,8 +255,18 @@ write_summary_files() {
local lane_lines
lane_lines=$(printf '%s\n' "${SELECTED_LANES[@]}")
printf '%s\n' "$lane_lines" >"$ARTIFACT_DIR/lanes.txt"
printf '%s\n' "${BLOCKERS[@]}" >"$ARTIFACT_DIR/blockers.txt"
printf '%s\n' "${PATH_ARGS[@]}" >"$ARTIFACT_DIR/requested-paths.txt"
# bash 3.2 raises "unbound variable" under set -u when expanding an empty
# array, so guard on length (matching the idiom used elsewhere here).
if [[ ${#BLOCKERS[@]} -gt 0 ]]; then
printf '%s\n' "${BLOCKERS[@]}" >"$ARTIFACT_DIR/blockers.txt"
else
: >"$ARTIFACT_DIR/blockers.txt"
fi
if [[ ${#PATH_ARGS[@]} -gt 0 ]]; then
printf '%s\n' "${PATH_ARGS[@]}" >"$ARTIFACT_DIR/requested-paths.txt"
else
: >"$ARTIFACT_DIR/requested-paths.txt"
fi
ARTIFACT_DIR_ENV="$ARTIFACT_DIR" \
SESSION_ID_ENV="$SESSION_ID" \