api: exit nonzero on HTTP error responses (gh api parity) #105
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#105
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?
madtea apiexits 0 on HTTP error responses, printing the error JSON to stdout:gh apiexits 1 on any non-2xx response (and prints the error to stderr), so scripts can use it inif/&&chains. madtea's behavior makes exit-code checks againstmadtea apialways-true, which is a silent trap.Real-world impact:
scripts/release.sh'sforge_release_exists()checkedmadtea api .../releases/tags/$tag's exit code — always true, so the v0.15.1 release run skipped goreleaser for a release that didn't exist, stranding a pushed tag with no forge release (fixed script-side in #104 by switching tomadtea release get, which exits nonzero correctly).scripts/check-satellite-readiness.sh:45carries the same wrong assumption in its comment ("A missing/unreachable repo makes the GET fail (non-zero)" — it doesn't); it only fails safe by accident, via the*)case on the unparseable--jqoutput.Acceptance criteria:
madtea api(CLI) andmadt_api_callexit/error consistently: non-2xx → nonzero exit (CLI) with the error on stderr, matchinggh api.scripts/check-satellite-readiness.sh's unreachable-repo branch works as its comment describes once the exit code is honest.docs/COMPARISON.mdrow forapiupdated if behavior was documented as differing.