fix(api): non-2xx responses are errors on both surfaces - jq/template never runs on an error body #181

Merged
hexajon merged 1 commit from refs/pull/181/head into main 2026-07-17 02:32:23 +00:00
hexajon commented 2026-07-17 02:32:19 +00:00 (Migrated from codeberg.org)

Summary

madt_api_call returned non-2xx responses as ordinary data: no isError, no status code anywhere, and a jq/template filter would happily transmute an error envelope into plausible-looking results (a live Codeberg 500 masqueraded as a search-result count of 2 and derailed an outage diagnosis for an hour - #153).

The >=400 check now lives in the shared service Call() itself, before any jq/template transform, returning API error <code>: <body> - the same shape as the typed client path. MCP gets a proper tool error; the CLI's now-dead post-hoc status block is removed, so madtea api keeps its gh-style non-zero exit with the unified message. No opt-out/status-probing parameter in this pass (deferred; no in-repo caller needs it - gh api is fail-loud too).

Tests pin the jq-on-error-body shape specifically on both the service and MCP surfaces; COMPARISON api row updated.

Closes #153.

Closes #153

## Summary `madt_api_call` returned non-2xx responses as ordinary data: no isError, no status code anywhere, and a jq/template filter would happily transmute an error envelope into plausible-looking results (a live Codeberg 500 masqueraded as a search-result count of 2 and derailed an outage diagnosis for an hour - #153). The >=400 check now lives in the shared service Call() itself, before any jq/template transform, returning `API error <code>: <body>` - the same shape as the typed client path. MCP gets a proper tool error; the CLI's now-dead post-hoc status block is removed, so `madtea api` keeps its gh-style non-zero exit with the unified message. No opt-out/status-probing parameter in this pass (deferred; no in-repo caller needs it - gh api is fail-loud too). Tests pin the jq-on-error-body shape specifically on both the service and MCP surfaces; COMPARISON api row updated. Closes #153. Closes #153
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea!181
No description provided.