From c05ec85f5426113ccf9615ed8f4402bdf3fe7a46 Mon Sep 17 00:00:00 2001 From: Han Ngo Date: Tue, 6 Oct 2026 21:19:12 +0700 Subject: [PATCH] fix(share): clear the held Access id after a finished alias fold access_gate sets held_access_id while it waits. The fold path never cleared it, so the EXIT trap told the operator a finished fold left an app in access-pending. Row 14 now checks the notice is absent. --- bin/share | 1 + tests/share.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/bin/share b/bin/share index ec5b9ac..7964acd 100755 --- a/bin/share +++ b/bin/share @@ -4144,6 +4144,7 @@ cmd_setup_tenant() { # cmd_setup_tenant [alia [[ -n $gid ]] || continue access_gate "$gid" "$gaud" || { alias_dests undo || true; die "Cloudflare Access did not enforce on $host_name/$gid within ${access_wait}s; the added destinations were removed; the route is not attached; rerun the same setup (or DELETE the v:2 pointers written so far)"; } done <<<"$alias_moved" + held_access_id="" # every folded app enforced, so nothing waits in access-pending echo "access: $(grep -c . <<<"$fold_apps") gated link(s) also gated at $host_name" fi diff --git a/tests/share.sh b/tests/share.sh index 7a41be6..096f722 100755 --- a/tests/share.sh +++ b/tests/share.sh @@ -3269,6 +3269,7 @@ row14end="{\"v\":1,\"host\":\"ten.example.test\",\"aliases\":[\"f.example.test\" afresh out=$(afold 2>&1); rc=$? check "row 14: the fold exits 0" "0" "$rc" +check "row 14: a finished fold prints no stale access-pending notice" "0" "$(grep -c 'nothing was published' <<<"$out")" check "row 14: the call order" "1" "$(vord "^GET app $fu1\$" '^API PUT /accounts/acct-dry/workers/scripts/share-ten-example-test$' '^PUT m/0a000' "^PUT app $fu1\$" '^PROBE ' '^CONFIG r2 on$' \ '^PUT share.json$' '^API POST /zones/zone-dry/workers/routes$' '^API PUT /accounts/acct-dry/workers/domains$' '^HEALTHZ$' '^ALIAS-301 f.example.test$')" check "row 14: the alias destinations are dropped last, after the 301" "1" "$([[ $(grep -n "^PUT app $fu1\$" "$vlog" | tail -1 | cut -d: -f1) -gt $(grep -n '^ALIAS-301' "$vlog" | tail -1 | cut -d: -f1) ]] && echo 1 || echo 0)"