feat(audience): mirror server-side event validation client-side [SDK-679]#821
Merged
Conversation
nattb8
force-pushed
the
feat/sdk-679-mirror-server-validation
branch
4 times, most recently
from
July 20, 2026 06:22
452b473 to
6426b86
Compare
Audience SDK — Build Size
SDK Size = build minus empty app. Change = vs baseline. Fails if any platform exceeds its absolute size limit. |
nattb8
force-pushed
the
feat/sdk-679-mirror-server-validation
branch
5 times, most recently
from
July 20, 2026 23:56
0d28d18 to
fc9ab2c
Compare
nattb8
marked this pull request as ready for review
July 21, 2026 01:24
nattb8
force-pushed
the
feat/sdk-679-mirror-server-validation
branch
from
July 21, 2026 01:32
fc9ab2c to
3eaae8a
Compare
Brings client-side validation to parity with the ingest API so bad events are caught and dropped locally instead of round-tripping to the server just to be rejected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
nattb8
force-pushed
the
feat/sdk-679-mirror-server-validation
branch
from
July 21, 2026 02:35
3eaae8a to
093f876
Compare
JCSanPedro
approved these changes
Jul 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
Ticket: SDK-679
Brings client-side validation in the Audience package to parity with the ingest API. Invalid calls (empty/malformed id, identical alias ids, a null/empty typed event) now throw immediately instead of dropping silently with a
Log.Warnthat's easy to miss; valid calls are unaffected and still enqueue as before. The passport-ID format check already covered part of this scope (bac4b2fc); this closes the rest.Alias()equality checkfromId == toId, matching the backend (ignoresidentityType)Identify()/Alias()/Track()caller-bug input (empty id, malformed passport id, identical alias ids, empty event name, nullIEvent)Log.Warnand silently droppedArgumentException/ArgumentNullException)Track()validation orderTrack(null)/Track("")atNoneconsent silently no-opped instead of throwing, unlikeIdentify()/Alias()Identify()/Alias()AudienceSample.cs) mirror accuracylogFlush); sample app gives it its own Ok/Err row with the message itself as the label, matching the web sample app's console-mirror instead of the generic "sdk" tag used for other SDK-sourced messagesConsent-gated no-ops (e.g.
Identify()below Full consent) and a buggy consumerIEvent.ToProperties()/EventNameimplementation still just log a warning: the first is routine flow-gating, not a caller bug; the second is third-party code we can't trust not to crash the game.Sample app (
AudienceSample.cs):OnAlias()/OnIdentify()already run throughRunAndLog, which catches and displays thrown exceptions, so no new plumbing was needed. TheOnAlias()mirror check now tracks only the one case it can still detect, consent below Full, since the id/equality checks it used to make now throw before reaching it. Added a live-fire UI test (Alias_SameId_Throws), matching the existing passport-ID test's pattern.Test plan
dotnet build src/Audience.Build/Audience.Tests/Audience.Tests.csproj— no errors, only pre-existing unrelated warningsdotnet test— 382 passed, 1 skipped (pre-existing), 0 failed; includes coverage converted fromLog.Warnassertions toAssert.Throws, new tests for the flush-outcome log on both success and failure, and regression tests provingTrack()throws even atNoneconsentdotnet format --verify-no-changeson all changed files — cleanAlias_SameId_Throws,Identify_PassportWithInvalidIdFormat_Throws, and theAudienceSample.cssample app fix (including the new flush-outcome log row)🤖 Generated with Claude Code