Repository navigation
fix(app): keep staging routing to opted-in iOS TestFlight builds - #10214
Merged
Merged
Conversation
Adds Env.stagingApiUrl, isStagingConfigured and isUsingStagingApi backed by the STAGING_API_URL environment field. These only describe the configured staging backend; validateStartupRouting still pins every production-family build.
Defaults to production, so a TestFlight install reaches staging only after the user explicitly opts in.
Staging is selected at startup solely inside the TestFlight branch and only when the user opted in. isTestFlight() is false off iOS, so Android and store builds keep the production backend. Restores the staging banner for opted-in builds.
Gated on Env.isTestFlight && Env.isStagingConfigured, so it is reachable only from an iOS TestFlight build with a staging backend configured.
Pins the override inside the TestFlight branch behind the opt-in preference and asserts no build-identity flag can select staging.
Android workflows carry no staging URL, so an Android build has no staging backend to select even if the runtime gate were bypassed.
Git-on-my-level
added a commit
that referenced
this pull request
Jul 21, 2026
## Summary Locks production-family customer data-plane continuity across mobile and macOS. - Removes the newly reintroduced TestFlight staging override: TestFlight is a distribution channel, not a separate customer/account universe. - Adds locked `INV-DATA-1`, requiring stable, internal, beta, TestFlight, Play Internal, and Omi Beta to use canonical production customer services. - Extends the deterministic routing guard to pin all production Codemagic mobile workflows plus the macOS Python and desktop APIs, reject legacy beta/staging routing selectors, and assert the macOS Beta identity + shipped Firestore project. - Makes macOS production-family endpoint resolution ignore process/bundled endpoint contamination. Development and explicitly signed external-preview identities retain their distinct controlled seam. ## Incident evidence The prior Android regression was introduced by `52c1920d64` via `OMI_BETA_RELEASE_RING`, then removed after it reached main. During this work, `origin/main` reintroduced an iOS TestFlight-only `STAGING_API_URL` option in #10214. That option still violates the same customer-data continuity boundary, so this PR removes it and prevents reintroduction. ## Product invariants affected - INV-AUTH-1 — this PR changes `codemagic.yaml`, which is also an existing protected auth-artifact surface; it does not change session invalidation behavior. - INV-DATA-1 — production-family customer data plane remains canonical production across every release cohort. ## Verification Passed: ```text python3 .github/scripts/test_check_mobile_production_routing.py # 7 tests passed python3 .github/scripts/check-mobile-production-routing.py cd app && flutter test test/unit/env_test.dart test/providers/capture_provider_test.dart # 74 tests passed ``` Attempted targeted macOS Swift package tests (`APIClientRoutingTests|ExternalPreviewBuildTests`). Dependency compilation exhausted the host volume (120 MiB free) before compiling this PR's Swift sources; the generated `.build` directory was removed, restoring 3.9 GiB. A later local pre-push attempt also could not complete the macOS dependency lane because SwiftPM's remote fetch did not expose the lockfile-pinned FluidAudio commit, even though it was present in the local cache. The focused source-level mutation tests and Flutter regression tests above passed. CI should run the targeted Swift suite on a provisioned runner. ## Failure class Failure-Class: new
undivisible
pushed a commit
to undivisible/omi
that referenced
this pull request
Sep 29, 2026
## Summary Locks production-family customer data-plane continuity across mobile and macOS. - Removes the newly reintroduced TestFlight staging override: TestFlight is a distribution channel, not a separate customer/account universe. - Adds locked `INV-DATA-1`, requiring stable, internal, beta, TestFlight, Play Internal, and Omi Beta to use canonical production customer services. - Extends the deterministic routing guard to pin all production Codemagic mobile workflows plus the macOS Python and desktop APIs, reject legacy beta/staging routing selectors, and assert the macOS Beta identity + shipped Firestore project. - Makes macOS production-family endpoint resolution ignore process/bundled endpoint contamination. Development and explicitly signed external-preview identities retain their distinct controlled seam. ## Incident evidence The prior Android regression was introduced by `e5e971fa37` via `OMI_BETA_RELEASE_RING`, then removed after it reached main. During this work, `origin/main` reintroduced an iOS TestFlight-only `STAGING_API_URL` option in BasedHardware#10214. That option still violates the same customer-data continuity boundary, so this PR removes it and prevents reintroduction. ## Product invariants affected - INV-AUTH-1 — this PR changes `codemagic.yaml`, which is also an existing protected auth-artifact surface; it does not change session invalidation behavior. - INV-DATA-1 — production-family customer data plane remains canonical production across every release cohort. ## Verification Passed: ```text python3 .github/scripts/test_check_mobile_production_routing.py # 7 tests passed python3 .github/scripts/check-mobile-production-routing.py cd app && flutter test test/unit/env_test.dart test/providers/capture_provider_test.dart # 74 tests passed ``` Attempted targeted macOS Swift package tests (`APIClientRoutingTests|ExternalPreviewBuildTests`). Dependency compilation exhausted the host volume (120 MiB free) before compiling this PR's Swift sources; the generated `.build` directory was removed, restoring 3.9 GiB. A later local pre-push attempt also could not complete the macOS dependency lane because SwiftPM's remote fetch did not expose the lockfile-pinned FluidAudio commit, even though it was present in the local cache. The focused source-level mutation tests and Flutter regression tests above passed. CI should run the targeted Swift suite on a provisioned runner. ## Failure class Failure-Class: new
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.
Problem
Android beta builds were reaching the staging backend. Staging is meant to be an
iOS TestFlight-only, opt-in capability.
Change
Restores staging selection as an iOS TestFlight-only, opt-in path, and keeps
every other production-family build on production.
Env.stagingApiUrl/isStagingConfigured/isUsingStagingApi, backed by aSTAGING_API_URLenvied field on both prod and dev env classes.testFlightApiEnvironmentpreference, defaulting toproduction— aTestFlight install only reaches staging after an explicit opt-in.
main.dartselects staging solely inside theisTestFlightbranch, and onlywhen that preference is set. Restores the orange
STAGINGbanner.Env.isTestFlight && Env.isStagingConfigured.codemagic.yamlbakesSTAGING_API_URLinto the iOS workflows only.Why Android cannot reach staging
Three independent layers, any one of which is sufficient:
EnvironmentDetector.isTestFlight()returnsfalseunlessPlatform.isIOS,so the override never runs on Android.
STAGING_API_URL, so there is no staging backend toselect even if the runtime gate were bypassed.
Env.validateStartupRoutingstill hard-pins every production-family build'sbaked config to
https://api.omi.me/before networking starts.Selection is driven only by runtime TestFlight detection plus a user opt-in — no
build-identity/compile-time flag can place a build in staging, and a regression
test asserts that.
Tests
test/unit/env_test.dart: newstaging routing stays TestFlight-onlygroup —the override stays nested under
isTestFlightbehind the opt-in, and nobuild-identity flag can select staging. 11/11 pass.
test/providers/capture_provider_test.dart+env_test.dart: 77/77 pass.bash scripts/analyze_ratchet.sh: passed (prefer_const_constructorsimproved,451 vs baseline 465).
dart format --line-length 120: clean.Note
Shipping this to users requires a fresh Android internal-track build; the live
build predates the fix.
Failure-Class: none