From 3bde48f24c1bfb8f424b07a3535b5eb29fbd5ac0 Mon Sep 17 00:00:00 2001 From: clad2 Date: Wed, 5 Aug 2026 17:35:28 +0000 Subject: [PATCH] =?UTF-8?q?test(labels):=20unset=20GITHUB=5FAPI=5FURL=20in?= =?UTF-8?q?=20the=20no-api=20case=20=E2=80=94=20env=20preserves=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- test/labels-dispatch.test.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/labels-dispatch.test.sh b/test/labels-dispatch.test.sh index 90a1e6c..d7c3bf4 100755 --- a/test/labels-dispatch.test.sh +++ b/test/labels-dispatch.test.sh @@ -136,7 +136,13 @@ check "any non-204 fails, not only the statuses the API documents" 1 "forbidden" run_step_no_api() { rm -rf "${TMP:?}/bin"; mkdir -p "$TMP/bin"; : >"$TMP/calls" 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" } check "an unset GITHUB_API_URL refuses rather than guessing GitHub" 1 \