dir= API-write ops resolve slug from origin but forge base URL from a stale/global madtea.url (cross-forge mismatch) #391
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#391
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
For API-write operations, a
dir=target resolves the repo SLUG from the dir's origin remote but resolves the forge BASE URL from a different source (a stale or globalmadtea.url), producing an impossible cross-forge query:<owner>/<repo>from forge A sent to forge B. Read paths (madt_status,madt_auth_whoami) andmadt_api_callresolve the same checkout correctly, so the defect is specific to the API-write resolution path.Environment
madtea.url = https://gitea.inwonderland.space(forge A).https://git.cheshirecube.cloud/cheshirecube-cloud/platform-radar(forge B).Steps to reproduce
madt_clonea forge-B repo. Observed: after the clone, amadtea.urlpointing at forge A (the global default) is in effect for the new clone, though origin is forge B.git config --unset madtea.urlon the clone. Resolution falls through to the globalmadtea.url= forge A.git config madtea.url https://git.cheshirecube.cloudon the clone (repo-level = forge B).git config --get madtea.urlconfirms forge B at the repo level.madt_issues action=create dir=<clone> ....Expected
The issue is created on forge B (git.cheshirecube.cloud), matching the clone's origin and its repo-level
madtea.url.Actual
The error labels the forge as coming "from repo config madtea.url", but the repo-level
madtea.urlwas set to git.cheshirecube.cloud in step 3 and confirmed bygit config --get. So the resolver does NOT read the dir's own repo-levelmadtea.url; it reads a global/other value, while it DOES take the slug from the dir's origin. Slug (forge B) and base URL (forge A) come from different sources, so the request can never succeed. The "(from repo config madtea.url)" label in the error is itself inaccurate.Contrast: same checkout, correct resolution
madt_auth_whoami dir=<clone>-> active forge URLhttps://git.cheshirecube.cloud(origin remote). Correct.madt_status dir=<clone>-> reportscheshirecube-cloud/platform-radaron the right forge. Correct.madt_api_call GET /repos/cheshirecube-cloud/platform-radar-> 200. Correct forge.Two defects
dir=API-write forge resolution ignores the dir's own repo-levelmadtea.url(and origin) and uses a globalmadtea.url; combined with the slug taken from the dir's origin, this yields a cross-forge mismatch. The error's source label is also wrong.madt_cloneof a forge-B repo, amadtea.urlfor forge A (the global default) is in effect for the new clone. A fresh clone should not carry a forge-A override for a forge-B origin.Suggested fix
For any
dir=operation, resolve the forge base URL from the SAME source as the slug: the dir's repo-levelmadtea.url, else its origin remote. Never a globalmadtea.url. Fix the error's source label to name the true source. And ensuremadt_clonedoes not write or leave a mismatchedmadtea.urlfor the new clone's origin.Impact and workarounds
All madtea API-write ops (issue create/comment, finish, prs) against a repo on a non-default forge fail when a global
madtea.urlpoints elsewhere. Workarounds found: usemadt_api_call(resolves correctly), or clear the globalmadtea.url.