feat(audience-diagnostics): expose SDK state as public API#708
Merged
ImmutableJeffrey merged 2 commits intofeat/sdk-146-unityfrom Apr 24, 2026
Merged
feat(audience-diagnostics): expose SDK state as public API#708ImmutableJeffrey merged 2 commits intofeat/sdk-146-unityfrom
ImmutableJeffrey merged 2 commits intofeat/sdk-146-unityfrom
Conversation
Adds six public getters on ImmutableAudience so studios can build debug HUDs, settings-screen displays, and integration tests without reaching into internals: - Initialized: true between Init and Shutdown - CurrentConsent: live consent level, reflects any SetConsent - UserId: last Identify value, null below Full consent or pre-Identify - AnonymousId: persisted id when consent allows tracking, null otherwise - SessionId: current session id, null when no session is active - QueueSize: in-memory plus on-disk event count awaiting send Every getter is safe to call any time — before Init, after Shutdown, from any thread — and returns a safe default when the SDK cannot answer. Values are snapshots that can drift a tick against the background drain thread; fine for display, do not use for invariants. EventQueue gains an internal InMemoryCount property so QueueSize can sum memory and disk without locking the drain thread. Tests cover every getter's lifecycle edges: pre-Init defaults, Init/Shutdown flips, consent downgrade effects, Reset clearing UserId, and QueueSize growing across Init's session_start/game_launch plus an explicit Track. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
nattb8
reviewed
Apr 24, 2026
Addresses PR #708 review: adds per-getter comments for `Initialized`, `UserId`, `SessionId` so all six public getters document their own non-obvious semantics, not just the three that did before. The block header above the getters still carries the shared contract (zero-value default outside Init..Shutdown, tick-level snapshot); the new lines only add what a reader cannot derive from the member name. 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
ImmutableAudience:Initialized,CurrentConsent,UserId,AnonymousId,SessionId,QueueSize.EventQueue.InMemoryCount(internal) soQueueSizecan sum the in-memory queue and on-disk store without holding the drain lock.false/null/0/ConsentLevel.None) when the SDK is not in a state that can answer; values are tick-level snapshots.Linear: SDK-243.