History

[codex] Extract infrastructure, telemetry, and test tooling (#2994)

Julius Marminge committed 5 months agov0.0.25-nightly.20260608.497

Commit 0e4a4351 parent 3ea6adf34 files · +810 −113Browse files

Showing the changes to scripts (2 of 34 files). Show all

Unified · Split

2 files
  1. scripts/lib/public-config.test.ts +22 −1
  2. scripts/lib/public-config.ts +36 −0
scripts/lib/public-config.test.ts+22−1
@@ -27,6 +27,12 @@ describe("loadRepoEnv", () => { · 26 unmodified lines
27 expect(env.EXPO_PUBLIC_CLERK_JWT_TEMPLATE).toBeUndefined();27 expect(env.EXPO_PUBLIC_CLERK_JWT_TEMPLATE).toBeUndefined();
28 expect(env.T3CODE_RELAY_URL).toBeUndefined();28 expect(env.T3CODE_RELAY_URL).toBeUndefined();
29 expect(env.VITE_T3CODE_RELAY_URL).toBeUndefined();29 expect(env.VITE_T3CODE_RELAY_URL).toBeUndefined();
30 expect(env.T3CODE_MOBILE_OTLP_TRACES_URL).toBeUndefined();
31 expect(env.T3CODE_MOBILE_OTLP_TRACES_DATASET).toBeUndefined();
32 expect(env.T3CODE_MOBILE_OTLP_TRACES_TOKEN).toBeUndefined();
33 expect(env.EXPO_PUBLIC_OTLP_TRACES_URL).toBeUndefined();
34 expect(env.EXPO_PUBLIC_OTLP_TRACES_DATASET).toBeUndefined();
35 expect(env.EXPO_PUBLIC_OTLP_TRACES_TOKEN).toBeUndefined();
30 });36 });
31 37
32 it("applies process, root local, and root precedence in that order", () => {38 it("applies process, root local, and root precedence in that order", () => {
@@ -73,26 +79,41 @@ describe("loadRepoEnv", () => { · 40 unmodified lines
73 VITE_CLERK_JWT_TEMPLATE: "template_legacy",79 VITE_CLERK_JWT_TEMPLATE: "template_legacy",
74 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: "oauth_canonical",80 T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: "oauth_canonical",
75 VITE_T3CODE_RELAY_URL: "https://legacy.example.test",81 VITE_T3CODE_RELAY_URL: "https://legacy.example.test",
82 EXPO_PUBLIC_OTLP_TRACES_URL: "https://api.axiom.co/v1/traces",
83 EXPO_PUBLIC_OTLP_TRACES_DATASET: "mobile-traces",
84 EXPO_PUBLIC_OTLP_TRACES_TOKEN: "mobile-token",
76 }),85 }),
77 ).toEqual({86 ).toEqual({
78 clerkPublishableKey: "pk_legacy",87 clerkPublishableKey: "pk_legacy",
79 clerkJwtTemplate: "template_legacy",88 clerkJwtTemplate: "template_legacy",
80 clerkCliOAuthClientId: "oauth_canonical",89 clerkCliOAuthClientId: "oauth_canonical",
81 relayUrl: "https://legacy.example.test",90 relayUrl: "https://legacy.example.test",
91 mobileOtlpTracesUrl: "https://api.axiom.co/v1/traces",
92 mobileOtlpTracesDataset: "mobile-traces",
93 mobileOtlpTracesToken: "mobile-token",
82 });94 });
83 });95 });
84 96
85 it("projects only the configured aliases", () => {97 it("projects canonical mobile tracing values to Expo public aliases", () => {
86 expect(98 expect(
87 loadRepoEnv({99 loadRepoEnv({
88 baseEnv: {100 baseEnv: {
89 T3CODE_RELAY_URL: "https://relay.example.test",101 T3CODE_RELAY_URL: "https://relay.example.test",
102 T3CODE_MOBILE_OTLP_TRACES_URL: "https://api.axiom.co/v1/traces",
103 T3CODE_MOBILE_OTLP_TRACES_DATASET: "mobile-traces",
104 T3CODE_MOBILE_OTLP_TRACES_TOKEN: "mobile-token",
90 },105 },
91 repoRoot: makeTemporaryDirectory(),106 repoRoot: makeTemporaryDirectory(),
92 }),107 }),
93 ).toEqual({108 ).toEqual({
94 T3CODE_RELAY_URL: "https://relay.example.test",109 T3CODE_RELAY_URL: "https://relay.example.test",
95 VITE_T3CODE_RELAY_URL: "https://relay.example.test",110 VITE_T3CODE_RELAY_URL: "https://relay.example.test",
111 T3CODE_MOBILE_OTLP_TRACES_URL: "https://api.axiom.co/v1/traces",
112 T3CODE_MOBILE_OTLP_TRACES_DATASET: "mobile-traces",
113 T3CODE_MOBILE_OTLP_TRACES_TOKEN: "mobile-token",
114 EXPO_PUBLIC_OTLP_TRACES_URL: "https://api.axiom.co/v1/traces",
115 EXPO_PUBLIC_OTLP_TRACES_DATASET: "mobile-traces",
116 EXPO_PUBLIC_OTLP_TRACES_TOKEN: "mobile-token",
96 });117 });
97 });118 });
98});119});
scripts/lib/public-config.ts+36−0
@@ -9,6 +9,9 @@ export interface T3CodePublicConfig { · 8 unmodified lines
9 readonly clerkJwtTemplate: string | undefined;9 readonly clerkJwtTemplate: string | undefined;
10 readonly clerkCliOAuthClientId: string | undefined;10 readonly clerkCliOAuthClientId: string | undefined;
11 readonly relayUrl: string | undefined;11 readonly relayUrl: string | undefined;
12 readonly mobileOtlpTracesUrl: string | undefined;
13 readonly mobileOtlpTracesDataset: string | undefined;
14 readonly mobileOtlpTracesToken: string | undefined;
12}15}
13 16
14type Environment = Readonly<Record<string, string | undefined>>;17type Environment = Readonly<Record<string, string | undefined>>;
@@ -57,6 +60,24 @@ export function loadRepoEnv({ · 42 unmodified lines
57 VITE_T3CODE_RELAY_URL: config.relayUrl,60 VITE_T3CODE_RELAY_URL: config.relayUrl,
58 }61 }
59 : {}),62 : {}),
63 ...(config.mobileOtlpTracesUrl
64 ? {
65 T3CODE_MOBILE_OTLP_TRACES_URL: config.mobileOtlpTracesUrl,
66 EXPO_PUBLIC_OTLP_TRACES_URL: config.mobileOtlpTracesUrl,
67 }
68 : {}),
69 ...(config.mobileOtlpTracesDataset
70 ? {
71 T3CODE_MOBILE_OTLP_TRACES_DATASET: config.mobileOtlpTracesDataset,
72 EXPO_PUBLIC_OTLP_TRACES_DATASET: config.mobileOtlpTracesDataset,
73 }
74 : {}),
75 ...(config.mobileOtlpTracesToken
76 ? {
77 T3CODE_MOBILE_OTLP_TRACES_TOKEN: config.mobileOtlpTracesToken,
78 EXPO_PUBLIC_OTLP_TRACES_TOKEN: config.mobileOtlpTracesToken,
79 }
80 : {}),
60 };81 };
61}82}
62 83
@@ -76,6 +97,21 @@ export function resolvePublicConfig(...sources: readonly Environment[]): T3CodeP · 13 unmodified lines
76 ),97 ),
77 clerkCliOAuthClientId: firstNonEmpty(sources, "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID"),98 clerkCliOAuthClientId: firstNonEmpty(sources, "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID"),
78 relayUrl: firstNonEmpty(sources, "T3CODE_RELAY_URL", "VITE_T3CODE_RELAY_URL"),99 relayUrl: firstNonEmpty(sources, "T3CODE_RELAY_URL", "VITE_T3CODE_RELAY_URL"),
100 mobileOtlpTracesUrl: firstNonEmpty(
101 sources,
102 "T3CODE_MOBILE_OTLP_TRACES_URL",
103 "EXPO_PUBLIC_OTLP_TRACES_URL",
104 ),
105 mobileOtlpTracesDataset: firstNonEmpty(
106 sources,
107 "T3CODE_MOBILE_OTLP_TRACES_DATASET",
108 "EXPO_PUBLIC_OTLP_TRACES_DATASET",
109 ),
110 mobileOtlpTracesToken: firstNonEmpty(
111 sources,
112 "T3CODE_MOBILE_OTLP_TRACES_TOKEN",
113 "EXPO_PUBLIC_OTLP_TRACES_TOKEN",
114 ),
79 };115 };
80}116}
81 117

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t