bug(finish): resolveForeignDefaultBranch swallows the real error — credential failures masquerade as 'forge API unreachable' #93
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#93
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?
Observed 2026-07-15 while landing ADR 0027 (PR #92) through the sanctioned foreign-finish flow.
resolveForeignDefaultBranch(internal/service/workflow/helpers.go:439) swallows every underlying error:finishClientFnfailure,GetCurrentRepofailure, and unmarshal failure all collapse to the bare("", nil, "")sentinel, and the caller replaces them withforeignDefaultBranchUnresolvedError— "the forge API was unreachable, or the target repository has no default branch yet (never pushed)".The actual failure was neither:
GetConfigForDirfailed credential resolution for the target dir (the companion token-source issue), which produces the good error — "no credentials for codeberg.org — run madtea auth login (from a repo on that forge…)" — naming the host and the remedy. That message was discarded, and the substitute sent the operator and agent chasing network reachability and repo-emptiness, both false. Diagnosing required reading the source; the refusal violated the spirit of ADR 0026 (refusals teach the actual next step) even though no hook chain is involved.Fix: thread the underlying error out of
resolveForeignDefaultBranch(return it, or at minimum wrap it intoforeignDefaultBranchUnresolvedError's text) so a credential-resolution failure surfaces as itself. The "unreachable or never pushed" wording should only appear when the client was built successfully and the GET actually failed/returned empty.Acceptance: a foreign finish whose target dir has no resolvable credentials errors with the "no credentials for " message (host + remedy named), not the unreachable/never-pushed text; a genuine network failure still reports as such.