The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): reject unknown app variants (#23681)
Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Victor Vogel committed
Oct 31, 2026 at 03:37 UTC
44e7318c7971c21a646e23e7823ba1ff40d3cd6c
2 files changed
+36
-1
apps/mobile/app.config.test.ts
new
+33
@@ -0,0 +1,33 @@
1
+import { afterEach, expect, it, vi } from "vite-plus/test";
2
+
3
+// Keep config parsing independent of local env files and build credentials.
4
+vi.mock("../../scripts/lib/public-config.ts", () => ({
5
+ loadRepoEnv: () => ({ APP_VARIANT: process.env.APP_VARIANT }),
6
+}));
7
+
8
+afterEach(() => {
9
+ vi.unstubAllEnvs();
10
+});
11
+
12
+async function loadConfig(variant: string | undefined) {
13
+ vi.resetModules();
14
+ vi.stubEnv("APP_VARIANT", variant);
15
+ return (await import("./app.config.ts")).default;
16
+}
17
+
18
+it.each(["prod", ""])("rejects APP_VARIANT=%j before selecting production IDs", async (value) => {
19
+ await expect(loadConfig(value)).rejects.toThrow(
20
+ "APP_VARIANT must be development, preview, or production.",
21
+ );
22
+});
23
+
24
+it.each([
25
+ [undefined, "com.t3tools.t3code"],
26
+ ["development", "com.t3tools.t3code.dev"],
27
+ ["preview", "com.t3tools.t3code.preview"],
28
+ ["production", "com.t3tools.t3code"],
29
+])("keeps the iOS and Android identifiers for APP_VARIANT=%j", async (value, identifier) => {
30
+ const config = await loadConfig(value);
31
+ expect(config.ios?.bundleIdentifier).toBe(identifier);
32
+ expect(config.android?.package).toBe(identifier);
33
+});
apps/mobile/app.config.ts
+3
-1
@@ -108,8 +108,10 @@ function resolveAppVariant(value: string | undefined): AppVariant {
108
case "preview":
109
case "production":
110
return value;
111
- default:
111
+ case undefined:
112
return "production";
113
+ default:
114
+ throw new Error("APP_VARIANT must be development, preview, or production.");
115
}
116
}
117