fix(git-tools): issue-comment.sh resolves API base without monolith GITEA_URL (#1450)
ci/woodpecker/pr/ci Pipeline was successful

gitea_resolve_api_for_login() failed closed with "Configured Gitea URL not
found for comment read-back verification" on seat-token-only hosts: no
gitea-mosaicstack/gitea-usc credentials.sh entry and no bare GITEA_URL means
get_gitea_url_for_host has nothing to match. issue-create.sh's REST fallback
already proves the working trust model on these hosts -- derive the API base
directly from the git remote's own resolved host, never a cross-host guess.

Adds a regression case (seat identity resolved purely via
MOSAIC_GIT_IDENTITY's per-slot token file, no monolith credentials.json entry
for the host at all) asserting: no cross-host fallback, POST/GET/exact-id
read-back all attributed to the seat identity (never a host-default identity
that doesn't exist here), no temp-file leak, token never in curl argv.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XCyecc8rPcp6mVSpRtfVGE
This commit is contained in:
fred
2026-09-11 17:22:23 -05:00
co-authored by Claude Sonnet 5
parent 5d27700026
commit 5e37bfc3bd
2 changed files with 108 additions and 3 deletions
@@ -155,8 +155,15 @@ gitea_resolve_api_for_login() {
}
fi
configured_url=$(get_gitea_url_for_host "$host") || {
echo "Error: Configured Gitea URL not found for comment read-back verification" >&2
return 1
# No monolith-configured Gitea URL for this host (#1450): seat-token-only
# hosts carry no gitea-mosaicstack/gitea-usc credentials.sh entry and no
# bare GITEA_URL, so get_gitea_url_for_host has nothing to match against.
# Synthesize the API base directly from the git remote's own host --
# exactly the trust model issue-create.sh's REST fallback already uses
# successfully on these hosts. This is NOT a cross-host guess: $host came
# from get_remote_host() reading THIS repo's own origin remote, so the
# resolved base always matches the repo actually being acted on.
configured_url="https://${host}"
}
repo=$(get_gitea_repo_slug_for_url "$configured_url") || {
echo "Error: Could not resolve Gitea owner/repository relative to configured URL" >&2