test: restore coverage lost in #537 - #538
Merged
Merged
Conversation
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
enabled auto-merge (squash)
August 6, 2026 05:05
razor-x
disabled auto-merge
August 6, 2026 05:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #537. After it merged, I audited every deleted spec assertion against what remains on
mainand 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.rbclaiming its coverage was folded intohttp_error_specagainst 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 inseam_api_error_response?only the content-type guard stayed covered. Three fall-through paths lost their specs:rescue JSON::ParserError)errorobjecterrorobject without stringtypeandmessagefieldsRestored 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 ofResourceErrorsSupportandResourceWarningsSupport— the modules that convert error/warning hashes intoResourceError/ResourceWarningobjects with parsedcreated_atdates. 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_codeanywhere 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 smallDeepHashAccessorexample for hashes inside arrays, which those specs exercised indirectly.One correction to the #537 description
#537 said the deleted action-attempt resource spec “stubbed
:geton/action_attempts/getwhile the SDK POSTs to it.” That was wrong:Helpers::ActionAttempt.update_action_attemptdoes useclient.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
Up from 77 on
main: +4 malformed response, +4 resource errors/warnings, +1 accessor.rake lintis clean.The Python SDK never had the malformed-response coverage either; seamapi/python#599 adds it there for parity.