Skip to content

Commit e9e39c8

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-21865
2 parents 69d7ca5 + 30f4d63 commit e9e39c8

35 files changed

Lines changed: 1300 additions & 205 deletions

‎.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/release.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
# 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 }}

‎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)