Skip to content

Commit 818a20c

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-22484
2 parents 03110f3 + 8f0b729 commit 818a20c

488 files changed

Lines changed: 33226 additions & 6205 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/workflows/ci.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ jobs:
344344
- name: Test
345345
run: vp run --filter @t3tools/web test
346346

347+
# Browser tests run source modules; this boots the production chunk graph.
348+
- name: Boot the built web client
349+
run: |
350+
vp run --filter @t3tools/web build
351+
node apps/web/scripts/verify-built-boot.ts
352+
347353
# apps/server sets `fileParallelism: false`, so its test files run strictly
348354
# one at a time. Sharding spreads them over separate runners instead of
349355
# separate workers, so no two server test files ever share a machine and the

‎.github/workflows/deploy-relay.yml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ on:
55
branches:
66
- main
77
# Redeploys main after a variable or secret change. Alchemy redeploys the
8-
# Worker when a value it reads changes, so force is rarely needed, and it
9-
# replaces the Postgres runtime role (alchemy-run/alchemy#1832).
8+
# Worker when a value it reads changes, so force is rarely needed.
109
workflow_dispatch:
1110
inputs:
1211
force:
13-
description: Redeploy every resource, including ones with no detected changes. Replaces the Postgres runtime role.
12+
description: Redeploy every resource, including ones with no detected changes.
1413
type: boolean
1514
default: false
1615

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ jobs:
275275
--environment production \
276276
--platform ${{ inputs.platform }} \
277277
--message "$OTA_MESSAGE" \
278+
--emit-metadata \
278279
--non-interactive
279280
280281
# Reconcile each version separately because the major is in the fingerprint.
@@ -313,8 +314,11 @@ jobs:
313314
--environment production \
314315
--platform "$platform" \
315316
--message "$message" \
317+
--emit-metadata \
316318
--non-interactive; then
317319
echo ":white_check_mark: $platform/$profile: OTA published to production (fingerprint \`$hash\`)" >> "$GITHUB_STEP_SUMMARY"
320+
# The next target's export replaces dist; keep this one for the map upload.
321+
rm -rf "dist-$platform-$profile" && mv dist "dist-$platform-$profile"
318322
else
319323
failed=1
320324
echo ":x: $platform/$profile: OTA publish failed (fingerprint \`$hash\`)" >> "$GITHUB_STEP_SUMMARY"
@@ -354,3 +358,18 @@ jobs:
354358
fi
355359
done
356360
exit "$failed"
361+
362+
# Lets the relay symbolicate crash stacks from the updates published
363+
# above. A step of its own so the R2 credentials reach only this script,
364+
# not `eas update` and the dependencies it runs. Never fails the job.
365+
- name: Upload OTA source maps
366+
if: ${{ !cancelled() && steps.expo-token.outputs.present == 'true' }}
367+
working-directory: apps/mobile
368+
env:
369+
MOBILE_SOURCEMAPS_R2: ${{ secrets.MOBILE_SOURCEMAPS_R2 }}
370+
run: |
371+
for dir in dist dist-*; do
372+
if [ -f "$dir/eas-update-metadata.json" ]; then
373+
node scripts/upload-sourcemaps.mts ota "$dir"
374+
fi
375+
done

‎.github/workflows/release-desktop.yml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ on:
6464
required: false
6565
default: false
6666
type: boolean
67+
# Whether the job opens the packaged app against a seeded database and
68+
# opens a thread before uploading it. Linux AppImage or macOS DMG.
69+
launch_check:
70+
required: false
71+
default: false
72+
type: boolean
6773
# A runner of the target's own platform and architecture, for a `runner`
6874
# that cannot execute the target. The build job skips everything that
6975
# runs the packaged binaries, and a second job runs it there.
@@ -517,6 +523,38 @@ jobs:
517523
518524
vp run dist:desktop:artifact "${args[@]}"
519525
526+
# A build can package fine and still not open (a missing module in the
527+
# backend or the bundle). This launches the app from the shipped
528+
# AppImage or DMG.
529+
- name: Launch check
530+
if: inputs.launch_check
531+
shell: bash
532+
run: |
533+
set -euo pipefail
534+
check=(node scripts/smoke-desktop-app.ts --artifacts-dir "$RUNNER_TEMP/desktop-launch-check")
535+
if [[ "${{ inputs.platform }}" == "mac" ]]; then
536+
mount="$RUNNER_TEMP/desktop-launch-dmg"
537+
hdiutil attach -nobrowse -readonly -mountpoint "$mount" "$(ls "$GITHUB_WORKSPACE"/release/*.dmg)"
538+
trap 'hdiutil detach "$mount" -force >/dev/null || true' EXIT
539+
app=$(ls -d "$mount"/*.app)
540+
executable=$(/usr/libexec/PlistBuddy -c "Print :CFBundleExecutable" "$app/Contents/Info.plist")
541+
"${check[@]}" --executable "$app/Contents/MacOS/$executable"
542+
else
543+
sudo apt-get install -y xvfb
544+
appimage=$(ls "$GITHUB_WORKSPACE"/release/*.AppImage)
545+
chmod +x "$appimage"
546+
(cd "$RUNNER_TEMP" && "$appimage" --appimage-extract >/dev/null)
547+
xvfb-run -a "${check[@]}" --executable "$RUNNER_TEMP/squashfs-root/t3code"
548+
fi
549+
550+
- name: Upload launch check output
551+
if: failure() && inputs.launch_check
552+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
553+
with:
554+
name: desktop-launch-check-${{ inputs.platform }}-${{ inputs.arch }}
555+
path: ${{ runner.temp }}/desktop-launch-check
556+
if-no-files-found: ignore
557+
520558
# The verify job runs what this host could not: the packaged natives and
521559
# the CLI. Its scripts are bundled so that job needs no install.
522560
- name: Stage verification inputs

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ jobs:
344344
- name: Test
345345
run: vp run --filter @t3tools/web test
346346

347+
# Browser tests run source modules; this boots the production chunk graph.
348+
- name: Boot the built web client
349+
run: |
350+
vp run --filter @t3tools/web build
351+
node apps/web/scripts/verify-built-boot.ts
352+
347353
# Server test files run one at a time, so more small runners beat fewer big ones.
348354
test_server:
349355
name: Release server tests ${{ matrix.shard }}
@@ -613,6 +619,7 @@ jobs:
613619
rust_target: aarch64-apple-darwin
614620
resource_key: darwin-arm64
615621
cli_archive: true
622+
launch_check: true
616623

617624
desktop_mac_x64:
618625
name: Desktop macOS x64
@@ -662,6 +669,7 @@ jobs:
662669
rust_target: x86_64-unknown-linux-gnu
663670
resource_key: linux-x64
664671
cli_archive: true
672+
launch_check: true
665673

666674
# node-pty has no Linux prebuild and compiles from source, so the arm64 app
667675
# and archive are built on arm64 hardware rather than cross-built.

‎apps/desktop/package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"scripts": {
88
"ensure:electron": "node scripts/ensure-electron-runtime.mjs",
99
"start": "node scripts/start-electron.mjs",
10-
"test": "vp test run --passWithNoTests",
11-
"smoke-test": "node scripts/smoke-test.mjs"
10+
"test": "vp test run --passWithNoTests"
1211
},
1312
"dependencies": {
1413
"@clerk/electron": "catalog:",

‎apps/desktop/scripts/smoke-test.mjs‎

Lines changed: 0 additions & 58 deletions
This file was deleted.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import * as DesktopShutdown from "./DesktopShutdown.ts";
2929
import * as DesktopServerExposure from "../backend/DesktopServerExposure.ts";
3030
import * as DesktopAppSettings from "../settings/DesktopAppSettings.ts";
3131
import * as DesktopShellEnvironment from "../shell/DesktopShellEnvironment.ts";
32+
import * as DesktopStartupRecovery from "./DesktopStartupRecovery.ts";
3233
import * as DesktopState from "./DesktopState.ts";
3334
import * as DesktopRemoteUpdates from "../updates/DesktopRemoteUpdates.ts";
3435
import * as DesktopUpdates from "../updates/DesktopUpdates.ts";
@@ -325,6 +326,7 @@ const startup = Effect.gen(function* () {
325326
yield* applicationMenu.configure;
326327
yield* updates.configure;
327328
yield* DesktopRemoteUpdates.listen;
329+
yield* DesktopStartupRecovery.listen;
328330
yield* linuxUrlHandler.register;
329331
yield* bootstrap.pipe(Effect.catchCause((cause) => fatalStartupCause("bootstrap", cause)));
330332
}).pipe(Effect.withSpan("desktop.startup"));
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import type { DesktopUpdateState } from "@t3tools/contracts";
2+
import { describe, expect, it } from "vite-plus/test";
3+
4+
import { createInitialDesktopUpdateState } from "../updates/updateMachine.ts";
5+
import { resolveStartupRecoveryOffer } from "./DesktopStartupRecovery.ts";
6+
7+
const updateState = (patch: Partial<DesktopUpdateState>): DesktopUpdateState => ({
8+
...createInitialDesktopUpdateState(
9+
"0.1.3",
10+
{ hostArch: "arm64", appArch: "arm64", runningUnderArm64Translation: false },
11+
"latest",
12+
),
13+
enabled: true,
14+
...patch,
15+
});
16+
17+
describe("resolveStartupRecoveryOffer", () => {
18+
it("offers a newer version before going back", () => {
19+
expect(
20+
resolveStartupRecoveryOffer(
21+
updateState({ status: "available", availableVersion: "0.1.4" }),
22+
"0.1.2",
23+
),
24+
).toEqual({ _tag: "Update", version: "0.1.4" });
25+
});
26+
27+
it("offers a retained download after a later check fails", () => {
28+
expect(
29+
resolveStartupRecoveryOffer(
30+
updateState({ status: "error", errorContext: "check", downloadedVersion: "0.1.4" }),
31+
null,
32+
),
33+
).toEqual({ _tag: "Update", version: "0.1.4" });
34+
});
35+
36+
it("waits for the update check before offering to go back", () => {
37+
expect(resolveStartupRecoveryOffer(updateState({ status: "checking" }), "0.1.2")).toEqual({
38+
_tag: "Checking",
39+
});
40+
});
41+
42+
it("offers the last version that started when no update exists", () => {
43+
expect(resolveStartupRecoveryOffer(updateState({ status: "up-to-date" }), "0.1.2")).toEqual({
44+
_tag: "Reinstall",
45+
version: "0.1.2",
46+
});
47+
});
48+
49+
it("does not offer an update that already failed to apply here", () => {
50+
expect(
51+
resolveStartupRecoveryOffer(
52+
updateState({
53+
status: "downloaded",
54+
downloadedVersion: "0.1.4",
55+
notAppliedVersion: "0.1.4",
56+
}),
57+
"0.1.2",
58+
),
59+
).toEqual({ _tag: "Reinstall", version: "0.1.2" });
60+
});
61+
62+
it("falls back to the releases page when this version never started", () => {
63+
expect(resolveStartupRecoveryOffer(updateState({ status: "disabled" }), "0.1.3")).toEqual({
64+
_tag: "Releases",
65+
});
66+
expect(resolveStartupRecoveryOffer(updateState({ status: "up-to-date" }), null)).toEqual({
67+
_tag: "Releases",
68+
});
69+
});
70+
});

0 commit comments

Comments
 (0)