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

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex authored and GitHub committed 2026-06-07 20:21:47 -07:00
1 parent 3ea6adf17d
commit 0e4a43519f
34 files changed
+810 -113

No files matched your search

+22 -1
View File
@@ -27,6 +27,12 @@ describe("loadRepoEnv", () => {
expect(env.EXPO_PUBLIC_CLERK_JWT_TEMPLATE).toBeUndefined();
expect(env.T3CODE_RELAY_URL).toBeUndefined();
expect(env.VITE_T3CODE_RELAY_URL).toBeUndefined();
expect(env.T3CODE_MOBILE_OTLP_TRACES_URL).toBeUndefined();
expect(env.T3CODE_MOBILE_OTLP_TRACES_DATASET).toBeUndefined();
expect(env.T3CODE_MOBILE_OTLP_TRACES_TOKEN).toBeUndefined();
expect(env.EXPO_PUBLIC_OTLP_TRACES_URL).toBeUndefined();
expect(env.EXPO_PUBLIC_OTLP_TRACES_DATASET).toBeUndefined();
expect(env.EXPO_PUBLIC_OTLP_TRACES_TOKEN).toBeUndefined();
});
it("applies process, root local, and root precedence in that order", () => {
@@ -73,26 +79,41 @@ describe("loadRepoEnv", () => {
VITE_CLERK_JWT_TEMPLATE: "template_legacy",
T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: "oauth_canonical",
VITE_T3CODE_RELAY_URL: "https://legacy.example.test",
EXPO_PUBLIC_OTLP_TRACES_URL: "https://api.axiom.co/v1/traces",
EXPO_PUBLIC_OTLP_TRACES_DATASET: "mobile-traces",
EXPO_PUBLIC_OTLP_TRACES_TOKEN: "mobile-token",
}),
).toEqual({
clerkPublishableKey: "pk_legacy",
clerkJwtTemplate: "template_legacy",
clerkCliOAuthClientId: "oauth_canonical",
relayUrl: "https://legacy.example.test",
mobileOtlpTracesUrl: "https://api.axiom.co/v1/traces",
mobileOtlpTracesDataset: "mobile-traces",
mobileOtlpTracesToken: "mobile-token",
});
});
it("projects only the configured aliases", () => {
it("projects canonical mobile tracing values to Expo public aliases", () => {
expect(
loadRepoEnv({
baseEnv: {
T3CODE_RELAY_URL: "https://relay.example.test",
T3CODE_MOBILE_OTLP_TRACES_URL: "https://api.axiom.co/v1/traces",
T3CODE_MOBILE_OTLP_TRACES_DATASET: "mobile-traces",
T3CODE_MOBILE_OTLP_TRACES_TOKEN: "mobile-token",
},
repoRoot: makeTemporaryDirectory(),
}),
).toEqual({
T3CODE_RELAY_URL: "https://relay.example.test",
VITE_T3CODE_RELAY_URL: "https://relay.example.test",
T3CODE_MOBILE_OTLP_TRACES_URL: "https://api.axiom.co/v1/traces",
T3CODE_MOBILE_OTLP_TRACES_DATASET: "mobile-traces",
T3CODE_MOBILE_OTLP_TRACES_TOKEN: "mobile-token",
EXPO_PUBLIC_OTLP_TRACES_URL: "https://api.axiom.co/v1/traces",
EXPO_PUBLIC_OTLP_TRACES_DATASET: "mobile-traces",
EXPO_PUBLIC_OTLP_TRACES_TOKEN: "mobile-token",
});
});
});
+36
View File
@@ -9,6 +9,9 @@ export interface T3CodePublicConfig {
readonly clerkJwtTemplate: string | undefined;
readonly clerkCliOAuthClientId: string | undefined;
readonly relayUrl: string | undefined;
readonly mobileOtlpTracesUrl: string | undefined;
readonly mobileOtlpTracesDataset: string | undefined;
readonly mobileOtlpTracesToken: string | undefined;
}
type Environment = Readonly<Record<string, string | undefined>>;
@@ -57,6 +60,24 @@ export function loadRepoEnv({
VITE_T3CODE_RELAY_URL: config.relayUrl,
}
: {}),
...(config.mobileOtlpTracesUrl
? {
T3CODE_MOBILE_OTLP_TRACES_URL: config.mobileOtlpTracesUrl,
EXPO_PUBLIC_OTLP_TRACES_URL: config.mobileOtlpTracesUrl,
}
: {}),
...(config.mobileOtlpTracesDataset
? {
T3CODE_MOBILE_OTLP_TRACES_DATASET: config.mobileOtlpTracesDataset,
EXPO_PUBLIC_OTLP_TRACES_DATASET: config.mobileOtlpTracesDataset,
}
: {}),
...(config.mobileOtlpTracesToken
? {
T3CODE_MOBILE_OTLP_TRACES_TOKEN: config.mobileOtlpTracesToken,
EXPO_PUBLIC_OTLP_TRACES_TOKEN: config.mobileOtlpTracesToken,
}
: {}),
};
}
@@ -76,6 +97,21 @@ export function resolvePublicConfig(...sources: readonly Environment[]): T3CodeP
),
clerkCliOAuthClientId: firstNonEmpty(sources, "T3CODE_CLERK_CLI_OAUTH_CLIENT_ID"),
relayUrl: firstNonEmpty(sources, "T3CODE_RELAY_URL", "VITE_T3CODE_RELAY_URL"),
mobileOtlpTracesUrl: firstNonEmpty(
sources,
"T3CODE_MOBILE_OTLP_TRACES_URL",
"EXPO_PUBLIC_OTLP_TRACES_URL",
),
mobileOtlpTracesDataset: firstNonEmpty(
sources,
"T3CODE_MOBILE_OTLP_TRACES_DATASET",
"EXPO_PUBLIC_OTLP_TRACES_DATASET",
),
mobileOtlpTracesToken: firstNonEmpty(
sources,
"T3CODE_MOBILE_OTLP_TRACES_TOKEN",
"EXPO_PUBLIC_OTLP_TRACES_TOKEN",
),
};
}