Skip to content

fix(audience): remove environment from public interfaces#2851

Merged
bkbooth merged 8 commits intomainfrom
claude/adoring-johnson
Apr 14, 2026
Merged

fix(audience): remove environment from public interfaces#2851
bkbooth merged 8 commits intomainfrom
claude/adoring-johnson

Conversation

@bkbooth
Copy link
Copy Markdown
Contributor

@bkbooth bkbooth commented Apr 13, 2026

Summary

  • Removes Environment type and environment parameter from all public interfaces (AudienceConfig, PixelInitOptions, SnippetOptions, createConsentManager)
  • URL resolution is now a fully internal implementation detail — getBaseUrl, INGEST_PATH, CONSENT_PATH, FLUSH_INTERVAL_MS, and FLUSH_SIZE are no longer exported from @imtbl/audience-core. MessageQueue and createConsentManager resolve endpoints and defaults internally from the publishable key
  • Test keys (pk_imapik-test-*) route to api.sandbox.immutable.com, all others to api.immutable.com
  • Optional baseUrl override on AudienceConfig and PixelInitOptions for custom endpoint routing (not exposed in snippet generation)
  • Flush interval/size defaults are now internal to MessageQueue, with optional overrides via MessageQueueOptions
  • Drops @imtbl/pixel version from 1.0.00.1.0 to signal alpha status before public release

Test plan

  • Core tests pass (150 tests)
  • Pixel tests pass (74 tests)
  • SDK tests pass (pre-existing @imtbl/metrics resolution issue in worktree is unrelated)
  • TypeScript compilation clean across all three packages
  • No public interface references environment
  • No public source comments reference internal infrastructure

Resolves SDK-120

🤖 Generated with Claude Code

bkbooth and others added 2 commits April 14, 2026 09:46
The publishable key determines test vs production routing internally.
Removes the Environment type and environment parameter from
AudienceConfig, PixelInitOptions, SnippetOptions, and
createConsentManager. getBaseUrl now routes by key prefix
(pk_imapik-test-* → api.dev, all others → api.immutable.com).

SDK-120

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pre-1.0 version signals interface instability before public release.

SDK-120

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bkbooth bkbooth requested review from a team as code owners April 13, 2026 23:51
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 13, 2026

View your CI Pipeline Execution ↗ for commit 9b55061

Command Status Duration Result
nx affected -t build,lint,test ✅ Succeeded 15s View ↗
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 8s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-14 01:21:09 UTC

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

✅ Pixel Bundle Size — @imtbl/pixel

Metric Size Delta vs main
Gzipped 5412 bytes (5.28 KB) -23 bytes
Raw (minified) 14741 bytes -3 bytes

Budget: 10.00 KB gzipped (warn at 8.00 KB)

getBaseUrl is no longer exported from core — MessageQueue resolves
the ingest endpoint internally from the publishable key it already
receives. SDK and pixel no longer import getBaseUrl or INGEST_PATH
for URL construction.

SDK-120

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread packages/audience/core/src/config.ts Outdated
bkbooth and others added 5 commits April 14, 2026 10:46
…o MessageQueue

Move flushIntervalMs, flushSize, INGEST_PATH, and CONSENT_PATH out of
core's public exports and into MessageQueue/consent internals. SDK and
pixel consumers no longer need to know about flush tuning or endpoint
paths — they just pass a publishable key and optional overrides.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test keys (pk_imapik-test-*) now route to api.sandbox.immutable.com
(publicly accessible test infra) instead of api.dev.immutable.com.

For internal dev environments behind VPN (e.g. Game Page), an optional
baseUrl override is available on AudienceConfig and PixelInitOptions.
When set it bypasses key-prefix routing entirely. This is intentionally
omitted from snippet generation and public documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	packages/audience/pixel/src/snippet.ts
…getBaseUrl

getBaseUrl stays focused on key-prefix routing. The baseUrl override
is applied with a simple ?? at each call site (queue constructor and
consent notifyBackend) rather than threading it through getBaseUrl.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove references to internal infrastructure from public source code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bkbooth bkbooth enabled auto-merge April 14, 2026 01:25
@bkbooth bkbooth added this pull request to the merge queue Apr 14, 2026
Merged via the queue into main with commit 71348bc Apr 14, 2026
10 checks passed
@bkbooth bkbooth deleted the claude/adoring-johnson branch April 14, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants