Skip to content

test: restore coverage lost in #537 - #538

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

test: restore coverage lost in #537#538
razor-x merged 2 commits 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 #537. After it merged, I audited every deleted spec assertion against what remains on main and found two places where real SDK behavior lost its only coverage. This restores both — specs only, no SDK changes.

What the audit found

1. Malformed error response handling (spec/seam_client/malformed_response_spec.rb)

#537 deleted spec/seam_client/request_spec.rb claiming its coverage was folded into http_error_spec against the fake. That was only partly true. The fake's simulated outage responds with a bare 503 — no content type, empty body — so of the branches in seam_api_error_response? only the content-type guard stayed covered. Three fall-through paths lost their specs:

  • malformed JSON with a JSON content type (rescue JSON::ParserError)
  • a JSON body without an error object
  • an error object without string type and message fields

Restored with WebMock, which is the right tool here for the same reason it backs the headers and retry specs: the fake cannot produce these responses.

2. Resource error and warning coercion (spec/resources/resource_errors_spec.rb)

#537 deleted the per-route client specs as generated-code tests, but three of them (devices_spec, access_codes_spec, connected_accounts_spec) were the only coverage of ResourceErrorsSupport and ResourceWarningsSupport — the modules that convert error/warning hashes into ResourceError / ResourceWarning objects with parsed created_at dates. Codegen marks these as hand-maintained (“durable”) static files, so they are SDK behavior, not generated code. After #537: zero assertions on .errors.first.error_code anywhere in the suite.

Restored at the resource level where the behavior lives, including the [] default when a resource carries no errors or warnings, plus a small DeepHashAccessor example for hashes inside arrays, which those specs exercised indirectly.

One correction to the #537 description

#537 said the deleted action-attempt resource spec “stubbed :get on /action_attempts/get while the SDK POSTs to it.” That was wrong: Helpers::ActionAttempt.update_action_attempt does use client.get, so the old stub was consistent with the helper. No coverage was lost there — the wait specs exercise the same path against the fake — but the stated justification was incorrect.

Verification

86 examples, 0 failures

Up from 77 on main: +4 malformed response, +4 resource errors/warnings, +1 accessor. rake lint is clean.

The Python SDK never had the malformed-response coverage either; seamapi/python#599 adds it there for parity.

claude added 2 commits August 6, 2026 04:44
PR #537 deleted spec/seam_client/request_spec.rb and claimed its coverage
was folded into http_error_spec against the fake. That was only partly
true: the fake's simulated outage responds with no content type and an
empty body, so of the branches in seam_api_error_response? only the
content type guard stayed covered. The malformed JSON, JSON without an
error object, and error object without string fields branches all lost
coverage.

Restore them with WebMock, which is the right tool here for the same
reason it backs the headers and retry specs: the fake cannot produce
these responses.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DzapiU8A9NMdyoTybL9xB
PR #537 deleted the per-route client specs as generated-code tests, but
three of them were the only coverage of ResourceErrorsSupport and
ResourceWarningsSupport, the hand-maintained modules that convert error
and warning hashes into ResourceError and ResourceWarning objects with
parsed dates. Cover that behavior at the resource level, where it lives,
including the empty default when a resource carries no errors or
warnings.

Also cover DeepHashAccessor wrapping hashes inside arrays, which the
deleted specs exercised indirectly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DzapiU8A9NMdyoTybL9xB
@razor-x
razor-x enabled auto-merge (squash) August 6, 2026 05:05
@razor-x
razor-x disabled auto-merge August 6, 2026 05:05
@razor-x
razor-x merged commit 76ef6c4 into main Aug 6, 2026
17 checks passed
@razor-x
razor-x deleted the claude/ruby-python-sdk-testing-2tqetp branch August 6, 2026 05:05
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