Skip to content

Commit 8c20cdf

Browse files
committed
fix(server): keep current device tools with the Duo screenshot fix
2 parents 54aa2ab + 34ead56 commit 8c20cdf

756 files changed

Lines changed: 45283 additions & 7971 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.

‎.agents/skills/test-t3-mobile/SKILL.md‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,21 @@ when inspecting or seeding SQLite. Stop the test server before fixture writes.
3131
From the checkout being tested on the selected device host, run:
3232

3333
```bash
34-
node scripts/mobile-native-client.ts ensure <ios|android> <device-id>
34+
vp run mobile:install <ios|android> <device-id>
3535
```
3636

37-
This reuses a matching native client or builds and installs one. Authorized
38-
mobile verification includes that build step unless the user prohibits it.
37+
This installs the dev client for the checkout's native fingerprint: from the
38+
device, the local cache, or the shared cache in seconds, building once only
39+
when no machine has that fingerprint yet (5-15 minutes, logged to the file it
40+
names). The device id may be omitted when exactly one device is booted. It
41+
prints one JSON line; on failure it names the next command. Authorized mobile
42+
verification includes that step unless the user prohibits it.
43+
44+
For a device you opened in an agent-device session elsewhere (a device pool,
45+
cloud, or remote host), run `vp run mobile:install <ios|android> --session <s>`
46+
from the directory you opened the session in. It installs the cached build into
47+
that session (`--abi arm64-v8a` for an ARM Android device; `--metro <url>` also
48+
opens it against Metro) and never builds.
3949

4050
Start `vp run dev:client` from `apps/mobile`, or reuse a healthy Metro belonging
4151
to this checkout. Open its printed development-client URL with AgentDevice

‎.github/workflows/ci.yml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,18 @@ jobs:
420420
env:
421421
T3CODE_TRANSFER_BUDGET_REPORT_PATH: ${{ runner.temp }}/t3code-transfer-budget.md
422422
T3CODE_TRANSFER_BUDGET_RESULT_PATH: ${{ runner.temp }}/thread-transfer-result.json
423-
run: vp run --filter t3 test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
423+
run: >-
424+
vp run test:cached -- --shard ${{ matrix.shard }}/${{ strategy.job-total }}
425+
--uncached apps/server/integration/transferBudgetV2.integration.test.ts
426+
--verify-hits 1 --report "${{ runner.temp }}/test-cache-${{ matrix.shard }}.json" apps/server
427+
428+
- name: Upload test cache measurements
429+
if: always() && steps.changes.outputs.test_server != 'false'
430+
uses: actions/upload-artifact@v7
431+
with:
432+
name: test-cache-${{ matrix.shard }}
433+
path: ${{ runner.temp }}/test-cache-${{ matrix.shard }}.json
434+
if-no-files-found: error
424435

425436
# integration/transferBudgetV2.integration.test.ts writes the report; exactly one shard
426437
# produces these files. Gating the upload on their presence keeps a

‎.github/workflows/web-preview.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ jobs:
8282
--archive=tgz \
8383
--yes \
8484
--token "$VERCEL_TOKEN" \
85-
--scope "$vercel_scope"
85+
--scope "$vercel_scope" \
86+
--build-env "VITE_RELEASE_CHANNEL=preview"
8687
)"
8788
printf '%s\n' "$deployment_output"
8889
# Vercel can print lockfile warnings to stdout before the deployment URL.

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ apps/mobile/.generated/
3636
apps/mobile/.android-cache/
3737
/.generated/
3838
artifacts/app-store/screenshots/
39+
artifacts/mobile-e2e/
3940
.github/pr-assets/
4041
native/**/target/
4142
node_modules/

‎AGENTS.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
134134

135135
- Upon request, user-visible frontend changes should get one integrated pass in a real client: `test-t3-app` for web, `test-t3-mobile` for mobile. The primary agent does this once after integrating. Subagents do not launch their own dev servers. Ask permission before doing computer use or spinning up browsers.
136136

137-
For authorized mobile verification, a missing or outdated native client is a build step, not a blocker. Run `node scripts/mobile-native-client.ts ensure <ios|android> <device-id>` on the simulator host before starting Metro. It checks the local Expo fingerprint and builds/installs when needed. See `test-t3-mobile` for the full workflow.
137+
For authorized mobile verification, a missing or outdated native client is an install step, not a blocker. Run `vp run mobile:install <ios|android> [device-id]` on the device host before starting Metro; it targets the only booted simulator or connected Android device when the id is omitted. It installs the dev client for this checkout's native fingerprint from the shared cache in seconds and builds only when no machine has built it yet, so prefer it over `expo run:*`, `xcodebuild`, or `gradlew`, which rebuild from scratch. Its stdout is one JSON line; build output goes to the log it names. See `test-t3-mobile` for the full workflow.
138138

139139
## Pull requests
140140

141141
- Never make a PR unless the developer explicitly asks you to do so.
142-
- If `origin` is git.cafe, follow [GitCafe mirror](docs/operations/development.md#gitcafe-mirror-optional): use `cafe` for existing PRs, issues, comments and labels, but push and open PRs on GitHub, where CI runs.
142+
- If `origin` is git.cafe, follow [GitCafe mirror](docs/operations/development.md#gitcafe-mirror-optional): push to `origin`, open and track PRs with `cafe` and their git.cafe URLs, and keep `gh` for CI logs and merging.
143143
- Conventional commit titles, plain language: `fix(web): new threads no longer spike CPU`.
144144
- Body: the problem in a sentence or two, then how you fixed it. End with the model and harness that did the work.
145145
- UI changes need before/after images. Motion or timing needs a short video.
@@ -194,6 +194,7 @@ Architecture and its constraints: `docs/internals/overview.md`. Glossary: `docs/
194194
options, and pass combinators as additional function-builder arguments.
195195
- Inferred types over annotations. `any` is the enemy.
196196
- Default to no comment. Write one only for a constraint, an external quirk, or an invariant the code can't show, in one line where you can and four at most. Don't restate names or signatures, narrate steps, record history, or explain the fix you just made; the PR carries that. `t3code/no-low-value-comments` enforces the length cap and the mechanical cases.
197+
- React effects are for synchronizing with something outside React. Derive in render and act in handlers instead of syncing state, but don't hide real lifecycle work in refs or stores to dodge one. The `t3code/react-effect-budget` lint rule holds each file to its count in `scripts/effect-budget.json`; a new effect states its reason with `// oxlint-disable-next-line t3code/react-effect-budget -- <why>`.
197198
- 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.
198199
- If a rule here fights the task in front of you, say so loudly and get a human sign-off before breaking it.
199200

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ vi.mock("@clerk/electron", () => ({
2828
vi.mock("@clerk/electron/storage", () => ({
2929
storage: storageMock,
3030
}));
31-
32-
import * as Option from "effect/Option";
3331
import * as Exit from "effect/Exit";
3432
import * as FileSystem from "effect/FileSystem";
3533
import * as ElectronApp from "../electron/ElectronApp.ts";
@@ -297,7 +295,7 @@ it.effect(
297295
}),
298296
} as unknown as ElectronApp.ElectronApp["Service"];
299297
const electronWindow = {
300-
currentMainOrFirst: Effect.succeed(Option.some(window)),
298+
currentMainOrFirst: Effect.succeedSome(window),
301299
reveal: () => Effect.sync(() => revealed.resolve()),
302300
} as unknown as ElectronWindow.ElectronWindow["Service"];
303301
return Effect.gen(function* () {

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,4 +342,36 @@ describe("DesktopObservability", () => {
342342
Effect.provide(Layer.mergeAll(NodeServices.layer, layerCollector(requests), layerEmptyEnv)),
343343
);
344344
});
345+
346+
it.effect("describes the Node runtime and the desktop mode under semantic or t3code keys", () => {
347+
const requests: Array<ExportedRequest> = [];
348+
return Effect.gen(function* () {
349+
const fileSystem = yield* FileSystem.FileSystem;
350+
const baseDir = yield* fileSystem.makeTempDirectoryScoped({
351+
prefix: "t3-desktop-observability-test-",
352+
});
353+
const layerEnvironment = layerEnvironmentFor(baseDir);
354+
yield* writeObservabilitySettings(layerEnvironment, {
355+
otlpLogsUrl: "https://settings.example.com/v1/logs",
356+
});
357+
358+
yield* Effect.scoped(
359+
Effect.logInfo("desktop resource under test").pipe(
360+
Effect.provide(DesktopObservability.layer.pipe(Layer.provideMerge(layerEnvironment))),
361+
),
362+
);
363+
364+
const body = requests.map((request) => request.body).join("\n");
365+
assert.include(body, '"key":"process.runtime.name","value":{"stringValue":"nodejs"}');
366+
assert.include(
367+
body,
368+
`"key":"process.runtime.version","value":{"stringValue":"${process.versions.node}"}`,
369+
);
370+
assert.include(body, '"key":"t3code.desktop.mode","value":{"stringValue":"development"}');
371+
assert.notInclude(body, "service.mode");
372+
}).pipe(
373+
Effect.scoped,
374+
Effect.provide(Layer.mergeAll(NodeServices.layer, layerCollector(requests), layerEmptyEnv)),
375+
);
376+
});
345377
});

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ import { PRIMARY_LOCAL_ENVIRONMENT_ID } from "@t3tools/contracts";
22
import {
33
makeLocalFileTracer,
44
makeTraceSink,
5+
nodeProcessRuntimeAttributes,
6+
processServiceInstanceId,
57
type SignalExport,
68
} from "@t3tools/shared/observability";
79
import * as HostProcess from "@t3tools/shared/HostProcess";
810
import * as SharedObservability from "@t3tools/shared/observability";
911
import * as OtelEnvironment from "@t3tools/shared/otelEnvironment";
12+
import { releaseChannelOf, releaseResourceAttributes } from "@t3tools/shared/releaseResource";
1013
import {
1114
parsePersistedServerObservabilitySettings,
1215
type PersistedServerObservabilitySettings,
@@ -595,15 +598,24 @@ const layerTelemetry = Layer.unwrap(
595598
Effect.gen(function* () {
596599
const environment = yield* DesktopEnvironment.DesktopEnvironment;
597600
const endpoints = yield* resolveOtlpEndpoints;
601+
// Unpackaged runs launch a script, so Electron reports its own version.
602+
const serviceVersion = environment.isPackaged
603+
? environment.appVersion
604+
: desktopPackageJson.version;
598605
const resource = {
599606
serviceName: "t3code-desktop",
600-
// Unpackaged runs launch a script, so Electron reports its own version.
601-
serviceVersion: environment.isPackaged ? environment.appVersion : desktopPackageJson.version,
607+
serviceVersion,
602608
attributes: {
603609
"service.namespace": "t3code",
604610
"service.runtime": "desktop",
605-
"service.mode": environment.isDevelopment ? "development" : "packaged",
611+
"t3code.desktop.mode": environment.isDevelopment ? "development" : "packaged",
612+
"service.instance.id": processServiceInstanceId(endpoints.resourceAttributes),
613+
...releaseResourceAttributes(
614+
environment.isDevelopment ? "dev" : releaseChannelOf(serviceVersion),
615+
endpoints.resourceAttributes,
616+
),
606617
"host.name": endpoints.resourceAttributes["host.name"] || (yield* HostProcess.Hostname),
618+
...nodeProcessRuntimeAttributes(),
607619
},
608620
};
609621

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { assert, describe, it } from "@effect/vitest";
33
import * as NodeEvents from "node:events";
44
import * as Effect from "effect/Effect";
55
import * as Layer from "effect/Layer";
6-
import * as Option from "effect/Option";
76

87
import * as ElectronWindow from "../electron/ElectronWindow.ts";
98
import { WEB_LINK_OPEN_CHANNEL } from "../ipc/channels.ts";
@@ -26,7 +25,7 @@ const makeWindow = () => {
2625
Layer.succeed(
2726
ElectronWindow.ElectronWindow,
2827
ElectronWindow.ElectronWindow.of({
29-
currentMainOrFirst: Effect.succeed(Option.some(window)),
28+
currentMainOrFirst: Effect.succeedSome(window),
3029
reveal: (target: Electron.BrowserWindow) => Effect.sync(() => void revealed.push(target)),
3130
} as unknown as ElectronWindow.ElectronWindow["Service"]),
3231
),

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ describe("DesktopBackendConfiguration", () => {
678678
),
679679
);
680680

681-
it.effect("resolveWsl carries the kill switch into the distro", () =>
681+
it.effect("resolveWsl carries the kill switch and resource attributes into the distro", () =>
682682
Effect.gen(function* () {
683683
const fileSystem = yield* FileSystem.FileSystem;
684684
const baseDir = yield* fileSystem.makeTempDirectoryScoped({
@@ -688,10 +688,12 @@ describe("DesktopBackendConfiguration", () => {
688688
const previousWslEnv = process.env.WSLENV;
689689
const previousDisabled = process.env.OTEL_SDK_DISABLED;
690690
const previousTelemetry = process.env.T3CODE_TELEMETRY_ENABLED;
691+
const previousResourceAttributes = process.env.OTEL_RESOURCE_ATTRIBUTES;
691692
try {
692693
delete process.env.WSLENV;
693694
process.env.OTEL_SDK_DISABLED = "true";
694695
process.env.T3CODE_TELEMETRY_ENABLED = "false";
696+
process.env.OTEL_RESOURCE_ATTRIBUTES = "deployment.environment.name=staging";
695697

696698
yield* Effect.gen(function* () {
697699
const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;
@@ -701,6 +703,8 @@ describe("DesktopBackendConfiguration", () => {
701703
assert.include((config.env.WSLENV ?? "").split(":"), "OTEL_SDK_DISABLED");
702704
assert.equal(config.env.T3CODE_TELEMETRY_ENABLED, "false");
703705
assert.include((config.env.WSLENV ?? "").split(":"), "T3CODE_TELEMETRY_ENABLED");
706+
assert.equal(config.env.OTEL_RESOURCE_ATTRIBUTES, "deployment.environment.name=staging");
707+
assert.include((config.env.WSLENV ?? "").split(":"), "OTEL_RESOURCE_ATTRIBUTES");
704708
}).pipe(
705709
Effect.provide(
706710
layerBackendConfiguration().pipe(
@@ -722,6 +726,7 @@ describe("DesktopBackendConfiguration", () => {
722726
restoreEnv("WSLENV", previousWslEnv);
723727
restoreEnv("OTEL_SDK_DISABLED", previousDisabled);
724728
restoreEnv("T3CODE_TELEMETRY_ENABLED", previousTelemetry);
729+
restoreEnv("OTEL_RESOURCE_ATTRIBUTES", previousResourceAttributes);
725730
}
726731
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
727732
);

0 commit comments

Comments
 (0)