Repository navigation
fix(shipbob): treat empty-body HTTP errors as cancel failures - #13517
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Fixed: fallback now only formats |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @Nukeys — real bug, correct diagnosis, and the right scope. I verified the fix against make_shipbob_request and ShipBob's documented cancel contract before commenting on specifics.
What checks out:
make_shipbob_request(plugins/omi-shipbob-app/main.py:143-178) returns exactly four shapes: parsed JSON on 200/201 (L171),{"error": response.text, "status_code": N}on other statuses (L175 — a blank body yieldserror: ""),{"error": str(e)}on exception (L178), andNonewhen auth headers are missing or the method is unknown (L155/L169). The old truthiness check (result.get("error"), base L803-805) let both""andNonefall through to**WRO #… has been cancelled.**— a false success on precisely the paths where users can least afford it.- The new guard (L806-815) classifies all four shapes correctly, and the
HTTP {status}/ "ShipBob request failed" fallbacks keep the message informative when the body is blank. The follow-up commit addressing the interim "HTTP None" output was the right call. - No false-failure risk for genuine successes: ShipBob documents
POST /2.0/receiving/{id}/cancelas 200 returning the full WRO object, and that schema contains noerror/status_codefields, so a real success can never trip the new predicate. Failure-Class: nonein the PR body validates cleanly withscripts/failure-class validateat this head.
What's missing — the regression test:
The repo's Definition of Done requires bug fixes to land with the regression test that would have caught the bug, and #13183 itself proposed hermetic coverage for the empty-body failure plus ordinary failure/success controls. The pattern exists a couple of plugins over: plugins/omi-frankfurter-app/test_main.py exercises tool handlers through fastapi.testclient with mocked transport, and .github/checks-manifest.yaml wires plugin tests into both lanes (see the hacker-news-tests / usgs-earthquake-tests entries with plugins/<app>/** triggers). A test_main.py here covering empty-body 500 → error, None → error, non-empty error → surfaced, and 200 WRO object → success would close the loop and give this plugin its first CI coverage (no checks have run on this PR yet).
One scope note — not blocking, and please don't expand this PR for it: the same truthiness pattern is still live in tool_create_wro (L695-698 — an empty-body error currently renders as a created WRO with id Unknown) and the read handlers (tool_get_wros L753, tool_get_orders L855). A follow-up issue, or lifting the guard into the helper, would finish what #13183 started; the cancel-only scope here matches the issue's compact-scope proposal, so keeping this PR narrow is right.
Requesting changes only for the test — the fix itself is correct and tightly scoped. Once the test lands this should be a quick re-review.
by AI on behalf of David — leaving the final merge sign-off to a human maintainer; no product decision needed beyond that.
|
Added |
|
@Git-on-my-level Ready for re-review. All requested changes are pushed on the latest head. |
kodjima33
left a comment
There was a problem hiding this comment.
Community bug-fix 5/5: error-classification fix verified against make_shipbob_request's 4 return shapes; regression tests now added addressing prior needs-tests gap.
What
cancel_wrotreated a failed request as success when the errormessage was an empty string (HTTP error with blank body). It now
fails on any error/status_code key and on a null response.
Why
Closes #13183.
Test plan
Failure-Class: none