Skip to content

feat: browser experiments with auth-safe exposure tracking - #280

Open
LiorMazig wants to merge 3 commits into
mainfrom
codex/experiments-sdk
Open

feat: browser experiments with auth-safe exposure tracking#280
LiorMazig wants to merge 3 commits into
mainfrom
codex/experiments-sdk

Conversation

@LiorMazig

@LiorMazig LiorMazig commented Sep 9, 2026

Copy link
Copy Markdown

Summary

Adds base44.experiments for browser feature-flag reads, auth-aware readiness/subscriptions, and experiment exposure tracking. Draft pending platform integration and complete validation; no stable package release or dependency changes.

Intent (for reviewers & PR Autofix)

What this PR does

Adds SDK-owned local experiment evaluation for browsers and request-scoped Workers, reactive common-auth identity, hydration snapshots, and acknowledged exposure delivery through native Analytics.

Key decisions & why

  • Public config is supplied by platform bootstrap/request context, not fetched per decision. Pure UTF-8 FNV-1a evaluation preserves existing assignments; 3,672 Python/SDK cases agree.
  • Experiments never initiate auth.me(). Browser user experiments with a token await the same client's common auth; cookie bootstrap identity cannot override a different token. Request clients never share user state.
  • Snapshots are non-tracking. React reads the hydration snapshot and tracks in an effect; Worker decision reads use isEnabled() and await flush(). Stable UUID/timestamp/auth survive three bounded delivery attempts.
  • Preview reads and Analytics opt-out do not generate exposures. No service-role experimentation or React dependency.

What NOT to touch

The stable package version and dependency lockfiles are unchanged intentionally. App ingress must strip/rebuild the context header; that header is not authentication. Do not reintroduce an experiments-only identity request.

Tradeoffs / follow-ups

  • Locked CI at 49cad18: 355 unit tests and type tests, lint, audit and preview package publishing passed. A pre-existing Check Wix Gateway Proxy workflow fails startup because its actions are not SHA-pinned; the same failure exists on main.
  • Matching platform context/ingestion must deploy with this SDK; stable release and existing-app adoption remain rollout gates.
  • Hydration consistency does not make localStorage-only authentication visible to SSR. Common app auth must gate user-experiment content. Delivery retries are memory-bound, not an offline-durable queue or exactly-once ingestion.

Testing

  • 39 focused tests passed: runtime reads/fallbacks, subscriptions/readiness, real auth integration, stale-response races, exposure payloads, auth pinning, deduplication, and analytics opt-out.
  • Those local tests used available Vitest 2.1.9 / Axios 1.13.6, not the repository's locked Vitest 4.1.9 / Axios 1.18.1. Scoped TypeScript 5.9.3 validation and git diff --check passed.
  • Locked npm ci is blocked by local registry/security access; offline cache is incomplete. Full unit/type tests, build, lint, and generated documentation remain unverified locally and require CI or restored dependency access.
  • Public types and JSDoc/pipeline registration included; no package or lockfile changes.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/sdk@0.8.48-pr.280.b5c6133

Prefer not to change any import paths? Install using npm alias so your code still imports @base44/sdk:

npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.48-pr.280.b5c6133"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/sdk": "npm:@base44-preview/sdk@0.8.48-pr.280.b5c6133"
  }
}

Preview published to npm registry — try new features instantly!

@LiorMazig

Copy link
Copy Markdown
Author

CI verification update:

  • Locked-dependency unit suite: 340 tests passed across 25 files, including the 39 new focused cases.
  • Type tests, lint, and preview build/publish passed.
  • Dependency audit did not complete: npm's audit endpoint returned HTTP 400 (retired quick endpoint / invalid request payload). This is an audit-service failure, not a reported vulnerability; no dependencies were changed.
  • Generated docs remain unverified locally. The platform adoption and blocked-storage attribution follow-ups in the intent brief still apply before release.

Stable @base44/sdk was not published. The preview package is available in the CI bot's comment.

@github-actions github-actions Bot added the docs-draft PR has auto-drafted documentation suggestions label Sep 9, 2026
@LiorMazig
LiorMazig marked this pull request as ready for review September 10, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-draft PR has auto-drafted documentation suggestions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant