Skip to content

feat(audience-sdk)!: drop Identify/Alias string-identityType overloads (SDK-271)#723

Merged
ImmutableJeffrey merged 1 commit into
mainfrom
feat/sdk-271-drop-identifyalias-string-overloads
Apr 30, 2026
Merged

feat(audience-sdk)!: drop Identify/Alias string-identityType overloads (SDK-271)#723
ImmutableJeffrey merged 1 commit into
mainfrom
feat/sdk-271-drop-identifyalias-string-overloads

Conversation

@ImmutableJeffrey

Copy link
Copy Markdown
Collaborator

Summary

Removes the two Identify and Alias overloads on ImmutableAudience that take an identity type as a plain string. Studios now have only the overloads that take the typed IdentityType enum.

Before

ImmutableAudience.Identify("76561198012345", "steam");
ImmutableAudience.Alias("steam-id", "steam", "passport-id", "passport");

After

ImmutableAudience.Identify("76561198012345", IdentityType.Steam);
ImmutableAudience.Alias("steam-id", IdentityType.Steam, "passport-id", IdentityType.Passport);

Studios with a custom identity provider that isn't in the enum should use IdentityType.Custom.

Why

The Audience backend's IdentityType is a closed enum. Anything outside the enum is rejected with a 4xx at validation. The string overloads looked like an extensibility point but produced AudienceErrorCode.ValidationRejected for any value not already in the enum. The TypeScript Audience SDK never exposed these overloads. This change brings Unity in line and removes a way for studios to accidentally ship events the backend will reject.

Implementation

  • ImmutableAudience.Identify(string, IdentityType, Dictionary?) and ImmutableAudience.Alias(string, IdentityType, string, IdentityType) now contain the validation, lock, and enqueue logic directly. The wire-format conversion (.ToLowercaseString()) happens inline at the MessageBuilder boundary.
  • 4 test call sites in ImmutableAudienceTests.cs migrated to the enum form.

Breaking change

  • Public API removal flagged with the feat!: conventional-commit prefix. Studios calling the string overloads must migrate per the table above.

PR stack

dotnet test passes (274 / 274; 1 pre-existing skip).

Linear: SDK-271

@ImmutableJeffrey ImmutableJeffrey requested review from a team as code owners April 30, 2026 09:19
nattb8
nattb8 previously approved these changes Apr 30, 2026
@ImmutableJeffrey ImmutableJeffrey force-pushed the feat/sdk-271-drop-identifyalias-string-overloads branch from 4abf62e to 38357db Compare April 30, 2026 10:47
Base automatically changed from feat/sdk-216-xml-docs to main April 30, 2026 11:22
@ImmutableJeffrey ImmutableJeffrey dismissed nattb8’s stale review April 30, 2026 11:22

The base branch was changed.

The Audience backend accepts only the closed IdentityType enum. The
string-identityType overloads on Identify and Alias were vestigial:
anything outside the enum gets rejected at validation, and studios
with a proprietary system already have IdentityType.Custom as the
escape hatch. Removes the overloads to match the TS SDK shape and
reduce footguns.

BREAKING CHANGE: callers of Identify(string, string, ...) or
Alias(string, string, string, string) must migrate to the IdentityType
overload. Direct mapping: "steam" -> IdentityType.Steam, "passport" ->
IdentityType.Passport, etc., per IdentityTypeExtensions.ToLowercaseString.

- ImmutableAudience.cs: consolidates each pair into the IdentityType
  overload, calling .ToLowercaseString() inline at the MessageBuilder
  call site. Drops the two string overloads and their wrappers.
- ImmutableAudienceTests.cs: migrates four test calls from string to
  enum form (Identify and Alias).

dotnet test: 274 passed, 0 failed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ImmutableJeffrey ImmutableJeffrey force-pushed the feat/sdk-271-drop-identifyalias-string-overloads branch from 38357db to f8e0fa7 Compare April 30, 2026 11:29
@ImmutableJeffrey ImmutableJeffrey merged commit 740656c into main Apr 30, 2026
31 checks passed
@ImmutableJeffrey ImmutableJeffrey deleted the feat/sdk-271-drop-identifyalias-string-overloads branch April 30, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants