feat(audience): SDK-220 retrofits — gzip gate, Log, JsonReader, paths, comments#692
Merged
Conversation
Plan §6.7 has v1 shipping plain UTF-8 JSON because platform-services/services/audience does not yet decompress Content-Encoding: gzip on POST /v1/audience/messages. Sending a gzipped body today returns 400 for every batch. Guards the gzip path, the Gzip utility, and the gzip-specific tests behind the scripting define IMMUTABLE_AUDIENCE_GZIP. Default (flag off) sends plain JSON with no Content-Encoding header. Flip the define on once the backend middleware lands. - HttpTransport: wraps the gzip branch in #if; the default branch uses StringContent plain JSON. - Gzip.cs and GzipTests.cs compile only under the flag. - HttpTransportTests: gzip assertion tightened to check Content-Encoding. Adds a default-path test asserting no Content-Encoding is set and the body parses as plain JSON. Verified: - dotnet test: 151 passed (default, gzip off) - dotnet test -p:DefineConstants=IMMUTABLE_AUDIENCE_GZIP: 154 passed Linear: SDK-147 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Converts the remaining XML doc comments in the already-merged SDK pieces (DiskStore, EventQueue, HttpTransport, Gzip, Constants, ConsentLevel, AudienceConfig, ImmutableAudience scaffold, and the transport tests) to plain // comments. Brings them in line with the style used by the incoming SDK-147 commits. No behaviour change.
Adds Core/AudiencePaths.cs as the single source of truth for the
imtbl_audience/{identity,consent,queue} on-disk layout. Replaces
Identity's hardcoded Path.Combine calls with AudiencePaths.IdentityFile
and AudiencePaths.AudienceDir. Prepares the namespace for consent and
queue path consumers that land in subsequent commits.
Complements the existing Utility/Json writer with a reader half. Reflection-free — parses the subset of JSON that Json.cs emits (objects, strings, numbers, booleans, null, arrays). Throws FormatException on malformed input. Used wherever the SDK needs to deserialise its own previously-written payloads.
Debug/Warn logger used by SDK internals for diagnostics. Writer is injectable so tests can capture output and AudienceUnityHooks can install Debug.Log as the sink under Unity. Debug calls are gated by an Enabled toggle (AudienceConfig.Debug); Warn always emits. Falls back to Console.WriteLine when no Writer is installed so headless .NET consumers still see output.
nattb8
approved these changes
Apr 21, 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
IMMUTABLE_AUDIENCE_GZIPscripting define.//style.imtbl_audience/*path construction inAudiencePaths.JsonReaderutility.Logutility with an injectable writer.Linear: SDK-220, SDK-216 (the
//-style convention applied here is the chosen resolution for SDK-216's "use/// <summary>" ask on the audience surface).