fix(audience-transport): surface 4xx body + messages envelope#710
Merged
ImmutableJeffrey merged 1 commit intofeat/audience-envfrom Apr 24, 2026
Merged
Conversation
…...]} envelope
Two bugs that together kept the QuickStart sample from ever shipping
events successfully:
1. The 4xx branch of SendBatchAsync reported only the status code.
Now reads response.Content (truncated to 500 chars) so the
backend's validation message lands in the onError callback —
no more silently dropped batches with "something is wrong" as
the only signal.
2. BuildPayload wrapped events in {"batch":[...]}. The backend's
MessagesRequest schema expects the top-level key "messages";
every send 400'd. Envelope switched, tests updated, and the
GzipTests fixture aligned to the real wire shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
nattb8
approved these changes
Apr 24, 2026
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.
Summary
HttpTransport.SendBatchAsync— 4xx branch readsresponse.Content(truncated to 500 chars) and includes it in theonErrormessage. Previously only the status code reached the callback, masking the backend's validation diagnostic (e.g."invalid eventName format at /batch/0/eventName").HttpTransport.BuildPayload— emits{"messages":[...]}instead of{"batch":[...]}to match the backend'sMessagesRequestschema; every send was 400'ing before the fix.HttpTransportTests— renames the URL-routing tests to env-explicit names (_DefaultEnvironment_HitsSandbox,_ExplicitDev_HitsDev,_ExplicitProduction_HitsProduction); asserts the 400 body reaches theonErrorcallback.HttpTransportTestsandGzipTestsfixtures updated to the{"messages":[...]}envelope.Linear: SDK-245. Follow-up to SDK-234.