fix(test): resolve self-exclusion bug in environment orchestrator

The self-exclusion check compared BASH_SOURCE[0] (relative path when
invoked as `bash ./scripts/…/00_orchestrator.sh`) against the glob-built
step paths (always absolute). The mismatch caused the orchestrator to
include itself in the loop, running a full inner pass of steps 01–10
before the outer loop repeated them — doubling the total runtime.

Fix: resolve SELF to an absolute path using SCRIPT_DIR so the comparison
is always path-equivalent regardless of invocation style.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Environment TestandClaude Sonnet 4.6 authored and Prageeth Panicker committed 2026-04-11 20:34:38 +00:00
1 parent 2303901d93
commit fb2de0e6b6
1 file changed
+4 -1
+4 -1
View File
@@ -8,6 +8,9 @@ unset GITHUB_ACTIONS
unset ACT
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Resolve to an absolute path so the self-exclusion works regardless of whether
# the script was invoked with a relative path (e.g. bash ./scripts/…/00_orchestrator.sh).
SELF="${SCRIPT_DIR}/$(basename "${BASH_SOURCE[0]}")"
# shellcheck source=scripts/tests/environment/lib.sh
source "${SCRIPT_DIR}/lib.sh"
@@ -15,7 +18,7 @@ source "${SCRIPT_DIR}/lib.sh"
cd "${REPO_ROOT}"
for step in "${SCRIPT_DIR}"/[0-9][0-9]_*.sh; do
[[ "${step}" == "${BASH_SOURCE[0]}" ]] && continue
[[ "${step}" == "${SELF}" ]] && continue
load_repo_env
ensure_git_safe_directory
echo "============================================================"