Skip to content

feat(app): add debug-only local_prod profile for a local backend with production identity - #11418

Merged
mdmohsin7 merged 2 commits into
mainfrom
feat/local-prod-profile
Aug 11, 2026
Merged

mdmohsin7 merged 2 commits into
mainfrom
feat/local-prod-profile

Conversation

@mdmohsin7

@mdmohsin7 mdmohsin7 commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

What

  • Adds a local_prod mobile profile: production Firebase identity (based-hardware) paired with a developer-chosen backend endpoint, selected only by an explicit --dart-define=OMI_APP_PROFILE=local_prod. Release builds reject the profile at startup (kReleaseMode), so no shipped artifact can select it. local_dev keeps its stricter loopback/private-network rule.
  • Fixes the runZonedGuarded crash handler in main.dart: it called FirebaseCrashlytics.instance unconditionally, so any error thrown before Firebase.initializeApp() completed was replaced by a secondary [core/no-app] exception and the root cause was lost. It now prints the original error and only forwards to Crashlytics once Firebase is initialized.

Why

Since #11273 the dev flavor is emulator-first (demo-omi-local) and there is no sanctioned way to run the prod-flavor app against a locally served backend for development. local_prod fills that gap the same way mobile_beta did for the dev serving plane: an explicit, enumerated, build-time profile instead of an env-file or debug-flag bypass.

INV-DATA-1

This PR changes app/lib/env/env.dart and app/lib/main.dart (INV-DATA-1 path globs). It preserves every production-family routing authority — production and mobile_beta pins are untouched and their rejection tests still pass. It amends the proposed invariant text to enumerate local_prod as a debug-only developer-workflow exception; because release builds reject the profile, no production-family artifact can leave its data plane. This is not the deliberate-migration exception.

Failure-Class: none

Verification

  • cd app && flutter test test/unit/env_test.dart — 20 passed (4 new: profile pairing, debug endpoint acceptance incl. tunnel hosts, release-build rejection, malformed-endpoint rejection).
  • On device: prod-flavor debug build launched with OMI_APP_PROFILE=local_prod and OMI_API_BASE_URL pointing at an ngrok tunnel to a locally served backend; app authenticated with production identity and traffic was observed arriving at the local backend.
  • Crash-guard: reproduced a startup StateError that previously surfaced only as [core/no-app]; with the guard the real error and stack print to the console.

🤖 Generated with Claude Code

Review in cubic

… production identity

Pairs production Firebase identity (based-hardware) with a developer-chosen
backend endpoint, selected only by an explicit OMI_APP_PROFILE=local_prod
dart-define. Release builds reject the profile at startup, so no shipped
artifact can select it. local_dev keeps its stricter loopback/private-network
rule. Amends INV-DATA-1 to enumerate the exception.

Verified: flutter test test/unit/env_test.dart (19 passed); ran the prod-flavor
app on-device with OMI_APP_PROFILE=local_prod against a locally served backend.
…up errors

The runZonedGuarded handler called FirebaseCrashlytics.instance
unconditionally; any error thrown before Firebase.initializeApp completed was
replaced by a secondary [core/no-app] exception and the root cause was lost.
Print the original error and only forward to Crashlytics once Firebase is
initialized.

Failure-Class: none

Verified: reproduced on device — a startup routing StateError previously
surfaced only as [core/no-app]; with the guard the real error and stack print.
@mintlify

mintlify Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
omi 🟢 Ready View Preview Aug 11, 2026, 12:28 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@mdmohsin7
mdmohsin7 merged commit 687ea69 into main Aug 11, 2026
17 of 19 checks passed
@mdmohsin7
mdmohsin7 deleted the feat/local-prod-profile branch August 11, 2026 12:28

This branch was successfully deployed

1 active deployment
staging - docs — 1a273eb2 Deployed Aug 11, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant