Skip to content

test: cover malformed error responses - #599

Merged
razor-x merged 1 commit into
mainfrom
claude/ruby-python-sdk-testing-2tqetp
Aug 6, 2026
Merged

test: cover malformed error responses#599
razor-x merged 1 commit into
mainfrom
claude/ruby-python-sdk-testing-2tqetp

Conversation

@razor-x

@razor-x razor-x commented Aug 6, 2026

Copy link
Copy Markdown
Member

Follow-up to #598. After it merged, I audited the deleted tests against what remains on main: nothing was lost — both deleted test/workspaces files covered generated route methods, and workspace creation stayed covered in the multi-workspace tests. But the audit surfaced a gap the suite has always had, which the Ruby SDK briefly lost in the sibling PR and is getting restored in seamapi/ruby#538 — so this closes it here too for parity.

The gap

SeamHttpClient._handle_error_response splits error responses in two: standard Seam error bodies become SeamHttpApiError, and everything else falls through is_api_error_response to raise_for_status. Only the first half was covered. The suite never exercised:

  • a non-JSON body (text/plain)
  • malformed JSON served with a JSON content type
  • a JSON body without an error object
  • an error object without string type and message fields

All four now assert a plain niquests.HTTPError with the original status, driven by the recording server — the fake cannot produce these responses. The recording server grows an optional third tuple element to override the content type, which is what lets it serve malformed JSON.

Tests only, no SDK changes.

Verification

61 passed in 30.37s

black --check, pylint (10.00/10) clean.


Generated by Claude Code

The error handling in SeamHttpClient distinguishes standard Seam error
bodies, which become SeamHttpApiError, from everything else, which falls
through is_api_error_response to raise_for_status. Only the first half
was covered: the suite never exercised a non-JSON body, malformed JSON, a
JSON body without an error object, or an error object without string
type and message fields.

Cover all four against the recording server, which grows an optional
content type override so it can serve malformed JSON. The fake cannot
produce these responses.

This closes the same gap just restored in the Ruby SDK, where the
equivalent branches briefly lost their specs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DzapiU8A9NMdyoTybL9xB
@razor-x
razor-x requested a review from a team as a code owner August 6, 2026 04:55
@razor-x
razor-x merged commit b0bc49d into main Aug 6, 2026
18 checks passed
@razor-x
razor-x deleted the claude/ruby-python-sdk-testing-2tqetp branch August 6, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants