Skip to content

Commit 7a70c73

Browse files
committed
merge: reconcile thread sorting with main
2 parents 078aa35 + b2b43be commit 7a70c73

543 files changed

Lines changed: 21281 additions & 10097 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/VOUCHED.td‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ github:realAhmedRoach
6868
github:Rishet11
6969
github:ryanrhughes
7070
github:saphid
71+
github:scratchyone
7172
github:sethwebster
7273
github:shiroyasha9
7374
github:shivamhwp

‎.github/workflows/mobile-eas-preview.yml‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,19 @@ jobs:
7878
working-directory: apps/mobile
7979
env:
8080
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
81-
run: eas env:pull preview --non-interactive
81+
run: |
82+
eas env:pull preview --non-interactive
83+
# EAS Update disables dotenv loading. Keep the downloaded native config
84+
# in its process environment so Android build and OTA fingerprints match.
85+
node --input-type=module <<'NODE'
86+
import { appendFileSync, readFileSync } from "node:fs";
87+
import { parseEnv } from "node:util";
88+
const env = parseEnv(readFileSync(".env.local", "utf8"));
89+
const googleServicesFile = env.T3CODE_ANDROID_GOOGLE_SERVICES_FILE;
90+
if (googleServicesFile) {
91+
appendFileSync(process.env.GITHUB_ENV, `T3CODE_ANDROID_GOOGLE_SERVICES_FILE=${googleServicesFile}\n`);
92+
}
93+
NODE
8294
8395
- name: Deploy with fingerprint check
8496
if: steps.expo-token.outputs.present == 'true'

‎.github/workflows/mobile-showcase-screenshots.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ jobs:
7676
echo "$vp_pnpm_bin" >> "$GITHUB_PATH"
7777
"$vp_pnpm_bin/pnpm" --version
7878
79+
- name: Install AXe
80+
# Locks the simulator and answers the notification prompt for the
81+
# agent-activity scene.
82+
# Homebrew refuses third-party tap formulae until they are trusted;
83+
# older releases have no trust command and install them as is.
84+
run: |
85+
brew tap cameroncooke/axe
86+
if brew commands | grep -qx trust; then brew trust --formula cameroncooke/axe/axe; fi
87+
brew install cameroncooke/axe/axe
88+
axe --version
89+
7990
- name: Capture iOS showcase
8091
run: pnpm screenshots:mobile --platform ios --appearance "${{ inputs.appearance }}" --theme "${{ inputs.theme }}"
8192

‎.github/workflows/release.yml‎

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,76 @@ jobs:
259259
- name: Typecheck
260260
run: vp run typecheck
261261

262+
# Keep tests on their own runners, using the same package split and server
263+
# shards as CI, so the release check job does not spend its budget on tests.
264+
test:
265+
name: Release tests
266+
needs: [preflight]
267+
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
268+
runs-on: blacksmith-8vcpu-ubuntu-2404
269+
timeout-minutes: 10
270+
steps:
271+
- name: Checkout
272+
uses: actions/checkout@v6
273+
with:
274+
ref: ${{ needs.preflight.outputs.ref }}
275+
sparse-checkout: |
276+
/*
277+
!/.repos/
278+
sparse-checkout-cone-mode: false
279+
280+
- name: Setup Vite+
281+
uses: voidzero-dev/setup-vp@v1
282+
with:
283+
node-version-file: package.json
284+
cache: true
285+
run-install: true
286+
287+
- name: Ensure Electron runtime is installed
288+
run: vp run --filter @t3tools/desktop ensure:electron
289+
262290
- uses: ./.github/actions/setup-apt-mirrors
263291

264292
- name: Install browser secret helper build libraries
265-
run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
293+
run: |
294+
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
295+
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config build-essential
296+
297+
- name: Test
298+
run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
299+
300+
test_server:
301+
name: Release server tests ${{ matrix.shard }}
302+
needs: [preflight]
303+
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' }}
304+
runs-on: blacksmith-8vcpu-ubuntu-2404
305+
timeout-minutes: 10
306+
strategy:
307+
fail-fast: false
308+
matrix:
309+
shard: [1, 2, 3]
310+
steps:
311+
- name: Checkout
312+
uses: actions/checkout@v6
313+
with:
314+
ref: ${{ needs.preflight.outputs.ref }}
315+
sparse-checkout: |
316+
/*
317+
!/.repos/
318+
sparse-checkout-cone-mode: false
319+
320+
- name: Setup Vite+
321+
uses: voidzero-dev/setup-vp@v1
322+
with:
323+
node-version-file: package.json
324+
cache: true
325+
run-install: true
266326

327+
# No Electron setup here: `t3` (apps/server) has no Electron dependency
328+
# and none of its tests touch the runtime. Only the non-server `test`
329+
# job, which covers @t3tools/desktop, needs the download.
267330
- name: Test
268-
run: vp run test
331+
run: vp run --filter t3 test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
269332

270333
relay_public_config:
271334
name: Resolve T3 Connect public config
@@ -630,13 +693,15 @@ jobs:
630693
preflight,
631694
relay_public_config,
632695
quality,
696+
test,
697+
test_server,
633698
desktop_mac_arm64,
634699
desktop_linux_x64,
635700
desktop_linux_arm64,
636701
desktop_win_x64,
637702
desktop_win_arm64,
638703
]
639-
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.desktop_mac_arm64.result == 'success' && needs.desktop_linux_x64.result == 'success' && needs.desktop_linux_arm64.result == 'success' && needs.desktop_win_x64.result == 'success' && needs.desktop_win_arm64.result == 'success' }}
704+
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.test.result == 'success' && needs.test_server.result == 'success' && needs.desktop_mac_arm64.result == 'success' && needs.desktop_linux_x64.result == 'success' && needs.desktop_linux_arm64.result == 'success' && needs.desktop_win_x64.result == 'success' && needs.desktop_win_arm64.result == 'success' }}
640705
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
641706
timeout-minutes: 15
642707
permissions:

‎AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ Full glossary with file links: `docs/internals/glossary.md`
158158
## Taste
159159

160160
- Complexity belongs at the adapter boundary. Orchestration stays pure, UI stays dumb.
161+
- `apps/web/src/components/ui` exports own their look. Pick a `variant` or `size`; do not restyle one with `className`. If none fits and the look is a generic concept, add a variant to the component; a look that belongs to one feature stays in that feature's own component, not in `components/ui`. Layout classes (width, flex, margin, position) belong on the parent. `shadcn/no-restyle` fails lint on violations.
161162
- Inferred types over annotations. `any` is the enemy.
162163
- Comments describe how a thing is used, and move when the code moves. To be used mostly to describe functions, not to annotate every line of behavior.
163164
- Our users drive agents all day and notice a dropped frame, a lying spinner, and a stale label. No continuously repainting animations; they peg the GPU on high-refresh displays.

‎apps/desktop/src/app/DesktopObservability.test.ts‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";
22
import * as NodeServices from "@effect/platform-node/NodeServices";
33
import { assert, describe, it } from "@effect/vitest";
4+
import * as ConfigProvider from "effect/ConfigProvider";
45
import * as Effect from "effect/Effect";
56
import * as FileSystem from "effect/FileSystem";
67
import * as Layer from "effect/Layer";
@@ -427,6 +428,36 @@ describe("DesktopObservability", () => {
427428
);
428429
});
429430

431+
it.effect("exports kill switch warnings through the configured logger", () => {
432+
const requests: Array<ExportedRequest> = [];
433+
return Effect.gen(function* () {
434+
const fileSystem = yield* FileSystem.FileSystem;
435+
const baseDir = yield* fileSystem.makeTempDirectoryScoped({
436+
prefix: "t3-desktop-observability-test-",
437+
});
438+
const environmentLayer = makeEnvironmentLayer(baseDir, true, {
439+
T3CODE_OTLP_LOGS_URL: "https://collector.example.com/v1/logs",
440+
});
441+
442+
yield* Effect.scoped(
443+
Effect.void.pipe(
444+
Effect.provide(DesktopObservability.layer.pipe(Layer.provideMerge(environmentLayer))),
445+
),
446+
);
447+
448+
assert.include(requests[0]?.body ?? "", "OTEL_SDK_DISABLED=1 was read as false");
449+
}).pipe(
450+
Effect.scoped,
451+
Effect.provide(
452+
Layer.mergeAll(
453+
NodeServices.layer,
454+
collectorLayer(requests),
455+
ConfigProvider.layer(ConfigProvider.fromEnv({ env: { OTEL_SDK_DISABLED: "1" } })),
456+
),
457+
),
458+
);
459+
});
460+
430461
it.effect("reads every signal endpoint from Settings when the environment names none", () => {
431462
const requests: Array<ExportedRequest> = [];
432463
return Effect.gen(function* () {
@@ -491,4 +522,37 @@ describe("DesktopObservability", () => {
491522
Effect.provide(Layer.mergeAll(NodeServices.layer, collectorLayer(requests))),
492523
);
493524
});
525+
526+
it.effect("stops every export when the OpenTelemetry SDK is disabled", () => {
527+
const requests: Array<ExportedRequest> = [];
528+
return Effect.gen(function* () {
529+
const fileSystem = yield* FileSystem.FileSystem;
530+
const baseDir = yield* fileSystem.makeTempDirectoryScoped({
531+
prefix: "t3-desktop-observability-test-",
532+
});
533+
const environmentLayer = makeEnvironmentLayer(baseDir);
534+
yield* writeObservabilitySettings(environmentLayer, {
535+
otlpTracesUrl: "https://settings.example.com/v1/traces",
536+
otlpLogsUrl: "https://settings.example.com/v1/logs",
537+
});
538+
539+
yield* Effect.scoped(
540+
Effect.logInfo("desktop log stays local when disabled").pipe(
541+
Effect.withSpan("desktop-disabled-test"),
542+
Effect.provide(DesktopObservability.layer.pipe(Layer.provideMerge(environmentLayer))),
543+
),
544+
);
545+
546+
assert.lengthOf(requests, 0);
547+
}).pipe(
548+
Effect.scoped,
549+
Effect.provide(
550+
Layer.mergeAll(
551+
NodeServices.layer,
552+
collectorLayer(requests),
553+
ConfigProvider.layer(ConfigProvider.fromEnv({ env: { OTEL_SDK_DISABLED: "true" } })),
554+
),
555+
),
556+
);
557+
});
494558
});

‎apps/desktop/src/app/DesktopObservability.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
makeTraceSink,
55
otlpSerializationLayer,
66
} from "@t3tools/shared/observability";
7+
import * as OtelEnvironment from "@t3tools/shared/otelEnvironment";
78
import {
89
parsePersistedServerObservabilitySettings,
910
type PersistedServerObservabilitySettings,
@@ -353,12 +354,18 @@ const readPersistedObservabilitySettings: Effect.Effect<
353354
* resolve traces against one revision of the file and logs against another.
354355
*/
355356
const resolveOtlpEndpoints = Effect.gen(function* () {
357+
const otel = yield* OtelEnvironment.load;
358+
if (otel.disabled) {
359+
return { traces: undefined, metrics: undefined, logs: undefined, warnings: otel.warnings };
360+
}
361+
356362
const environment = yield* DesktopEnvironment.DesktopEnvironment;
357363
const persisted = yield* readPersistedObservabilitySettings;
358364
return {
359365
traces: Option.getOrUndefined(environment.otlpTracesUrl) ?? persisted.otlpTracesUrl,
360366
metrics: Option.getOrUndefined(environment.otlpMetricsUrl) ?? persisted.otlpMetricsUrl,
361367
logs: Option.getOrUndefined(environment.otlpLogsUrl) ?? persisted.otlpLogsUrl,
368+
warnings: otel.warnings,
362369
};
363370
});
364371

@@ -671,7 +678,12 @@ const telemetryLayer = Layer.unwrap(
671678
// resource,
672679
// }).pipe(Layer.provide(serializationLayer));
673680

674-
return Layer.mergeAll(loggerLayer, tracerLayer);
681+
// Logged once the loggers above are installed, so the warnings use them.
682+
const otelWarningsLayer = Layer.effectDiscard(
683+
Effect.forEach(endpoints.warnings, (warning) => Effect.logWarning(warning)),
684+
);
685+
686+
return otelWarningsLayer.pipe(Layer.provideMerge(Layer.mergeAll(loggerLayer, tracerLayer)));
675687
}),
676688
);
677689

‎apps/desktop/src/backend/DesktopBackendConfiguration.test.ts‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,49 @@ describe("DesktopBackendConfiguration", () => {
946946
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
947947
);
948948

949+
it.effect("resolveWsl carries the kill switch into the distro", () =>
950+
Effect.gen(function* () {
951+
const fileSystem = yield* FileSystem.FileSystem;
952+
const baseDir = yield* fileSystem.makeTempDirectoryScoped({
953+
prefix: "t3-desktop-backend-config-test-",
954+
});
955+
956+
const previousWslEnv = process.env.WSLENV;
957+
const previousDisabled = process.env.OTEL_SDK_DISABLED;
958+
try {
959+
delete process.env.WSLENV;
960+
process.env.OTEL_SDK_DISABLED = "true";
961+
962+
yield* Effect.gen(function* () {
963+
const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;
964+
const config = yield* configuration.resolveWsl({ port: 5050, distro: null });
965+
966+
assert.equal(config.env.OTEL_SDK_DISABLED, "true");
967+
assert.include((config.env.WSLENV ?? "").split(":"), "OTEL_SDK_DISABLED");
968+
}).pipe(
969+
Effect.provide(
970+
DesktopBackendConfiguration.layer.pipe(
971+
Layer.provideMerge(serverExposureLayer),
972+
Layer.provideMerge(DesktopAppSettings.layerTest()),
973+
Layer.provideMerge(DesktopWslServerTree.layerTest()),
974+
Layer.provideMerge(
975+
DesktopWslEnvironment.layerTest({
976+
isAvailable: true,
977+
windowsToWslPath: () => Option.some("/mnt/c/repo/apps/server/src/index.ts"),
978+
getDistroIp: () => Option.some("172.27.0.99"),
979+
}),
980+
),
981+
Layer.provideMerge(makeEnvironmentLayer(baseDir, { platform: "win32" })),
982+
),
983+
),
984+
);
985+
} finally {
986+
restoreEnv("WSLENV", previousWslEnv);
987+
restoreEnv("OTEL_SDK_DISABLED", previousDisabled);
988+
}
989+
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
990+
);
991+
949992
it.effect("resolveWsl preserves existing WSLENV entries when forwarding backend secrets", () =>
950993
Effect.gen(function* () {
951994
const fileSystem = yield* FileSystem.FileSystem;

‎apps/desktop/src/backend/DesktopBackendConfiguration.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ const DESKTOP_BACKEND_ENV_NAMES = [
9696
const WSL_FORWARDED_ENV_NAMES = [
9797
"OPENAI_API_KEY",
9898
"ANTHROPIC_API_KEY",
99+
// Otherwise the WSL server keeps exporting to endpoints from the bootstrap.
100+
"T3CODE_OTEL_SDK_DISABLED",
101+
"OTEL_SDK_DISABLED",
99102
"T3CODE_OTLP_HEADERS",
100103
"T3CODE_OTLP_PROTOCOL",
101104
] as const;

‎apps/desktop/src/electron/ElectronProtocol.test.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe("ElectronProtocol", () => {
105105
);
106106
assert.include(
107107
response.headers.get("content-security-policy") ?? "",
108-
"connect-src 'self' http: https: ws: wss:",
108+
"connect-src 'self' blob: http: https: ws: wss:",
109109
);
110110
assert.include(
111111
response.headers.get("content-security-policy") ?? "",
@@ -255,7 +255,14 @@ describe("ElectronProtocol", () => {
255255
"https://clerk.t3.codes",
256256
"https://challenges.cloudflare.com",
257257
]);
258-
assert.deepEqual(directives["connect-src"], ["'self'", "http:", "https:", "ws:", "wss:"]);
258+
assert.deepEqual(directives["connect-src"], [
259+
"'self'",
260+
"blob:",
261+
"http:",
262+
"https:",
263+
"ws:",
264+
"wss:",
265+
]);
259266
assert.deepEqual(directives["img-src"], [
260267
"'self'",
261268
"t3code:",

0 commit comments

Comments
 (0)