SDK-981: Guarantee anonymousId is always sent on Unity SDK audience events - #829
Open
nattb8 wants to merge 1 commit into
Open
SDK-981: Guarantee anonymousId is always sent on Unity SDK audience events#829nattb8 wants to merge 1 commit into
nattb8 wants to merge 1 commit into
Conversation
nattb8
force-pushed
the
feat/audience-alias-guaranteed-anon-id
branch
from
September 11, 2026 01:43
0da3a8a to
3457068
Compare
Identity.LoadOrGenerate previously swallowed disk I/O failures and left the cached anonymousId/deviceId null, so an event could silently ship without an anonymousId. Ids are now computed and cached in memory before persistence is attempted, so a write failure only costs persistence across a restart, never a value already known to be correct, e.g. an anonId read successfully from a legacy-format file whose migration write then fails. Alias messages never carried anonymousId at all. It doesn't drive the merge (fromId/toId do), but per the REST API docs it should still be attached so alias messages have the same shape as the rest of an integration's traffic, matching ts-immutable-sdk's behavior. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
nattb8
force-pushed
the
feat/audience-alias-guaranteed-anon-id
branch
from
September 11, 2026 02:06
3457068 to
3a18fec
Compare
Audience SDK — Build Size
SDK Size = build minus empty app. Change = vs baseline. Fails if any platform exceeds its absolute size limit. |
nattb8
marked this pull request as ready for review
September 11, 2026 03:34
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
Identity.csLoadOrGeneratenow falls back to an in-memory-only id when disk read/write fails, instead of leaving the cached anonymousId/deviceId nullMessageBuilder.csAliasgains ananonymousIdparameter (previously had none at all)ImmutableAudience.csAlias()now resolves and passesanonymousIdalongsidedeviceIdLog.csBrings the Unity SDK's guarantee in line with ts-immutable-sdk, which already guarantees anonymousId on every event via its shared
baseMessage()/BaseMessagetype. Also documented on the REST API side (SDK-982): anonymousId doesn't drive the alias merge (fromId/toIddo), but is required so every message type has the same shape.Test plan
dotnet testinsrc/Audience.Build/Audience.Tests: 399 passed, 1 skipped, 0 failedIdentity.PersistenceFails_FallsBackToInMemoryId,Identity.PersistenceFails_InMemoryIdStableForRestOfSession,MessageBuilder.Alias_AnonymousId_PresentWhenProvided/_AbsentWhenNull,ImmutableAudience.Alias_FullConsent_IncludesAnonymousId🤖 Generated with Claude Code