Adopt the SDK's response-body cap - #272
Merged
Merged
Conversation
hey-sdk v0.13.0 bounds its own reads: the transport NewClient builds caps JSON and HTML response bodies at 16 MiB, success and error alike, so the interim RoundTripper in internal/cmd/sdk_transport.go comes out. What the SDK does that the interim cap did not is keep an oversized error response's status: the refusal arrives as the *hey.Error for the status wrapping hey.ErrResponseTooLarge. The thread loader therefore classifies a failed message read by status before size — an oversized 500, 429 or 401 is still the service failing and stops the fan-out, an oversized 404 is still a missing message, and only an oversized success marks the entry over_limit. Closes #248
Contributor
There was a problem hiding this comment.
Pull request overview
Adopts the SDK’s built-in response-body cap and removes the temporary CLI transport.
Changes:
- Upgrades
hey-sdkto v0.13.0. - Classifies oversized responses by HTTP status before size.
- Adds end-to-end and unit coverage for oversized responses.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
AGENTS.md |
Documents SDK response limits and classification. |
go.mod |
Upgrades the SDK dependency. |
go.sum |
Updates SDK checksums. |
internal/cmd/sdk.go |
Removes the interim capped transport. |
internal/cmd/sdk_transport.go |
Deletes the superseded transport. |
internal/cmd/sdk_transport_test.go |
Deletes tests for the superseded transport. |
internal/cmd/thread_partial_test.go |
Tests the SDK’s default response limit. |
internal/threadload/sdk.go |
Classifies status-bearing oversized errors correctly. |
internal/threadload/sdk_test.go |
Covers oversized success and error responses. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
hey-sdk v0.13.0 (basecamp/hey-sdk#105) bounds its own reads: the transport
NewClientbuilds caps JSON and HTML response bodies athey.DefaultMaxResponseBodyBytes(16 MiB), success and error alike, decompressed, leaving blobs to the SDK's own streaming and caps. The interim RoundTripper ininternal/cmd/sdk_transport.gowas written to be replaced by exactly that, so it comes out.What the SDK does that the interim cap did not is keep an oversized error response's status: the refusal arrives as the
*hey.Errorfor the status wrappinghey.ErrResponseTooLarge. The thread loader therefore classifies a failed message read by status before size:failed, notover_limitover_limitCoverage:
TestThreadsMarkAnOversizedMessageOverLimitnow proves theover_limitpath against the SDK's cap end to end; newinternal/threadload/sdk_test.goproves the classification through a real client for the statuses the generated client answers immediately (200/401/404), and unit-tests the 429/500 shapes directly — those two would each cost seven seconds of the generated client's retry backoff through a real server, and the SDK's ownbody_limittests pin that error shape.Closes #248
Summary by cubic
Adopts
github.com/basecamp/hey-sdk/gov0.13.0 to cap JSON/HTML response bodies athey.DefaultMaxResponseBodyBytes(16 MiB, decompressed) and removes our interim transport. Updates thread loading to classify oversized responses by HTTP status first so we don’t mislabel errors as over_limit, and updates the NixvendorHash.*hey.Errorwithhey.ErrResponseTooLargeas the cause;internal/threadload/sdk.gonow handles this viaclassifyMessageError.internal/cmd/sdk_transport.goand its tests; removes customWithTransportusage; tests now usehey.DefaultMaxResponseBodyBytesand addinternal/threadload/sdk_test.go;AGENTS.mddocuments the cap and classification; to change the cap, usehey.WithMaxResponseBodyBytes(no opt‑out; zero/negative uses the default); updatesnix/package.nixvendorHash.Written for commit 43c306a. Summary will update on new commits.