test(labels): unset GITHUB_API_URL in the no-api case — env preserves it

Plain `env` preserves the parent environment, and on the runner every step
arrives with GITHUB_API_URL set — the premise of the fix under test — so the
unset-refusal case inherited it and never exercised the refusal. It passed
only in a dev shell that lacks the variable: the environment distance
UPSTREAM-SYNC.md step 7 warns about, in the test written the same day
(@kimi-reviewer-andresmgsl, run 468).

Refs #205
This commit is contained in:
clad2 2026-08-05 17:35:28 +00:00
parent 0c2db9d85a
commit 3bde48f24c

View file

@ -136,7 +136,13 @@ check "any non-204 fails, not only the statuses the API documents" 1 "forbidden"
run_step_no_api() { run_step_no_api() {
rm -rf "${TMP:?}/bin"; mkdir -p "$TMP/bin"; : >"$TMP/calls" rm -rf "${TMP:?}/bin"; mkdir -p "$TMP/bin"; : >"$TMP/calls"
make_curl 204 "" make_curl 204 ""
env PATH="$TMP/bin:$PATH" GITHUB_TOKEN=tok GITHUB_REPOSITORY=owner/repo \ # -u, because plain `env` PRESERVES the parent environment: on the runner
# every step arrives with GITHUB_API_URL set — the premise of the fix under
# test — so without the unset this case inherits it, the refusal path never
# executes, and the case passes only in a dev shell that lacks the variable
# (@kimi-reviewer-andresmgsl, run 468).
env -u GITHUB_API_URL \
PATH="$TMP/bin:$PATH" GITHUB_TOKEN=tok GITHUB_REPOSITORY=owner/repo \
SWEEP_WORKFLOW=self-labels-sweep.yml DEFAULT_BRANCH=main "$STEP" SWEEP_WORKFLOW=self-labels-sweep.yml DEFAULT_BRANCH=main "$STEP"
} }
check "an unset GITHUB_API_URL refuses rather than guessing GitHub" 1 \ check "an unset GITHUB_API_URL refuses rather than guessing GitHub" 1 \