feat(audience): remove sandbox routing, add TestMode (SDK-352, SDK-353)#781
Merged
Merged
Conversation
Sandbox removal (SDK-352): - Remove TestKeyPrefix, SandboxBaseUrl, and key-prefix-based URL routing. All keys now resolve to https://api.immutable.com by default; BaseUrl override still works for internal dev environments. - Remove WarnIfKeyEnvironmentMismatch and its log messages. - Simplify BaseUrl/URL helper signatures (drop unused publishableKey param). - Delete PublishableKeyPrefixTests.cs and its .meta file. - Update ConstantsTests, ConsentSyncTests, HttpTransportTests. Test mode (SDK-353): - Add TestMode bool to AudienceConfig (default false). When true, every outbound event carries test: true so the backend can filter test traffic. - Add testMode param to MessageBuilder.Track/Identify/Alias; all call sites in ImmutableAudience pass config.TestMode. - Add TestMode tests to AudienceConfigTests and MessageBuilderTests. Sample app: - Add test-mode Toggle to UXML (default true) with tick-label workaround matching the existing debug toggle. - Wire TestMode through InitForm → BuildAudienceConfig → BuildConfigEcho. - Apply same tick-label injection to test-mode and mobile-attribution toggles. - Remove prod-warning banner (permanently true now that all keys go to prod). - Replace SandboxBaseUrl with ExplicitBaseUrl in test constants; update live-fire tests and stale comments. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nattb8
approved these changes
May 14, 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.
Closes SDK-352, SDK-353. Sub-issue of SDK-351.
What changed
Sandbox removal (SDK-352)
https://api.immutable.com. Key-prefix routing (pk_imapik-test-→ sandbox) is gone.TestKeyPrefix,SandboxBaseUrl,WarnIfKeyEnvironmentMismatch, and the two associated log messages.BaseUrl()/URL helper signatures —publishableKeyparam dropped.BaseUrloverride still works for internal dev environments.PublishableKeyPrefixTests.cs(tested removed sandbox logic).Test mode (SDK-353)
TestMode booltoAudienceConfig(defaultfalse). Whentrue, all outbound events carrytest: trueso the backend can filter them from production data.Sample app
true) with the same tick-label fix applied to DEBUG and MOBILE ATTRIBUTION toggles.Test plan
Note
Medium Risk
Changes default backend targeting (all keys now send to production unless
BaseUrloverride is set) and alters the outbound event schema whenTestModeis enabled, so misconfiguration could impact where data is sent and how analytics are filtered.Overview
All publishable keys now default to the production endpoint; key-prefix sandbox routing (
pk_imapik-test-→ sandbox) and its related constants, URL helpers, warnings, and tests have been removed, withConstants.*Url()helpers simplified to no longer require a publishable key.Adds
AudienceConfig.TestMode(defaultfalse) and threads it throughImmutableAudience→MessageBuildersotrack/identify/aliaspayloads optionally includetest: true.Updates the Unity sample app to match: removes the prod-warning banner, adds a
TEST MODEtoggle (default on) and echoes the config, and adjusts live-fire/unit tests to the new production-default + explicit-override behavior.Reviewed by Cursor Bugbot for commit 97fd5d1. Bugbot is set up for automated code reviews on this repo. Configure here.