Skip to content

Commit 585b7fa

Browse files
committed
test(desktop): assert the SynthOS URL scheme and pre-ready read errors
The fork renamed the desktop URL scheme on purpose: ElectronProtocol.getDesktopScheme returns "synthos" (upstream "t3code"). Four DesktopLinuxUrlHandler tests still expected x-scheme-handler/t3code from register, which derives the scheme from that function. They now expect synthos. The pure render test passes its own scheme and is unchanged. The fork also made DesktopUserData.resolveUserDataPath a pure path join: SynthOS profiles never migrate upstream Chromium state, so it no longer reads the filesystem. The pre-ready filesystem test used it as the vehicle for an unreadable profile, so it now succeeded. The test now calls the pre-ready exists directly: a missing path in a readable directory is false, and the same path under an unreadable directory fails with PermissionDenied. That checks the same guarantee, with the specific error. DesktopPreReadyFileSystem is still used by main.ts. Fails before (CI Test job): 4 URL handler failures and "expected false to be true". Passes after; the permission test skips as root, so it was also run as a non-root user locally and passed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01A1D6J2UMPo7YBWQFvbg1br
1 parent 7f47d29 commit 585b7fa

2 files changed

Lines changed: 19 additions & 18 deletions

File tree

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ describe("DesktopLinuxUrlHandler", () => {
196196
recorded.files[0]?.content,
197197
"Exec=/home/alice/Applications/T3-Code.AppImage %U",
198198
);
199-
assert.include(recorded.files[0]?.content, "MimeType=x-scheme-handler/t3code;");
199+
assert.include(recorded.files[0]?.content, "MimeType=x-scheme-handler/synthos;");
200200
assert.deepEqual(recorded.commands, [
201201
{
202202
command: "update-desktop-database",
203203
args: ["/home/alice/.local/share/applications"],
204204
},
205205
{
206206
command: "xdg-mime",
207-
args: ["default", "com.t3tools.T3Code.desktop", "x-scheme-handler/t3code"],
207+
args: ["default", "com.t3tools.T3Code.desktop", "x-scheme-handler/synthos"],
208208
},
209209
]);
210210
});
@@ -222,7 +222,7 @@ describe("DesktopLinuxUrlHandler", () => {
222222
DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
223223
displayName: "T3 Code (Alpha)",
224224
execTarget: process.execPath,
225-
scheme: "t3code",
225+
scheme: "synthos",
226226
iconPath: "/home/alice/.local/share/icons/com.t3tools.T3Code.desktop.png",
227227
}),
228228
);
@@ -249,7 +249,7 @@ describe("DesktopLinuxUrlHandler", () => {
249249
existingEntry: DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
250250
displayName: "T3 Code (Alpha)",
251251
execTarget: "/home/alice/Applications/T3-Code.AppImage",
252-
scheme: "t3code",
252+
scheme: "synthos",
253253
iconPath: "/home/alice/.local/share/icons/com.t3tools.T3Code.desktop.png",
254254
}),
255255
});
@@ -263,7 +263,7 @@ describe("DesktopLinuxUrlHandler", () => {
263263
},
264264
{
265265
command: "xdg-mime",
266-
args: ["default", "com.t3tools.T3Code.desktop", "x-scheme-handler/t3code"],
266+
args: ["default", "com.t3tools.T3Code.desktop", "x-scheme-handler/synthos"],
267267
},
268268
]);
269269
});
@@ -278,7 +278,7 @@ describe("DesktopLinuxUrlHandler", () => {
278278
existingEntry: DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
279279
displayName: "T3 Code (Alpha)",
280280
execTarget: "/home/alice/Applications/T3-Code.AppImage",
281-
scheme: "t3code",
281+
scheme: "synthos",
282282
iconPath,
283283
}),
284284
});

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,33 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
22
import { assert, it } from "@effect/vitest";
33
import * as HostProcess from "@t3tools/shared/HostProcess";
44
import * as Effect from "effect/Effect";
5-
import * as Exit from "effect/Exit";
65
import * as FileSystem from "effect/FileSystem";
6+
import * as Path from "effect/Path";
77

88
import * as DesktopPreReadyFileSystem from "./DesktopPreReadyFileSystem.ts";
9-
import * as DesktopUserData from "./DesktopUserData.ts";
109

11-
const resolveWindowsUserData = (appDataDirectory: string) =>
12-
DesktopUserData.resolveUserDataPath({
13-
appDataDirectory,
14-
isDevelopment: false,
15-
platform: "win32",
16-
}).pipe(Effect.provide(DesktopPreReadyFileSystem.layer));
10+
const preReadyExists = (path: string) =>
11+
FileSystem.FileSystem.pipe(
12+
Effect.flatMap((fileSystem) => fileSystem.exists(path)),
13+
Effect.provide(DesktopPreReadyFileSystem.layer),
14+
);
1715

1816
it.layer(NodeServices.layer)("DesktopPreReadyFileSystem", (it) => {
1917
it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32" || process.getuid?.() === 0)(
20-
"fails instead of treating an unreadable profile as missing",
18+
"fails instead of treating an unreadable path as missing",
2119
() =>
2220
Effect.gen(function* () {
2321
const fileSystem = yield* FileSystem.FileSystem;
22+
const path = yield* Path.Path;
2423
const root = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-pre-ready-fs-" });
24+
const state = path.join(root, "Local State");
25+
assert.isFalse(yield* preReadyExists(state));
26+
2527
yield* fileSystem.chmod(root, 0o000);
2628
yield* Effect.addFinalizer(() => fileSystem.chmod(root, 0o700).pipe(Effect.orDie));
2729

28-
const exit = yield* Effect.exit(resolveWindowsUserData(root));
29-
30-
assert.isTrue(Exit.isFailure(exit));
30+
const error = yield* Effect.flip(preReadyExists(state));
31+
assert.equal(error.reason._tag, "PermissionDenied");
3132
}),
3233
);
3334
});

0 commit comments

Comments
 (0)