TypeScript
test(desktop): prune low-value tests in desktop (second pass) (#22589)
Julius Marminge2edddbc84752
diff --git a/apps/desktop/gnome-extension/captureFeedback.test.js b/apps/desktop/gnome-extension/captureFeedback.test.jsindex 501f2586f1b..fb6003bf397 100644--- a/apps/desktop/gnome-extension/captureFeedback.test.js+++ b/apps/desktop/gnome-extension/captureFeedback.test.js@@ -151,17 +151,6 @@ it("waits for T3 to remap and cancels that wait when disabled", async () => {expect(shell.mapped.size).toBe(0);});-it("does not animate under reduced motion but still activates T3", async () => {- shell.animations = false;- shell.windows = [target()];- const { feedback, started } = begin();- expect(started).toBe(false);- expect(shell.actors).toHaveLength(0);- await feedback.activate(":1.23", "T3");- expect(shell.activate).toHaveBeenCalledOnce();- feedback.dispose();-});-it("rejects another sender and locked-session activation", async () => {shell.windows = [target()];const { feedback } = begin();diff --git a/apps/desktop/gnome-extension/captureService.test.js b/apps/desktop/gnome-extension/captureService.test.jsindex b8313f920f7..fa45cd604a0 100644--- a/apps/desktop/gnome-extension/captureService.test.js+++ b/apps/desktop/gnome-extension/captureService.test.js@@ -28,11 +28,6 @@ it("rejects other clients before looking at the active window", async () => {expect(await service.capture(":1.23")).toBe("pixels");});-it.each(CLIENT_NAMES)("accepts the current owner of %s", async (client) => {- const { service } = fixture({ getNameOwner: async (name) => (name === client ? ":1.23" : null) });- expect(await service.capture(":1.23")).toBe("pixels");-});-it("rechecks the name owner on each capture", async () => {let owner = ":1.23";const { service } = fixture({ getNameOwner: async () => owner });diff --git a/apps/desktop/scripts/electron-launcher.mjs b/apps/desktop/scripts/electron-launcher.mjsindex 780cf639fd1..0fb4377f07b 100644--- a/apps/desktop/scripts/electron-launcher.mjs+++ b/apps/desktop/scripts/electron-launcher.mjs@@ -94,7 +94,7 @@ function runChecked(command, args) {throw new Error(`Failed to run ${command} ${args.join(" ")}: ${details}`.trim());}-export function resolveMacCodeSignArguments(appBundlePath) {+function resolveMacCodeSignArguments(appBundlePath) {return ["--force", "--deep", "--sign", "-", "--timestamp=none", appBundlePath];}@@ -201,7 +201,7 @@ function registerMacLauncherBundle(appBundlePath) {}// Bundle-internal paths are macOS paths whatever host builds them.-export function resolveMacLauncherIconPaths(runtimeDir, development = isDevelopment) {+function resolveMacLauncherIconPaths(runtimeDir, development = isDevelopment) {return {sourceIconPath: development ? developmentMacIconPngPath : productionMacIconPngPath,generatedIconPath: NodePath.posix.join(@@ -260,7 +260,7 @@ function ensureMacIconIcns(runtimeDir) {}}-export function resolveMacBundleInfoPlistStrings(executableName) {+function resolveMacBundleInfoPlistStrings(executableName) {return {CFBundleDisplayName: APP_DISPLAY_NAME,CFBundleName: APP_DISPLAY_NAME,diff --git a/apps/desktop/scripts/electron-launcher.test.mjs b/apps/desktop/scripts/electron-launcher.test.mjsindex 2b1dc2cb3fb..fa6e56b5800 100644--- a/apps/desktop/scripts/electron-launcher.test.mjs+++ b/apps/desktop/scripts/electron-launcher.test.mjs@@ -11,9 +11,6 @@ import {makeDevelopmentEnvironmentScript,makeDevelopmentLauncherScript,resolveElectronBinaryPath,- resolveMacBundleInfoPlistStrings,- resolveMacCodeSignArguments,- resolveMacLauncherIconPaths,resolveMacLauncherPaths,writeDevelopmentLauncherScript,} from "./electron-launcher.mjs";@@ -106,30 +103,6 @@ describe("electron development launcher", () => {assert.notInclude(script, "node_modules/electron");});- it("declares why the macOS app needs protected access", () => {- const values = resolveMacBundleInfoPlistStrings("T3 Code (Dev) Launcher");-- assert.equal(- values.NSScreenCaptureUsageDescription,- "T3 Code captures the active window when you use the snapshot shortcut.",- );- assert.equal(- values.NSDocumentsFolderUsageDescription,- "T3 Code reads project files you open in the desktop app.",- );- });-- it("ad-hoc signs the complete development app bundle", () => {- assert.deepEqual(resolveMacCodeSignArguments("/runtime/T3 Code (Dev).app"), [- "--force",- "--deep",- "--sign",- "-",- "--timestamp=none",- "/runtime/T3 Code (Dev).app",- ]);- });-it("restores execute permissions on an unchanged launcher", () => {const directory = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-launcher-"));const launcherPath = NodePath.join(directory, "launcher");@@ -143,16 +116,6 @@ describe("electron development launcher", () => {NodeFS.rmSync(directory, { recursive: true, force: true });}});-- it("derives launcher icons from canonical development and production assets", () => {- const development = resolveMacLauncherIconPaths("/runtime", true);- const production = resolveMacLauncherIconPaths("/runtime", false);-- assert.match(development.sourceIconPath, /assets[\\/]dev[\\/]blueprint-macos-1024\.png$/);- assert.equal(development.generatedIconPath, "/runtime/icon-dev.icns");- assert.match(production.sourceIconPath, /assets[\\/]prod[\\/]black-macos-1024\.png$/);- assert.equal(production.generatedIconPath, "/runtime/icon-prod.icns");- });});async function startupCleanupPattern(desktopDir) {diff --git a/apps/desktop/scripts/verify-preload-bundle.test.mjs b/apps/desktop/scripts/verify-preload-bundle.test.mjsindex d2055e2c681..8af6ae00c3f 100644--- a/apps/desktop/scripts/verify-preload-bundle.test.mjs+++ b/apps/desktop/scripts/verify-preload-bundle.test.mjs@@ -60,12 +60,6 @@ describe("desktop preload bundle verifier", () => {);});- it("ignores import-like text in strings", () => {- assert.doesNotThrow(() =>- verifyPreloadBundle(`${validPreload}\nconst message = 'import /* comment */("module")';`),- );- });-it("rejects unsupported require calls with comments before the opening parenthesis", () => {assert.throws(() => verifyPreloadBundle(`${validPreload}\nrequire /* @__PURE__ */ ("node:fs");`),@@ -73,13 +67,6 @@ describe("desktop preload bundle verifier", () => {);});- it("rejects unsupported optional require calls", () => {- assert.throws(- () => verifyPreloadBundle(`${validPreload}\nrequire?.("node:fs");`),- /unsupported sandbox imports: node:fs/,- );- });-it("accepts Electron sandbox module aliases", () => {assert.doesNotThrow(() =>verifyPreloadBundle(`diff --git a/apps/desktop/src/app/DesktopAppActivationBroker.test.ts b/apps/desktop/src/app/DesktopAppActivationBroker.test.tsindex 66f7dfddb4f..ab20c761090 100644--- a/apps/desktop/src/app/DesktopAppActivationBroker.test.ts+++ b/apps/desktop/src/app/DesktopAppActivationBroker.test.ts@@ -49,31 +49,6 @@ describe("DesktopAppActivationBroker", () => {broker.close();});- it("queues requests after unsubscribe until a new renderer registers", async () => {- const previousSend = vi.fn();- const nextSend = vi.fn();- const broker = new DesktopAppActivationBroker({ requestTimeoutMs: 1_000, activate: vi.fn() });- broker.registerRenderer(previousSend);- broker.clearRenderer();-- const response = broker.request(request);- expect(previousSend).not.toHaveBeenCalled();- expect(nextSend).not.toHaveBeenCalled();-- broker.registerRenderer(nextSend);- expect(nextSend).toHaveBeenCalledWith(request);- broker.complete({- version: 1,- requestId: request.requestId,- ok: true,- projectId: ProjectId.make("project-1"),- threadId: ThreadId.make("thread-1"),- });-- await expect(response).resolves.toMatchObject({ ok: true });- broker.close();- });-it("never sends a canceled request that was queued behind another request", async () => {const send = vi.fn();const broker = new DesktopAppActivationBroker({ requestTimeoutMs: 1_000, activate: vi.fn() });diff --git a/apps/desktop/src/app/DesktopConnectionCatalogStore.test.ts b/apps/desktop/src/app/DesktopConnectionCatalogStore.test.tsindex 5e6ff4e64a4..0b446f8ada3 100644--- a/apps/desktop/src/app/DesktopConnectionCatalogStore.test.ts+++ b/apps/desktop/src/app/DesktopConnectionCatalogStore.test.ts@@ -8,7 +8,6 @@ import * as FileSystem from "effect/FileSystem";import * as Path from "effect/Path";import * as Layer from "effect/Layer";import * as Option from "effect/Option";-import * as PlatformError from "effect/PlatformError";import * as Ref from "effect/Ref";import * as Schema from "effect/Schema";@@ -267,44 +266,6 @@ describe("DesktopConnectionCatalogStore", () => {),);- it.effect("surfaces catalog filesystem failures instead of treating them as missing", () =>- Effect.gen(function* () {- const path = yield* Path.Path;- const baseFileSystem = yield* FileSystem.FileSystem;- const baseDir = yield* baseFileSystem.makeTempDirectoryScoped({- prefix: "t3-desktop-connection-catalog-test-",- });- const permissionError = PlatformError.systemError({- _tag: "PermissionDenied",- module: "FileSystem",- method: "readFileString",- pathOrDescriptor: path.join(baseDir, "userdata", "connection-catalog.json"),- });- const layerFileSystem = Layer.succeed(- FileSystem.FileSystem,- FileSystem.makeNoop({- readFileString: () => Effect.fail(permissionError),- }),- );- const store = yield* DesktopConnectionCatalogStore.DesktopConnectionCatalogStore.pipe(- Effect.provide(layerFor(baseDir, true, null, layerFileSystem)),- );-- const error = yield* store.get.pipe(Effect.flip);- assert.instanceOf(- error,- DesktopConnectionCatalogStore.DesktopConnectionCatalogStoreReadError,- );- assert.equal(error.catalogPath, path.join(baseDir, "userdata", "connection-catalog.json"));- assert.strictEqual(error.cause, permissionError);- assert.equal(- error.message,- `Failed to read the desktop connection catalog at ${path.join(baseDir, "userdata", "connection-catalog.json")}.`,- );- assert.notEqual(error.message, permissionError.message);- }).pipe(Effect.provide(NodeServices.layer), Effect.scoped),- );-it.effect("surfaces a catalog that can no longer be decrypted without deleting it", () =>Effect.gen(function* () {const path = yield* Path.Path;diff --git a/apps/desktop/src/app/DesktopEarlyElectronStartup.test.ts b/apps/desktop/src/app/DesktopEarlyElectronStartup.test.tsindex 8e8a4a433d9..6d40bd128b7 100644--- a/apps/desktop/src/app/DesktopEarlyElectronStartup.test.ts+++ b/apps/desktop/src/app/DesktopEarlyElectronStartup.test.ts@@ -57,8 +57,6 @@ describe("DesktopEarlyElectronStartup", () => {const releaseCommits: Record<string, string> = {"0.48.0": "5ee35f914f921e5696030698e74fb5566a804768","0.48.1": "29e2e59fdbab8ed2cc23a20e3c6043d5decb5cdc",- "0.49.0": "9958d297641b5c84dcff93f9039d80a5ad37ab00",- "0.50.0": "c4a4c341568944bd4fb9cd503558b2de602c0213","0.50.1": "4e242d086e20b32951fdc0ebcbfb4d41b5be8dcc",};const hyprctlVersion =@@ -80,18 +78,15 @@ describe("DesktopEarlyElectronStartup", () => {readHyprctlVersionJson: hyprctlVersion("0.48.1"),};- it.each(["0.48.0", "0.48.1", "0.49.0", "0.50.0", "0.50.1"])(- "disables the color manager on Hyprland %s",- (version) => {- assert.equal(- resolveLinuxDisableFeaturesSwitch({- ...brokenHyprland,- readHyprctlVersionJson: hyprctlVersion(version),- }),- "WaylandWpColorManagerV1",- );- },- );+ it.each(["0.48.0", "0.50.1"])("disables the color manager on Hyprland %s", (version) => {+ assert.equal(+ resolveLinuxDisableFeaturesSwitch({+ ...brokenHyprland,+ readHyprctlVersionJson: hyprctlVersion(version),+ }),+ "WaylandWpColorManagerV1",+ );+ });it.each([{ label: "case-insensitive desktop tokens", env: { XDG_CURRENT_DESKTOP: "foo:HYPRLAND" } },diff --git a/apps/desktop/src/app/DesktopObservability.test.ts b/apps/desktop/src/app/DesktopObservability.test.tsindex 9cccae5b60b..f865ed31206 100644--- a/apps/desktop/src/app/DesktopObservability.test.ts+++ b/apps/desktop/src/app/DesktopObservability.test.ts@@ -280,30 +280,6 @@ describe("DesktopObservability", () => {),);- it.effect("stays off the network when no endpoint is configured", () => {- const requests: Array<ExportedRequest> = [];- return Effect.gen(function* () {- const fileSystem = yield* FileSystem.FileSystem;- const baseDir = yield* fileSystem.makeTempDirectoryScoped({- prefix: "t3-desktop-observability-test-",- });-- yield* Effect.scoped(- Effect.logInfo("desktop log stays local").pipe(- Effect.withSpan("desktop-offline-test"),- Effect.provide(- DesktopObservability.layer.pipe(Layer.provideMerge(layerEnvironmentFor(baseDir))),- ),- ),- );-- assert.lengthOf(requests, 0);- }).pipe(- Effect.scoped,- Effect.provide(Layer.mergeAll(NodeServices.layer, layerCollector(requests), layerEmptyEnv)),- );- });-it.effect("stops every export when the OpenTelemetry SDK is disabled", () => {const requests: Array<ExportedRequest> = [];return Effect.gen(function* () {diff --git a/apps/desktop/src/app/DesktopPreReadyFileSystem.test.ts b/apps/desktop/src/app/DesktopPreReadyFileSystem.test.tsindex 542f6b98759..e76c29eee1e 100644--- a/apps/desktop/src/app/DesktopPreReadyFileSystem.test.ts+++ b/apps/desktop/src/app/DesktopPreReadyFileSystem.test.ts@@ -4,7 +4,6 @@ import * as HostProcess from "@t3tools/shared/HostProcess";import * as Effect from "effect/Effect";import * as Exit from "effect/Exit";import * as FileSystem from "effect/FileSystem";-import * as Path from "effect/Path";import * as DesktopPreReadyFileSystem from "./DesktopPreReadyFileSystem.ts";import * as DesktopUserData from "./DesktopUserData.ts";@@ -17,21 +16,6 @@ const resolveWindowsUserData = (appDataDirectory: string) =>}).pipe(Effect.provide(DesktopPreReadyFileSystem.layer));it.layer(NodeServices.layer)("DesktopPreReadyFileSystem", (it) => {- it.effect("migrates the legacy Windows profile state", () =>- Effect.gen(function* () {- const fileSystem = yield* FileSystem.FileSystem;- const path = yield* Path.Path;- const root = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-pre-ready-fs-" });- yield* fileSystem.makeDirectory(path.join(root, "T3 Code (Alpha)"));- yield* fileSystem.writeFileString(path.join(root, "T3 Code (Alpha)", "Local State"), "keys");-- const userData = yield* resolveWindowsUserData(root);-- assert.equal(userData, path.join(root, "t3code-v2"));- assert.equal(yield* fileSystem.readFileString(path.join(userData, "Local State")), "keys");- }),- );-it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32" || process.getuid?.() === 0)("fails instead of treating an unreadable profile as missing",() =>diff --git a/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts b/apps/desktop/src/app/DesktopPreReadyPlatform.test.tsindex 6711ea36eb5..143a6e5fd87 100644--- a/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts+++ b/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts@@ -119,57 +119,6 @@ describe("DesktopPreReadyPlatform", () => {);});- it.effect.each([- {- label: "merges the color-manager fallback into disabled features on Hyprland 0.48.1",- switches: { "ozone-platform": "wayland", "disable-features": "Vulkan" },- hyprlandVersion: "0.48.1",- hyprlandCommit: "29e2e59fdbab8ed2cc23a20e3c6043d5decb5cdc",- expected: [["disable-features", "Vulkan,WaylandWpColorManagerV1"]],- },- {- label: "preserves color management on Hyprland 0.51.0",- switches: { "ozone-platform": "wayland", "disable-features": "Vulkan" },- hyprlandVersion: "0.51.0",- hyprlandCommit: "0123456789abcdef0123456789abcdef01234567",- expected: [],- },- {- label: "preserves color management when Electron resolved X11",- switches: { "ozone-platform": "x11", "disable-features": "Vulkan" },- hyprlandVersion: "0.48.1",- hyprlandCommit: "29e2e59fdbab8ed2cc23a20e3c6043d5decb5cdc",- expected: [],- },- ])("$label", ({ switches, hyprlandVersion, hyprlandCommit, expected }) => {- vi.stubEnv("XDG_CURRENT_DESKTOP", "Hyprland");- vi.stubEnv("XDG_SESSION_TYPE", "wayland");- const commandLine = new Map<string, string>(Object.entries(switches));- hasSwitchMock.mockImplementation((switchName: string) => commandLine.has(switchName));- getSwitchValueMock.mockImplementation(- (switchName: string) => commandLine.get(switchName) ?? "",- );- execFileSyncMock.mockReturnValue(- JSON.stringify({- commit: hyprlandCommit,- version: hyprlandVersion,- dirty: false,- tag: `v${hyprlandVersion}`,- }),- );-- return DesktopPreReadyPlatform.make.pipe(- Effect.provideService(HostProcess.Platform, "linux"),- Effect.map(() => {- const featureSwitches = appendSwitchMock.mock.calls.filter(([name]) =>- ["disable-features", "enable-features", "ozone-platform"].includes(name),- );- assert.deepEqual(featureSwitches, expected);- }),- Effect.ensuring(Effect.sync(() => vi.unstubAllEnvs())),- );- });-it.effect.each([{ previousEntry: undefined, label: "missing" },{ previousEntry: 'Exec="/Applications/deleted-previous.AppImage" %U', label: "stale" },diff --git a/apps/desktop/src/app/DesktopWebLinks.test.ts b/apps/desktop/src/app/DesktopWebLinks.test.tsindex e81dea3f736..9e87cfb7a9c 100644--- a/apps/desktop/src/app/DesktopWebLinks.test.ts+++ b/apps/desktop/src/app/DesktopWebLinks.test.ts@@ -36,14 +36,6 @@ const makeWindow = () => {};describe("DesktopWebLinks", () => {- it("treats only http and https as web links", () => {- assert.isTrue(DesktopWebLinks.isWebLink("https://example.com/"));- assert.isTrue(DesktopWebLinks.isWebLink("http://localhost:3000/a?b=1"));- assert.isFalse(DesktopWebLinks.isWebLink("t3code://app/welcome"));- assert.isFalse(DesktopWebLinks.isWebLink("mailto:[email protected]"));- assert.isFalse(DesktopWebLinks.isWebLink("not a url"));- });-it.effect("holds links until the renderer listens, then delivers them in order", () => {const { sent, revealed, layer } = makeWindow();return Effect.gen(function* () {diff --git a/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts b/apps/desktop/src/backend/DesktopBackendConfiguration.test.tsindex 15e7be0a618..8d70ab4c479 100644--- a/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts+++ b/apps/desktop/src/backend/DesktopBackendConfiguration.test.ts@@ -873,42 +873,6 @@ describe("DesktopBackendConfiguration", () => {}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),);- it.effect("resolveWsl keeps a transient distro-list failure retryable", () =>- Effect.gen(function* () {- const fileSystem = yield* FileSystem.FileSystem;- const baseDir = yield* fileSystem.makeTempDirectoryScoped({- prefix: "t3-desktop-backend-config-test-",- });-- yield* Effect.gen(function* () {- const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;- const config = yield* configuration.resolveWsl({ port: 5050, distro: "Ubuntu" });- const failure = Option.getOrThrow(config.preflightFailure);-- assert.isFalse(failure.fatal);- assert.equal(failure.retryLimit, 12);- assert.include(failure.reason, "timed out");- }).pipe(- Effect.provide(- layerBackendConfiguration().pipe(- Layer.provideMerge(layerServerExposure),- Layer.provideMerge(DesktopAppSettings.layerTest()),- Layer.provideMerge(DesktopWslServerTree.layerTest()),- Layer.provideMerge(- DesktopWslEnvironment.layerTest({- isAvailable: true,- distroListError: new DesktopWslEnvironment.DesktopWslDistroListError({- reason: "wsl.exe --list --verbose timed out",- }),- }),- ),- Layer.provideMerge(layerEnvironment(baseDir, { platform: "win32" })),- ),- ),- );- }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),- );-it.effect("resolveWsl marks a missing packaged server entry as fatal", () =>Effect.gen(function* () {const fileSystem = yield* FileSystem.FileSystem;diff --git a/apps/desktop/src/backend/DesktopBackendManager.test.ts b/apps/desktop/src/backend/DesktopBackendManager.test.tsindex dbee71d5e70..7b15346a754 100644--- a/apps/desktop/src/backend/DesktopBackendManager.test.ts+++ b/apps/desktop/src/backend/DesktopBackendManager.test.ts@@ -295,60 +295,6 @@ describe("DesktopBackendManager", () => {}),);- it.effect("reports output handler failures separately from stream read failures", () =>- Effect.gen(function* () {- const chunk = new TextEncoder().encode("backend output");- const nextChunk = new TextEncoder().encode("still draining");- const outputCause = new Error("output-handler-secret-sentinel");- const reported = yield* Deferred.make<DesktopBackendManager.BackendProcessOutputError>();- const drained = yield* Deferred.make<void>();- let outputCount = 0;- const layerSpawner = Layer.succeed(- ChildProcessSpawner.ChildProcessSpawner,- ChildProcessSpawner.make(() =>- Effect.succeed(- makeProcess({- stdout: Stream.make(chunk, nextChunk),- exitCode: Deferred.await(drained).pipe(Effect.as(ChildProcessSpawner.ExitCode(0))),- }),- ),- ),- );-- const exit = yield* DesktopBackendManager.runBackendProcess({- ...baseConfig,- desktopTelemetryStream: Stream.empty,- onOutput: () => {- outputCount += 1;- return outputCount === 1- ? Effect.fail(outputCause)- : Deferred.succeed(drained, void 0).pipe(Effect.asVoid);- },- onOutputFailure: (error) => Deferred.succeed(reported, error).pipe(Effect.asVoid),- }).pipe(Effect.scoped, Effect.provide(Layer.merge(layerSpawner, layerHealthyHttpClient)));- const error = yield* Deferred.await(reported);-- assert.equal(exit.code.pipe(Option.getOrUndefined), 0);- if (error._tag !== "BackendProcessOutputHandlingError") {- return assert.fail(`Expected output handling error, received ${error._tag}`);- }- assert.equal(error.executablePath, "/electron");- assert.equal(error.entryPath, "/server/bin.mjs");- assert.equal(error.cwd, "/server");- assert.equal(error.httpBaseUrl.href, "http://127.0.0.1:3773/");- assert.equal(error.pid, 123);- assert.equal(error.streamName, "stdout");- assert.equal(error.chunkByteLength, chunk.byteLength);- assert.strictEqual(error.cause, outputCause);- assert.equal(- error.message,- `Failed to handle ${chunk.byteLength} bytes from stdout of desktop backend process 123.`,- );- assert.notInclude(error.message, "output-handler-secret-sentinel");- assert.equal(outputCount, 2);- }),- );-it.effect("reports child exit before waiting for trailing output to drain", () =>Effect.scoped(Effect.gen(function* () {diff --git a/apps/desktop/src/backend/DesktopServerExposure.test.ts b/apps/desktop/src/backend/DesktopServerExposure.test.tsindex 42808732893..f53cde3e451 100644--- a/apps/desktop/src/backend/DesktopServerExposure.test.ts+++ b/apps/desktop/src/backend/DesktopServerExposure.test.ts@@ -191,20 +191,6 @@ describe("DesktopServerExposure", () => {),);- it.effect("returns a typed error when network access is explicitly unavailable", () =>- withHarness(- emptyNetworkInterfaces,- Effect.gen(function* () {- const serverExposure = yield* DesktopServerExposure.DesktopServerExposure;- yield* serverExposure.configureFromSettings({ port: 4173 });-- const error = yield* serverExposure.setMode("network-accessible").pipe(Effect.flip);- assert.ok(error._tag === "DesktopServerExposureNoNetworkAddressError");- assert.equal(error.port, 4173);- }),- ),- );-it.effect("persists network-accessible mode and updates backend binding state", () =>withHarness(lanNetworkInterfaces,diff --git a/apps/desktop/src/backend/tailscaleEndpointProvider.test.ts b/apps/desktop/src/backend/tailscaleEndpointProvider.test.tsindex ffd64dc3bec..054655917ce 100644--- a/apps/desktop/src/backend/tailscaleEndpointProvider.test.ts+++ b/apps/desktop/src/backend/tailscaleEndpointProvider.test.ts@@ -4,10 +4,7 @@ import * as Layer from "effect/Layer";import { HttpClient } from "effect/http";import { ChildProcessSpawner } from "effect/process";-import {- parseTailscaleMagicDnsName,- resolveTailscaleAdvertisedEndpoints,-} from "./tailscaleEndpointProvider.ts";+import { resolveTailscaleAdvertisedEndpoints } from "./tailscaleEndpointProvider.ts";const layerUnusedTailscaleExternalServices = Layer.mergeAll(Layer.succeed(@@ -82,52 +79,4 @@ describe("tailscale endpoint provider", () => {);}).pipe(Effect.provide(layerUnusedTailscaleExternalServices)),);-- it.effect("parses MagicDNS names from tailscale status", () =>- Effect.gen(function* () {- const dnsName = yield* parseTailscaleMagicDnsName(- `{"Self":{"DNSName":"desktop.tail.ts.net."}}`,- );- assert.equal(dnsName, "desktop.tail.ts.net");- assert.equal(yield* parseTailscaleMagicDnsName("{}"), null);- const malformed = yield* Effect.result(parseTailscaleMagicDnsName("not-json"));- assert.isTrue(malformed._tag === "Failure");- }),- );-- it.effect(- "marks the Tailscale HTTPS endpoint available after Serve is enabled and reachable",- () =>- Effect.gen(function* () {- const endpoints = yield* resolveTailscaleAdvertisedEndpoints({- port: 3773,- networkInterfaces: {},- statusJson: `{"Self":{"DNSName":"desktop.tail.ts.net."}}`,- serveEnabled: true,- probe: () => Effect.succeed(true),- });- assert.deepEqual(endpoints, [- {- id: "tailscale-magicdns:https://desktop.tail.ts.net/",- label: "Tailscale HTTPS",- provider: {- id: "tailscale",- label: "Tailscale",- kind: "private-network",- isAddon: true,- },- httpBaseUrl: "https://desktop.tail.ts.net/",- wsBaseUrl: "wss://desktop.tail.ts.net/",- reachability: "private-network",- compatibility: {- hostedHttpsApp: "compatible",- desktopApp: "compatible",- },- source: "desktop-addon",- status: "available",- description: "HTTPS endpoint served by Tailscale Serve.",- },- ]);- }).pipe(Effect.provide(layerUnusedTailscaleExternalServices)),- );});diff --git a/apps/desktop/src/backend/tailscaleEndpointProvider.ts b/apps/desktop/src/backend/tailscaleEndpointProvider.tsindex ec3819ae98a..044625a32b4 100644--- a/apps/desktop/src/backend/tailscaleEndpointProvider.ts+++ b/apps/desktop/src/backend/tailscaleEndpointProvider.ts@@ -15,8 +15,6 @@ import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";import type { NetworkInterfaces } from "./DesktopNetworkInterfaces.ts";-export { parseTailscaleMagicDnsName } from "@t3tools/tailscale";-const TAILSCALE_ENDPOINT_PROVIDER: AdvertisedEndpointProvider = {id: "tailscale",label: "Tailscale",diff --git a/apps/desktop/src/electron/ElectronProtocol.test.ts b/apps/desktop/src/electron/ElectronProtocol.test.tsindex 4f16fdcdb9f..45d1771f26f 100644--- a/apps/desktop/src/electron/ElectronProtocol.test.ts+++ b/apps/desktop/src/electron/ElectronProtocol.test.ts@@ -153,46 +153,4 @@ describe("ElectronProtocol", () => {assert.equal(netFetchMock.mock.calls.length, 0);}).pipe(Effect.provide(layerProtocol)),);-- it("keeps executable sources host-restricted while allowing runtime network resources", () => {- const policy = ElectronProtocol.makeDesktopContentSecurityPolicy({- scheme: "t3code",- targetOrigin: new URL("http://127.0.0.1:3773/"),- clerkFrontendApiHostname: "clerk.t3.codes",- });- const directives = Object.fromEntries(- policy.split("; ").map((directive) => {- const [name, ...sources] = directive.split(" ");- return [name, sources];- }),- );-- assert.deepEqual(directives["script-src"], [- "'self'",- "'unsafe-inline'",- "'wasm-unsafe-eval'",- "https://clerk.t3.codes",- "https://challenges.cloudflare.com",- ]);- assert.deepEqual(directives["connect-src"], [- "'self'",- "blob:",- "http:",- "https:",- "ws:",- "wss:",- ]);- assert.deepEqual(directives["img-src"], [- "'self'",- "t3code:",- "blob:",- "data:",- "http:",- "https:",- ]);- assert.deepEqual(directives["media-src"], ["'self'", "t3code:", "blob:", "http:", "https:"]);- assert.deepEqual(directives["frame-src"], ["'self'", "blob:", "http:", "https:"]);- assert.deepEqual(directives["object-src"], ["'self'", "blob:", "http:", "https:"]);- assert.deepEqual(directives["font-src"], ["'self'", "t3code:", "data:"]);- });});diff --git a/apps/desktop/src/electron/ElectronProtocol.ts b/apps/desktop/src/electron/ElectronProtocol.tsindex 9abe17d7751..d6f476205f4 100644--- a/apps/desktop/src/electron/ElectronProtocol.ts+++ b/apps/desktop/src/electron/ElectronProtocol.ts@@ -66,7 +66,7 @@ export class ElectronProtocol extends Context.Service<}>()("@t3tools/desktop/electron/ElectronProtocol") {}-export function makeDesktopContentSecurityPolicy(input: DesktopProtocolRegistrationInput): string {+function makeDesktopContentSecurityPolicy(input: DesktopProtocolRegistrationInput): string {const clerkOrigin = input.clerkFrontendApiHostname? `https://${input.clerkFrontendApiHostname}`: undefined;diff --git a/apps/desktop/src/electron/ElectronWindow.test.ts b/apps/desktop/src/electron/ElectronWindow.test.tsindex a43e23f1932..4f17ca7e330 100644--- a/apps/desktop/src/electron/ElectronWindow.test.ts+++ b/apps/desktop/src/electron/ElectronWindow.test.ts@@ -62,13 +62,6 @@ const layerTestFor = (platform: NodeJS.Platform) =>const layerTest = layerTestFor("linux");-function makeBrowserWindow(input: { readonly id: number; readonly destroyed: boolean }) {- return {- id: input.id,- isDestroyed: vi.fn(() => input.destroyed),- } as unknown as Electron.BrowserWindow;-}-function makeWindowsRevealWindow() {return {id: 41,@@ -109,24 +102,6 @@ describe("ElectronWindow", () => {windowsForegroundCloseMock.mockReset();});- it.effect("skips windows destroyed before appearance sync runs", () =>- Effect.gen(function* () {- const liveWindow = makeBrowserWindow({ id: 1, destroyed: false });- const destroyedWindow = makeBrowserWindow({ id: 2, destroyed: true });- getAllWindowsMock.mockReturnValue([destroyedWindow, liveWindow]);-- const syncedWindows: Electron.BrowserWindow[] = [];- const electronWindow = yield* ElectronWindow.ElectronWindow;- yield* electronWindow.syncAllAppearance((window) =>- Effect.sync(() => {- syncedWindows.push(window);- }),- );-- assert.deepEqual(syncedWindows, [liveWindow]);- }).pipe(Effect.provide(layerTest)),- );-it.effect("cancels native focus when destroyed during the foreground query", () =>Effect.gen(function* () {const window = makeWindowsRevealWindow();diff --git a/apps/desktop/src/electron/WindowsForeground.test.ts b/apps/desktop/src/electron/WindowsForeground.test.tsindex c29a4693914..60975495976 100644--- a/apps/desktop/src/electron/WindowsForeground.test.ts+++ b/apps/desktop/src/electron/WindowsForeground.test.ts@@ -54,24 +54,6 @@ describe("Windows foreground activation", () => {assert.deepEqual(api.setForegroundWindow.mock.calls, [[41n]]);});- it("does not attach a thread to itself", () => {- const api = makeApi({ currentThreadId: 20, foregroundThreadId: 20 });-- assert.isTrue(activateWindowsForegroundWithApi(nativeHandle(41n), api));-- assert.lengthOf(api.attachThreadInput.mock.calls, 0);- assert.deepEqual(api.setForegroundWindow.mock.calls, [[41n]]);- });-- it("still asks Windows directly when the input queues cannot be attached", () => {- const api = makeApi({ attached: false });-- assert.isTrue(activateWindowsForegroundWithApi(nativeHandle(41n), api));-- assert.deepEqual(api.attachThreadInput.mock.calls, [[10, 20, true]]);- assert.deepEqual(api.setForegroundWindow.mock.calls, [[41n]]);- });-it("rejects malformed native handles", () => {const api = makeApi({});diff --git a/apps/desktop/src/ipc/DesktopIpc.test.ts b/apps/desktop/src/ipc/DesktopIpc.test.tsdeleted file mode 100644index cd422f79ed1..00000000000--- a/apps/desktop/src/ipc/DesktopIpc.test.ts+++ /dev/null@@ -1,49 +0,0 @@-import { assert, describe, it } from "@effect/vitest";-import * as Effect from "effect/Effect";-import { vi } from "vite-plus/test";--import * as DesktopIpc from "./DesktopIpc.ts";--function makeIpcMain(- overrides: Partial<DesktopIpc.DesktopIpcMain> = {},-): DesktopIpc.DesktopIpcMain {- return {- removeHandler: vi.fn(),- handle: vi.fn(),- removeAllListeners: vi.fn(),- on: vi.fn(),- ...overrides,- };-}--describe("DesktopIpc", () => {- it.effect("forwards the invoke sender to the method", () =>- Effect.gen(function* () {- let listener: DesktopIpc.DesktopIpcHandleListener | undefined;- const ipc = DesktopIpc.make(- makeIpcMain({- handle: (_channel, registered) => {- listener = registered;- },- }),- );- const sender = { sender: { id: 7 } };- let received: DesktopIpc.DesktopIpcInvokeEvent | undefined;-- yield* Effect.scoped(- Effect.gen(function* () {- yield* ipc.handle({- channel: "desktop.test.sender",- handler: (_raw, event) =>- Effect.sync(() => {- received = event;- }),- });- yield* Effect.promise(async () => listener!(sender, undefined));- }),- );-- assert.strictEqual(received, sender);- }),- );-});diff --git a/apps/desktop/src/ipc/methods/preview.test.ts b/apps/desktop/src/ipc/methods/preview.test.tsindex a8f33f98cf0..802f2f3fb18 100644--- a/apps/desktop/src/ipc/methods/preview.test.ts+++ b/apps/desktop/src/ipc/methods/preview.test.ts@@ -10,7 +10,6 @@ import * as Schema from "effect/Schema";import { beforeEach, describe, expect, it, vi } from "vite-plus/test";import * as PreviewManager from "../../preview/Manager.ts";-import * as BrowserImport from "../../preview/BrowserImport/BrowserImport.ts";import * as PreviewIpc from "./preview.ts";import * as DesktopIpc from "../DesktopIpc.ts";import * as DesktopClientSettings from "../../settings/DesktopClientSettings.ts";@@ -121,18 +120,6 @@ describe("preview IPC methods", () => {expect(first.scope).not.toBe(second.scope);});- it("preserves lone surrogates without collapsing them to replacement characters", () => {- const highSurrogate = PreviewIpc.resolvePartitionScope("environment", "profile-\ud800");- const lowSurrogate = PreviewIpc.resolvePartitionScope("environment", "profile-\udc00");- const replacement = PreviewIpc.resolvePartitionScope("environment", "profile-�");-- expect(highSurrogate.scope).toBe('["environment","profile-\\ud800"]');- expect(lowSurrogate.scope).toBe('["environment","profile-\\udc00"]');- expect(highSurrogate.scope).not.toBe(lowSurrogate.scope);- expect(highSurrogate.scope).not.toBe(replacement.scope);- expect(lowSurrogate.scope).not.toBe(replacement.scope);- });-it("keeps the legacy default partition scope and incognito persistence", () => {expect(PreviewIpc.resolvePartitionScope("environment::legacy", undefined)).toEqual({scope: "environment::legacy",@@ -149,36 +136,4 @@ describe("preview IPC methods", () => {namespace: "profile",});});-- effectIt.effect("targets imports at the same partition tuple as the renderer", () => {- const received: Array<Parameters<BrowserImport.BrowserImport["Service"]["importCookies"]>[0]> =- [];- const browserImport = BrowserImport.BrowserImport.of({- listSources: Effect.succeed([]),- importCookies: (input) =>- Effect.sync(() => {- received.push(input);- return { imported: 0, skipped: 0, skippedDomains: [] };- }),- });- const request = (environmentId: string, targetProfileId: string) =>- PreviewIpc.importBrowserCookies.handler({- environmentId,- sourceId: "helium",- sourceProfileDirectory: "Default",- targetProfileId,- });-- return Effect.gen(function* () {- yield* request("a", "b");- yield* request("a::b", DEFAULT_BROWSER_PROFILE_ID);-- expect(received[0]).toMatchObject(PreviewIpc.resolvePartitionScope("a", "b"));- expect(received[1]).toMatchObject(- PreviewIpc.resolvePartitionScope("a::b", DEFAULT_BROWSER_PROFILE_ID),- );- expect(received[0]?.namespace).toBe("profile");- expect(received[1]?.namespace).toBeUndefined();- }).pipe(Effect.provideService(BrowserImport.BrowserImport, browserImport));- });});diff --git a/apps/desktop/src/ipc/methods/snapShot.test.ts b/apps/desktop/src/ipc/methods/snapShot.test.tsindex 6f222a0cd69..7e1ae602f97 100644--- a/apps/desktop/src/ipc/methods/snapShot.test.ts+++ b/apps/desktop/src/ipc/methods/snapShot.test.ts@@ -67,36 +67,6 @@ describe("window capture IPC", () => {);});- it.effect("uses only the file returned by the native custom config picker", () => {- let path: string | undefined;- return Effect.gen(function* () {- yield* previewSnapShotConfig.handler(- { operation: "install", chooseFile: true },- { sender: { id: 7 } },- );- assert.equal(path, "/chosen/config.kdl");- }).pipe(- Effect.provide(- Layer.mergeAll(- Layer.succeed(ElectronWindow.ElectronWindow, {- main: Effect.succeedSome({ webContents: { id: 7 } }),- } as ElectronWindow.ElectronWindow["Service"]),- Layer.succeed(DesktopSnapShot.DesktopSnapShot, {- state: Effect.succeed({ linuxBackend: "niri" }),- previewConfig: (_: unknown, selected: string) =>- Effect.sync(() => {- path = selected;- return configPreview;- }),- } as unknown as DesktopSnapShot.DesktopSnapShot["Service"]),- Layer.succeed(ElectronDialog.ElectronDialog, {- pickFiles: () => Effect.succeed(["/chosen/config.kdl"]),- } as unknown as ElectronDialog.ElectronDialog["Service"]),- ),- ),- );- });-it.effect("allows capture setup only from the trusted main renderer", () => {const actions: string[] = [];return Effect.gen(function* () {diff --git a/apps/desktop/src/ipc/methods/sshEnvironment.test.ts b/apps/desktop/src/ipc/methods/sshEnvironment.test.tsindex 8c6a5acd7a7..1b40db955fe 100644--- a/apps/desktop/src/ipc/methods/sshEnvironment.test.ts+++ b/apps/desktop/src/ipc/methods/sshEnvironment.test.ts@@ -34,37 +34,6 @@ function layerHttpClient(}describe("SSH environment IPC", () => {- it.effect("fetches and decodes the remote environment descriptor", () => {- const requestUrls: string[] = [];- const layer = layerHttpClient((request) =>- Effect.sync(() => {- requestUrls.push(request.url);- return jsonResponse(request, {- environmentId: "remote-env",- label: "Remote Devbox",- platform: { os: "linux", arch: "x64" },- serverVersion: "1.2.3",- capabilities: { repositoryIdentity: true },- });- }),- );-- return Effect.gen(function* () {- const descriptor = yield* fetchSshEnvironmentDescriptor.handler({- httpBaseUrl: "http://127.0.0.1:41773/",- });-- assert.deepEqual(descriptor, {- environmentId: "remote-env",- label: "Remote Devbox",- platform: { os: "linux", arch: "x64" },- serverVersion: "1.2.3",- capabilities: { repositoryIdentity: true },- });- assert.deepEqual(requestUrls, ["http://127.0.0.1:41773/.well-known/t3/environment"]);- }).pipe(Effect.provide(layer));- });-it.effect("rejects non-loopback HTTP endpoints before issuing a request", () => {let requestCount = 0;const layer = layerHttpClient((request) =>diff --git a/apps/desktop/src/permissions/MacPermissionHelper.test.ts b/apps/desktop/src/permissions/MacPermissionHelper.test.tsindex 38c48cf1ea6..0704f52254e 100644--- a/apps/desktop/src/permissions/MacPermissionHelper.test.ts+++ b/apps/desktop/src/permissions/MacPermissionHelper.test.ts@@ -1,8 +1,6 @@import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";-import * as Electron from "electron";import { MacPermissionHelper } from "./MacPermissionHelper.ts";import type { SettingsWindow } from "./MacSettingsWindow.ts";-import { MAC_PERMISSION_HELPER_CHANNEL } from "../ipc/channels.ts";const mocks = vi.hoisted(() => ({granted: false,@@ -110,31 +108,6 @@ afterEach(() => {const iconPaths = ["/bundle/prod-resources/icon.png"];const open = () =>helper.show("accessibility", "/bundle/mac-permission-preload.cjs", null, iconPaths);-function send(action: string, trusted = true) {- const window = windows.at(-1)!;- Electron.ipcMain.emit(- MAC_PERMISSION_HELPER_CHANNEL,- {- sender: trusted ? window.webContents : {},- senderFrame: window.webContents.mainFrame,- },- action,- );-}-it("drags the running app bundle only for the helper's own renderer", async () => {- await open();- send("drag", false);- expect(mocks.startDrag).not.toHaveBeenCalled();- send("drag");- expect(mocks.createFromPath).toHaveBeenCalledWith("/bundle/prod-resources/icon.png");- expect(mocks.startDrag).toHaveBeenCalledWith({- file: "/Applications/T3 Code (Nightly).app",- icon: mocks.createFromPath.mock.results[0]!.value.resize(),- });- send("finder");- expect(mocks.showItemInFolder).toHaveBeenCalledWith("/Applications/T3 Code (Nightly).app");-});-it("does not reopen a superseded helper when its initial probe completes", async () => {const pending = Promise.withResolvers<boolean>();const first = helper.show(diff --git a/apps/desktop/src/preview/BrowserImport/ChromiumCookies.test.ts b/apps/desktop/src/preview/BrowserImport/ChromiumCookies.test.tsindex 76bcdeefea3..91be0a43d1b 100644--- a/apps/desktop/src/preview/BrowserImport/ChromiumCookies.test.ts+++ b/apps/desktop/src/preview/BrowserImport/ChromiumCookies.test.ts@@ -47,13 +47,6 @@ describe("cookieScope", () => {});});- it("preserves a domain cookie's leading dot", () => {- expect(cookieScope(".example.test", "/app", true)).toEqual({- url: "https://example.test/app",- domain: ".example.test",- });- });-it("brackets bare IPv6 hosts without duplicating existing brackets", () => {expect(cookieScope("::1", "/", false)).toEqual({url: "http://[::1]/",@@ -334,38 +327,6 @@ describe("readChromiumCookieDatabase", () => {}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),);- it.effect("preserves arbitrary long encrypted values from pre-24 schemas", () =>- Effect.gen(function* () {- const fileSystem = yield* FileSystem.FileSystem;- const directory = yield* fileSystem.makeTempDirectoryScoped({- prefix: "t3code-chromium-cookies-",- });- const filename = `${directory}/Cookies`;- const key = Buffer.from("0123456789abcdef");- const value = "x".repeat(32) + " legacy value";-- yield* Effect.gen(function* () {- const sql = yield* SqlClient.SqlClient;- yield* sql`create table meta (key text primary key, value text not null)`;- yield* sql`insert into meta values ('version', 23)`;- yield* sql`- create table cookies (- host_key text not null, name text not null, value text not null,- encrypted_value blob not null, path text not null, expires_utc integer not null,- is_secure integer not null, is_httponly integer not null, samesite integer not null,- top_frame_site_key text not null default ''- )- `;- yield* sql`insert into cookies (host_key, name, value, encrypted_value, path, expires_utc, is_secure, is_httponly, samesite) values- ('legacy.example', 'legacy', '', ${encryptV10(value, key)}, '/', 0, 0, 0, 0)`;- }).pipe(Effect.provide(NodeSqliteClient.layer({ filename })));-- const result = yield* readChromiumCookieDatabase(filename, { cbcV10: key }, "darwin");- expect(result.cookies[0]?.value).toBe(value);- expect(result.undecryptable).toBe(0);- }).pipe(Effect.provide(NodeServices.layer), Effect.scoped),- );-it.effect("treats unversioned encrypted values as legacy plaintext on macOS and Linux", () =>Effect.gen(function* () {const fileSystem = yield* FileSystem.FileSystem;diff --git a/apps/desktop/src/preview/BrowserImport/ChromiumKeys.test.ts b/apps/desktop/src/preview/BrowserImport/ChromiumKeys.test.tsindex 62744d87ca6..6fc5b7ae9fa 100644--- a/apps/desktop/src/preview/BrowserImport/ChromiumKeys.test.ts+++ b/apps/desktop/src/preview/BrowserImport/ChromiumKeys.test.ts@@ -146,28 +146,6 @@ describe("Linux Chromium secrets", () => {),);- it.effect("looks up the browser's libsecret application attribute", () => {- let captured: CapturedCommand | undefined;- return Effect.gen(function* () {- const keys = yield* resolveChromiumKeys({- platform: "linux",- keychainService: "ignored macOS service",- keychainAccount: "ignored macOS account",- linuxSecretApplication: "msedge",- });-- expect(captured?.command).toBe("/bundled/browser-secret/t3-browser-secret");- expect(captured?.args).toEqual(["msedge"]);- expect(captured?.options.stdin).toBe("ignore");- expect(keys.cbcV10).toHaveLength(16);- expect(keys.cbcV11).toHaveLength(16);- }).pipe(- Effect.provide(- layerHelper({ stdout: "linux-secret", capture: (value) => (captured = value) }),- ),- );- });-it.effect("preserves trailing whitespace in the stored secret", () =>Effect.gen(function* () {const secret = yield* readLinuxSecret("chrome");@@ -220,19 +198,6 @@ describe("Linux Chromium secrets", () => {);},);-- it.effect("keeps the v10 fallback when no matching v11 secret exists", () =>- Effect.gen(function* () {- const keys = yield* resolveChromiumKeys({- platform: "linux",- keychainService: undefined,- keychainAccount: undefined,- linuxSecretApplication: "vivaldi",- });- expect(keys.cbcV10).toHaveLength(16);- expect(keys.cbcV11).toBeUndefined();- }).pipe(Effect.provide(layerHelper({ exitCode: 2 }))),- );});describe("Windows Chromium secrets", () => {diff --git a/apps/desktop/src/preview/BrowserImport/SafariCookies.test.ts b/apps/desktop/src/preview/BrowserImport/SafariCookies.test.tsindex 53b46dc383e..5420b9fc8bd 100644--- a/apps/desktop/src/preview/BrowserImport/SafariCookies.test.ts+++ b/apps/desktop/src/preview/BrowserImport/SafariCookies.test.ts@@ -11,7 +11,6 @@ import {parseBinaryCookies,readSafariCookies,safariAccessDenied,- safariAccessGranted,SafariCookieReadError,} from "./SafariCookies.ts";@@ -180,18 +179,6 @@ describe("parseBinaryCookies", () => {);});- it("rejects a record whose declared size runs past its page", () => {- const valid = encodeBinaryCookies([- { domain: "a.test", name: "n", path: "/", value: "v", expiry: 1_000, flags: 0 },- ]);- const pageStart = 8 + 4;- const recordStart = pageStart + valid.readUInt32LE(pageStart + 8);- const corrupt = Buffer.from(valid);- corrupt.writeUInt32LE(0xffff, recordStart);-- expect(() => parseBinaryCookies(corrupt)).toThrow(SafariCookieReadError);- });-it("rejects record offsets that point into the page header or an earlier record", () => {const valid = encodeBinaryCookies([{ domain: "a.test", name: "n", path: "/", value: "v", expiry: 1_000, flags: 0 },@@ -211,22 +198,6 @@ describe("parseBinaryCookies", () => {expect(parseBinaryCookies(valid)).toHaveLength(2);});- it("rejects string offsets that point into the record header", () => {- const valid = encodeBinaryCookies([- { domain: "a.test", name: "n", path: "/", value: "v", expiry: 1_000, flags: 0 },- ]);- const pageStart = 8 + 4;- const recordStart = pageStart + valid.readUInt32LE(pageStart + 8);-- for (const offsetField of [16, 20, 24, 28]) {- const corrupt = Buffer.from(valid);- corrupt.writeUInt32LE(55, recordStart + offsetField);- expect(() => parseBinaryCookies(corrupt), `offset field ${offsetField}`).toThrow(- SafariCookieReadError,- );- }- });-it("accepts the checksum and property-list trailer Safari writes", () => {const file = encodeBinaryCookies([{ domain: "a.test", name: "c", path: "/", value: "v", flags: 0, expiry: 0 },@@ -239,24 +210,6 @@ describe("parseBinaryCookies", () => {expect(parseBinaryCookies(Buffer.concat([file, checksum]))).toHaveLength(1);expect(parseBinaryCookies(Buffer.concat([file, checksum, plistLength, plist]))).toHaveLength(1);});-- it("rejects a jar whose page table stops short of its contents", () => {- const first = encodeBinaryCookies([- { domain: "a.test", name: "c", path: "/", value: "v", flags: 0, expiry: 0 },- ]);- const extraPage = encodeBinaryCookies([- { domain: "b.test", name: "d", path: "/", value: "w", flags: 0, expiry: 0 },- ]).subarray(12);-- expect(() => parseBinaryCookies(Buffer.concat([first, extraPage]))).toThrow(- SafariCookieReadError,- );- const badLength = Buffer.alloc(4);- badLength.writeUInt32BE(99, 0);- expect(() =>- parseBinaryCookies(Buffer.concat([first, Buffer.alloc(8), badLength, Buffer.from("x")])),- ).toThrow(SafariCookieReadError);- });});describe("readSafariCookies", () => {@@ -284,26 +237,6 @@ describe("readSafariCookies", () => {});describe("safariAccessDenied", () => {- const eperm = PlatformError.systemError({- _tag: "Unknown",- module: "FileSystem",- method: "open",- pathOrDescriptor: "/protected/Cookies.binarycookies",- cause: Object.assign(new Error("operation not permitted"), { code: "EPERM" }),- });- const denied = (error: PlatformError.PlatformError) =>- FileSystem.layerNoop({ open: () => Effect.fail(error) });-- it.effect("reports TCC's EPERM as a missing Full Disk Access grant", () =>- Effect.gen(function* () {- assert.isTrue(- yield* safariAccessDenied("/protected/Cookies.binarycookies").pipe(- Effect.provide(denied(eperm)),- ),- );- }),- );-it.effect("does not read a readable jar, or any other failure, as denied", () =>Effect.gen(function* () {const fileSystem = yield* FileSystem.FileSystem;@@ -324,20 +257,3 @@ describe("isPermissionDenied", () => {expect(isPermissionDenied(platformError("PermissionDenied", "EACCES"))).toBe(false);});});--describe("safariAccessGranted", () => {- it.effect("only reports a successful read-only open as granted", () =>- Effect.gen(function* () {- const fileSystem = yield* FileSystem.FileSystem;- const directory = yield* fileSystem.makeTempDirectoryScoped({- prefix: "t3-safari-permission-",- });- const jar = `${directory}/Cookies.binarycookies`;- assert.isFalse(yield* safariAccessGranted(jar));- yield* fileSystem.writeFileString(jar, "no cookie parsing needed");- assert.isTrue(yield* safariAccessGranted(jar));- yield* fileSystem.remove(jar);- assert.isFalse(yield* safariAccessGranted(jar));- }).pipe(Effect.provide(NodeServices.layer), Effect.scoped),- );-});diff --git a/apps/desktop/src/preview/BrowserSession.test.ts b/apps/desktop/src/preview/BrowserSession.test.tsindex 60a4c510f48..45d2aeafdbf 100644--- a/apps/desktop/src/preview/BrowserSession.test.ts+++ b/apps/desktop/src/preview/BrowserSession.test.ts@@ -250,50 +250,4 @@ describe("BrowserSession", () => {assert.strictEqual(created.clearStorageData.mock.calls.length, 1);}).pipe(Effect.provide(layer)),);-- it.effect("correlates clear failures while still attempting every session", () =>- Effect.gen(function* () {- const browserSessions = yield* BrowserSession.BrowserSession;- yield* browserSessions.getSession("scope-a");- yield* browserSessions.getSession("scope-b");- const firstPartition = yield* browserSessions.getPartition("scope-a");- const secondPartition = yield* browserSessions.getPartition("scope-b");- const firstSession = sessions.get(firstPartition);- const secondSession = sessions.get(secondPartition);- assert.isDefined(firstSession);- assert.isDefined(secondSession);-- const storageCause = new Error("storage clear failed");- secondSession.clearStorageData.mockImplementationOnce(() => Promise.reject(storageCause));- const storageError = yield* browserSessions.clearCookies().pipe(Effect.flip);-- assert.instanceOf(storageError, BrowserSession.BrowserSessionStorageClearError);- assert.equal(storageError.partition, secondPartition);- assert.strictEqual(storageError.cause, storageCause);- assert.equal(- storageError.message,- `Failed to clear desktop preview browser storage for partition ${secondPartition}.`,- );- assert.notInclude(storageError.message, storageCause.message);- for (const browserSession of sessions.values()) {- assert.strictEqual(browserSession.clearStorageData.mock.calls.length, 1);- }-- const cacheCause = new Error("cache clear failed");- firstSession.clearCache.mockImplementationOnce(() => Promise.reject(cacheCause));- const cacheError = yield* browserSessions.clearCache().pipe(Effect.flip);-- assert.instanceOf(cacheError, BrowserSession.BrowserSessionCacheClearError);- assert.equal(cacheError.partition, firstPartition);- assert.strictEqual(cacheError.cause, cacheCause);- assert.equal(- cacheError.message,- `Failed to clear the desktop preview browser cache for partition ${firstPartition}.`,- );- assert.notInclude(cacheError.message, cacheCause.message);- for (const browserSession of sessions.values()) {- assert.strictEqual(browserSession.clearCache.mock.calls.length, 1);- }- }).pipe(Effect.provide(layer)),- );});diff --git a/apps/desktop/src/preview/FaviconCapture.test.ts b/apps/desktop/src/preview/FaviconCapture.test.tsindex 47a6312772a..2163dc002b7 100644--- a/apps/desktop/src/preview/FaviconCapture.test.ts+++ b/apps/desktop/src/preview/FaviconCapture.test.ts@@ -386,21 +386,6 @@ describe("captureFavicon", () => {expect(executeJavaScriptInIsolatedWorld).not.toHaveBeenCalled();});- it("rejects JPEGs with multiple frame headers before rasterization", async () => {- const buffer = Buffer.concat([sourceJpeg(4096, 4096), sourceJpeg(1, 1).subarray(2)]);- const { webContents, executeJavaScriptInIsolatedWorld } = makeWebContents();-- expect(- await captureFavicon({- webContents,- pageUrl: "https://example.com/page",- candidates: [`data:image/jpeg;base64,${buffer.toString("base64")}`],- signal: new AbortController().signal,- }),- ).toEqual({ kind: "none" });- expect(executeJavaScriptInIsolatedWorld).not.toHaveBeenCalled();- });-it.each([["GIF", "image/gif", sourceGif(4096, 4096)],["GIF frame", "image/gif", sourceGif(1, 1, 4096, 4096)],@@ -454,21 +439,6 @@ describe("captureFavicon", () => {expect(executeJavaScriptInIsolatedWorld).not.toHaveBeenCalled();});- it("ignores output that is not a bounded PNG data URL", async () => {- const { webContents } = makeWebContents({- rasterize: async () => "data:image/svg+xml;base64,c3Zn",- });-- expect(- await captureFavicon({- webContents,- pageUrl: "https://example.com/page",- candidates: [SOURCE_PNG_URL],- signal: new AbortController().signal,- }),- ).toEqual({ kind: "none" });- });-it("coalesces queued rasterizations so only the latest pending capture launches", async () => {let resolveFirst!: (value: unknown) => void;let executions = 0;diff --git a/apps/desktop/src/preview/GuestInput.test.ts b/apps/desktop/src/preview/GuestInput.test.tsindex 150bd59f0eb..6cb297ff81e 100644--- a/apps/desktop/src/preview/GuestInput.test.ts+++ b/apps/desktop/src/preview/GuestInput.test.ts@@ -64,6 +64,7 @@ describe("CDP key events as Electron input", () => {]);});+ // regression: #18556 agent typing in a preview tab landed in the app instead of the guestit("names arrows and function keys as Electron accelerators", () => {expect(toKeyboardInputEvents({ type: "keyUp", key: "ArrowLeft", modifiers: 3 })).toEqual([{ type: "keyUp", keyCode: "Left", modifiers: ["alt", "control"] },diff --git a/apps/desktop/src/preview/Manager.test.ts b/apps/desktop/src/preview/Manager.test.tsindex 03b18885da0..6ded53bfaf1 100644--- a/apps/desktop/src/preview/Manager.test.ts+++ b/apps/desktop/src/preview/Manager.test.ts@@ -922,39 +922,6 @@ describe("PreviewManager", () => {),);- effectIt.effect("allows an identical retry after an undecodable capture", () =>- withManager((manager) =>- Effect.gen(function* () {- const changes = makeChangeSignal();- let rasterizations = 0;- const preview = makeFaviconWebContents({- changes,- rasterize: async () => (++rasterizations === 1 ? null : TEST_FAVICON),- });- fromId.mockReturnValue(preview.webContents);- const states: PreviewManager.PreviewTabState[] = [];- yield* manager.subscribeStateChanges((_tabId, state) =>- Effect.sync(() => {- states.push(state);- changes.notify();- }),- );- yield* manager.createTab("tab_favicon_retry");- yield* manager.registerWebview("tab_favicon_retry", 42);- const faviconUpdated = preview.listeners.get("page-favicon-updated")!;-- faviconUpdated({} as never, ["http://localhost:3200/favicon.png"] as never);- yield* changes.until(() => rasterizations === 1);- yield* flushMicrotasks();- faviconUpdated({} as never, ["http://localhost:3200/favicon.png"] as never);- yield* changes.until(() => states.at(-1)?.favicon !== undefined);-- expect(rasterizations).toBe(2);- expect(states.at(-1)?.favicon?.dataUrl).toBe(TEST_FAVICON);- }),- ),- );-effectIt.effect("does not publish a capture invalidated by navigation", () =>withManager((manager) =>Effect.gen(function* () {@@ -1253,29 +1220,6 @@ describe("PreviewManager", () => {};};- effectIt.effect("still registers a guest that refuses the mute reassert", () =>- withManager((manager) =>- Effect.gen(function* () {- const first = makeAudioWebContents(42);- fromId.mockReturnValue(first.wc);- yield* manager.createTab("tab_audio_attach_fail");- yield* manager.registerWebview("tab_audio_attach_fail", 42);- yield* Effect.yieldNow;- yield* manager.setAudioMuted("tab_audio_attach_fail", true);-- const replacement = makeAudioWebContents(43);- replacement.setAudioMuted.mockImplementationOnce(() => undefined);- replacement.setAudioMuted.mockImplementationOnce(() => {- throw new Error("guest went away");- });- fromId.mockReturnValue(replacement.wc);-- const exit = yield* manager.registerWebview("tab_audio_attach_fail", 43).pipe(Effect.exit);- expect(Exit.isSuccess(exit)).toBe(true);- }),- ),- );-effectIt.effect("reconciles audibility that changed while the guest attached", () =>withManager((manager) =>Effect.gen(function* () {@@ -2552,6 +2496,7 @@ describe("PreviewManager", () => {}),);+ // regression: #18441 zero-area strokes on the viewport edge must still get a screenshot cropeffectIt.effect.each([{name: "zero-width SVG line on the left edge",diff --git a/apps/desktop/src/preview/PasskeyBridge.test.ts b/apps/desktop/src/preview/PasskeyBridge.test.tsindex 61d5b94c77a..3b72ab58907 100644--- a/apps/desktop/src/preview/PasskeyBridge.test.ts+++ b/apps/desktop/src/preview/PasskeyBridge.test.ts@@ -149,18 +149,6 @@ describe("installPasskeyBridge", () => {assert.instanceOf(fetched, TypeError);});- it("refuses when the main process has no handler for the page", async () => {- const { credentials } = install(() => {- throw new Error("Error invoking remote method 'preview:passkey-get': No handler registered");- });-- const error = await credentials- .get({ publicKey: { challenge: new Uint8Array([1]) } })- .catch((caught: unknown) => caught);- assert.instanceOf(error, DOMException);- assert.strictEqual((error as DOMException).name, "NotAllowedError");- });-it("rejects as soon as the page aborts, without waiting on the system sheet", async () => {const { credentials } = install(() => new Promise(() => {}));const controller = new AbortController();diff --git a/apps/desktop/src/preview/PickedElementPayload.test.ts b/apps/desktop/src/preview/PickedElementPayload.test.tsindex 4f316aed335..68f313783a2 100644--- a/apps/desktop/src/preview/PickedElementPayload.test.ts+++ b/apps/desktop/src/preview/PickedElementPayload.test.ts@@ -31,10 +31,6 @@ function validPayload(overrides?: Record<string, unknown>): Record<string, unkno}describe("isPickedElementPayload", () => {- it("accepts a complete, well-typed payload", () => {- expect(isPickedElementPayload(validPayload())).toBe(true);- });-it("rejects non-finite numeric line/column numbers", () => {expect(isPickedElementPayload(diff --git a/apps/desktop/src/preview/WebviewPreferences.test.ts b/apps/desktop/src/preview/WebviewPreferences.test.tsindex c9496cfd4a4..182b6a505d1 100644--- a/apps/desktop/src/preview/WebviewPreferences.test.ts+++ b/apps/desktop/src/preview/WebviewPreferences.test.ts@@ -32,12 +32,4 @@ describe("PREVIEW_WEBVIEW_PREFERENCES", () => {it("keeps the renderer sandbox enabled (so the page cannot reach Node APIs)", () => {expect(parsed["sandbox"]).toBe("true");});-- it("disables nodeIntegration (defense in depth — page never gets Node)", () => {- expect(parsed["nodeIntegration"]).toBe("false");- });-- it("contains no whitespace (Electron's parser does not trim)", () => {- expect(PREVIEW_WEBVIEW_PREFERENCES).not.toMatch(/\s/);- });});diff --git a/apps/desktop/src/settings/DesktopAppSettings.test.ts b/apps/desktop/src/settings/DesktopAppSettings.test.tsindex cbf44702e0f..832a7745771 100644--- a/apps/desktop/src/settings/DesktopAppSettings.test.ts+++ b/apps/desktop/src/settings/DesktopAppSettings.test.ts@@ -3,7 +3,6 @@ import { assert, describe, it } from "@effect/vitest";import * as Effect from "effect/Effect";import * as FileSystem from "effect/FileSystem";import * as Layer from "effect/Layer";-import * as Option from "effect/Option";import * as Schema from "effect/Schema";import * as DesktopConfig from "../app/DesktopConfig.ts";@@ -110,53 +109,6 @@ describe("DesktopSettings", () => {),);- it.effect("loads persisted settings and applies semantic updates", () =>- withSettings(- Effect.gen(function* () {- const settings = yield* DesktopAppSettings.DesktopAppSettings;- yield* writeSettingsPatch({- linuxPasswordStore: "gnome-libsecret",- serverExposureMode: "network-accessible",- tailscaleServeEnabled: true,- tailscaleServePort: 8443,- updateChannel: "latest",- updateChannelConfiguredByUser: true,- });-- assert.deepEqual(yield* settings.load, {- linuxPasswordStore: "gnome-libsecret",- localEnvironmentEnabled: true,- mainWindowBounds: null,- mainWindowMaximized: false,- serverExposureMode: "network-accessible",- tailscaleServeEnabled: true,- tailscaleServePort: 8443,- updateChannel: "latest",- updateChannelConfiguredByUser: true,- wslBackendEnabled: false,- wslOnly: false,- wslDistro: null,- } satisfies DesktopAppSettings.DesktopSettings);-- const exposure = yield* settings.setServerExposureMode("local-only");- assert.isTrue(exposure.changed);- assert.equal(exposure.settings.serverExposureMode, "local-only");-- const tailscale = yield* settings.setTailscaleServe({- enabled: true,- port: Option.some(9443),- });- assert.isTrue(tailscale.changed);- assert.equal(tailscale.settings.tailscaleServePort, 9443);-- const updateChannel = yield* settings.setUpdateChannel("nightly");- assert.isTrue(updateChannel.changed);- assert.equal(updateChannel.settings.updateChannel, "nightly");- assert.equal(updateChannel.settings.updateChannelConfiguredByUser, true);- }),- ),- );-it.effect("falls back to defaults when the settings file is malformed", () =>withSettings(Effect.gen(function* () {@@ -406,19 +358,4 @@ describe("DesktopSettings", () => {}),),);-- it.effect("drops invalid persisted wsl distro values on load", () =>- withSettings(- Effect.gen(function* () {- const settings = yield* DesktopAppSettings.DesktopAppSettings;- yield* writeSettingsPatch({- wslBackendEnabled: true,- wslDistro: "bad/name",- });- const loaded = yield* settings.load;- assert.equal(loaded.wslBackendEnabled, true);- assert.equal(loaded.wslDistro, null);- }),- ),- );});diff --git a/apps/desktop/src/settings/DesktopClientSettings.test.ts b/apps/desktop/src/settings/DesktopClientSettings.test.tsindex 71a777a6899..51c3d31daae 100644--- a/apps/desktop/src/settings/DesktopClientSettings.test.ts+++ b/apps/desktop/src/settings/DesktopClientSettings.test.ts@@ -110,15 +110,6 @@ const withClientSettings = <A, E, R>(}).pipe(Effect.provide(NodeServices.layer), Effect.scoped);describe("DesktopClientSettings", () => {- it.effect("returns none when no client settings file exists", () =>- withClientSettings(- Effect.gen(function* () {- const settings = yield* DesktopClientSettings.DesktopClientSettings;- assert.isTrue(Option.isNone(yield* settings.get));- }),- ),- );-it.effect("saves through a symlinked client settings file without replacing the link", () =>withClientSettings(Effect.gen(function* () {@@ -249,7 +240,6 @@ describe("DesktopClientSettings", () => {it.effect.each([{ label: "malformed JSON", contents: "{not-json" },- { label: "invalid direct settings", contents: '{"fontSizeCode":"large"}' },{ label: "invalid legacy settings", contents: '{"settings":{"fontSizeCode":"large"}}' },])("reports $label without treating the settings file as absent", (document) =>withClientSettings(diff --git a/apps/desktop/src/settings/DesktopSavedEnvironments.test.ts b/apps/desktop/src/settings/DesktopSavedEnvironments.test.tsindex de92bce9fac..0001548f453 100644--- a/apps/desktop/src/settings/DesktopSavedEnvironments.test.ts+++ b/apps/desktop/src/settings/DesktopSavedEnvironments.test.ts@@ -4,10 +4,8 @@ import { EnvironmentId, type PersistedSavedEnvironmentRecord } from "@t3tools/coimport * as Effect from "effect/Effect";import * as Base64 from "effect/encoding/Base64";import * as FileSystem from "effect/FileSystem";-import * as Path from "effect/Path";import * as Layer from "effect/Layer";import * as Option from "effect/Option";-import * as PlatformError from "effect/PlatformError";import * as Schema from "effect/Schema";import * as DesktopConfig from "../app/DesktopConfig.ts";@@ -205,30 +203,6 @@ describe("DesktopSavedEnvironments", () => {),);- it.effect("reports invalid saved secret encoding without exposing the secret", () =>- withSavedEnvironments(- Effect.gen(function* () {- const environment = yield* DesktopEnvironment.DesktopEnvironment;- const savedEnvironments = yield* DesktopSavedEnvironments.DesktopSavedEnvironments;- yield* seedSavedEnvironmentRegistry("%%%");-- const error = yield* savedEnvironments- .getSecret(savedRegistryRecord.environmentId)- .pipe(Effect.flip);- assert.instanceOf(error, DesktopSavedEnvironments.DesktopSavedEnvironmentSecretDecodeError);- assert.equal(error.environmentId, savedRegistryRecord.environmentId);- assert.equal(error.registryPath, environment.savedEnvironmentRegistryPath);- assert.equal(error.field, "encryptedBearerToken");- assert.exists(error.cause);- assert.equal(- error.message,- `Failed to decode encryptedBearerToken for environment ${savedRegistryRecord.environmentId} at ${environment.savedEnvironmentRegistryPath}.`,- );- assert.notInclude(error.message, "%%%");- }),- ),- );-it.effect("returns no secret while encryption is unavailable", () =>withSavedEnvironments(Effect.gen(function* () {@@ -243,64 +217,4 @@ describe("DesktopSavedEnvironments", () => {{ availableSecretStorage: false },),);-- it.effect("surfaces malformed saved environment documents", () =>- withSavedEnvironments(- Effect.gen(function* () {- const environment = yield* DesktopEnvironment.DesktopEnvironment;- const fileSystem = yield* FileSystem.FileSystem;- const savedEnvironments = yield* DesktopSavedEnvironments.DesktopSavedEnvironments;- yield* fileSystem.makeDirectory(environment.stateDir, { recursive: true });- yield* fileSystem.writeFileString(environment.savedEnvironmentRegistryPath, "{not-json");-- const registryError = yield* savedEnvironments.getRegistry.pipe(Effect.flip);- assert.instanceOf(- registryError,- DesktopSavedEnvironments.DesktopSavedEnvironmentsDocumentDecodeError,- );- assert.equal(registryError.registryPath, environment.savedEnvironmentRegistryPath);- assert.exists(registryError.cause);- const secretError = yield* savedEnvironments- .getSecret(savedRegistryRecord.environmentId)- .pipe(Effect.flip);- assert.instanceOf(- secretError,- DesktopSavedEnvironments.DesktopSavedEnvironmentsDocumentDecodeError,- );- }),- ),- );-- it.effect("reports saved environment filesystem reads separately from document decoding", () =>- Effect.gen(function* () {- const path = yield* Path.Path;- const baseFileSystem = yield* FileSystem.FileSystem;- const baseDir = yield* baseFileSystem.makeTempDirectoryScoped({- prefix: "t3-desktop-saved-environments-test-",- });- const registryPath = path.join(baseDir, "userdata", "saved-environments.json");- const permissionError = PlatformError.systemError({- _tag: "PermissionDenied",- module: "FileSystem",- method: "readFileString",- pathOrDescriptor: registryPath,- });- const layerFileSystem = Layer.succeed(- FileSystem.FileSystem,- FileSystem.makeNoop({- readFileString: () => Effect.fail(permissionError),- }),- );- const savedEnvironments = yield* DesktopSavedEnvironments.DesktopSavedEnvironments.pipe(- Effect.provide(layer(baseDir, undefined, layerFileSystem)),- );-- const error = yield* savedEnvironments.getRegistry.pipe(Effect.flip);- assert.instanceOf(error, DesktopSavedEnvironments.DesktopSavedEnvironmentsReadError);- assert.equal(error.registryPath, registryPath);- assert.strictEqual(error.cause, permissionError);- assert.equal(error.message, `Failed to read desktop saved environments at ${registryPath}.`);- assert.notEqual(error.message, permissionError.message);- }).pipe(Effect.provide(NodeServices.layer), Effect.scoped),- );});diff --git a/apps/desktop/src/shell/DesktopShellEnvironment.test.ts b/apps/desktop/src/shell/DesktopShellEnvironment.test.tsindex 94e6468f688..9d12ed5a07f 100644--- a/apps/desktop/src/shell/DesktopShellEnvironment.test.ts+++ b/apps/desktop/src/shell/DesktopShellEnvironment.test.ts@@ -141,29 +141,6 @@ describe("DesktopShellEnvironment", () => {}),);- it.effect("tries the account shell before the platform fallback when SHELL has no PATH", () =>- Effect.gen(function* () {- const env: NodeJS.ProcessEnv = { SHELL: "/bin/missing", PATH: "/usr/bin" };- const commands: string[] = [];-- yield* runShellEnvironment({- env,- platform: "linux",- userShell: "/usr/local/bin/fish",- handler: (command) => {- if (command._tag !== "StandardCommand") return "";- commands.push(command.command);- return command.command === "/usr/local/bin/fish"- ? envOutput({ PATH: "/home/test/.local/bin:/usr/bin" })- : "";- },- });-- assert.deepEqual(commands, ["/bin/missing", "/usr/local/bin/fish"]);- assert.equal(env.PATH, "/home/test/.local/bin:/usr/bin");- }),- );-it.effect("hydrates PATH and missing SSH_AUTH_SOCK from the login shell on macOS", () =>Effect.gen(function* () {const env: NodeJS.ProcessEnv = {@@ -193,29 +170,6 @@ describe("DesktopShellEnvironment", () => {}),);- it.effect("preserves inherited POSIX values when present", () =>- Effect.gen(function* () {- const env: NodeJS.ProcessEnv = {- SHELL: "/bin/zsh",- PATH: "/usr/bin",- SSH_AUTH_SOCK: "/tmp/inherited.sock",- };-- yield* runShellEnvironment({- env,- platform: "darwin",- handler: () =>- envOutput({- PATH: "/opt/homebrew/bin:/usr/bin",- SSH_AUTH_SOCK: "/tmp/login-shell.sock",- }),- });-- assert.equal(env.PATH, "/opt/homebrew/bin:/usr/bin");- assert.equal(env.SSH_AUTH_SOCK, "/tmp/inherited.sock");- }),- );-it.effect("does not mix login-shell locale categories into an inherited locale", () =>Effect.gen(function* () {const env: NodeJS.ProcessEnv = {diff --git a/apps/desktop/src/snapShot/CaptureShortcutConfig.test.ts b/apps/desktop/src/snapShot/CaptureShortcutConfig.test.tsindex 2820dc51485..e2a3b913e64 100644--- a/apps/desktop/src/snapShot/CaptureShortcutConfig.test.ts+++ b/apps/desktop/src/snapShot/CaptureShortcutConfig.test.ts@@ -48,12 +48,6 @@ it("reads without writing, then applies only the approved diff with a backup", aexpect(tools.validateNiri).toHaveBeenCalledOnce();await expect(setup.apply(preview.id, "niri")).rejects.toThrow("expired");});-it("refuses apply without a preview or for the wrong desktop", async () => {- await expect(setup.apply("invented", "niri")).rejects.toThrow("expired");- const preview = await setup.preview(target(), install);- await expect(setup.apply(preview.id, "hyprland")).rejects.toThrow("expired");- expect(await NodeFSP.readFile(path, "utf8")).toBe(preview.before);-});it("rechecks Hyprland conflicts before writing", async () => {const hypr = {...target(),@@ -78,11 +72,6 @@ it("notices an optional include created while the diff is open", async () => {await expect(setup.apply(preview.id, "niri")).rejects.toThrow("changed since");expect(await NodeFSP.readFile(path, "utf8")).toBe(preview.before);});-it("invalidates an earlier proposal when another config is opened", async () => {- const first = await setup.preview(target(), install);- await setup.preview(target(), { ...install, shortcut: "Ctrl+Alt+Y" });- await expect(setup.apply(first.id, "niri")).rejects.toThrow("expired");-});it("does not overwrite edits made after preview", async () => {const preview = await setup.preview(target(), install);await NodeFSP.appendFile(path, "// edited elsewhere\n");@@ -241,27 +230,6 @@ it("detects conflicts in included Niri configs without changing either file", asawait expect(setup.preview(target(), install)).rejects.toThrow("already used");expect((await NodeFSP.readdir(directory)).sort()).toEqual(["config.kdl", "keys.kdl"]);});-it("detects included config changes before applying", async () => {- await NodeFSP.appendFile(path, 'include "keys.kdl"\n');- const included = NodePath.join(directory, "keys.kdl");- await NodeFSP.writeFile(included, "binds { Ctrl+Alt+Q { quit; } }");- const preview = await setup.preview(target(), install);- await NodeFSP.writeFile(included, "binds { Ctrl+Shift+2 { quit; } }");- await expect(setup.apply(preview.id, "niri")).rejects.toThrow("changed since");-});-it("reports reload failure separately from a successfully saved config", async () => {- const hypr = {- ...target(),- desktop: "hyprland" as const,- path: NodePath.join(directory, "hyprland.conf"),- };- await NodeFSP.writeFile(hypr.path, "# preferences\n");- const preview = await setup.preview(hypr, install);- tools.reloadHyprland.mockRejectedValue(new Error("Compositor stopped"));- const result = await setup.apply(preview.id, "hyprland");- expect(result.warning).toContain("Config saved");- expect(await NodeFSP.readFile(hypr.path, "utf8")).toBe(preview.after);-});it("does not edit Omarchy's shipped defaults", async () => {const defaults = NodePath.join(directory, "omarchy", "default", "hypr");await NodeFSP.mkdir(defaults, { recursive: true });diff --git a/apps/desktop/src/snapShot/DesktopSnapShot.test.ts b/apps/desktop/src/snapShot/DesktopSnapShot.test.tsindex 99e9acb9de7..39a7dddf5de 100644--- a/apps/desktop/src/snapShot/DesktopSnapShot.test.ts+++ b/apps/desktop/src/snapShot/DesktopSnapShot.test.ts@@ -754,52 +754,6 @@ function concurrentCaptureFixture(platform: NodeJS.Platform, animations: boolean};}-it.effect("reads and acknowledges queued captures through Effect services", () => {- const captureId = "12345678-1234-1234-1234-123456789abc";- const captureDirectory = "/state/snap-shots";- const metadataPath = captureDirectory + "/" + captureId + ".json";- const imagePath = captureDirectory + "/" + captureId + ".png";- const removed: Array<string> = [];- const metadata = JSON.stringify({- id: captureId,- name: "window.png",- mimeType: "image/png",- sizeBytes: 3,- source: {- kind: "snap-shot",- capturedAt: "2026-08-24T11:00:00.000Z",- appName: "Editor",- windowTitle: "main.ts",- },- });- const layer = layerTest("linux", {- readDirectory: () => Effect.succeed([captureId + ".json", "invalid.json"]),- readFileString: (filePath) => Effect.succeed(filePath === metadataPath ? metadata : "invalid"),- readFile: () => Effect.succeed(new Uint8Array([1, 2, 3])),- remove: (filePath) =>- Effect.sync(() => {- removed.push(filePath);- }),- });-- return Effect.scoped(- Effect.gen(function* () {- const service = yield* DesktopSnapShot.make;- const pending = yield* service.listPending;- assert.deepEqual(- pending.map((capture) => capture.id),- [captureId],- );-- const capture = yield* service.read(captureId);- assert.strictEqual(capture.dataUrl, "data:image/png;base64,AQID");-- yield* service.acknowledge(captureId);- assert.deepEqual(removed.sort(), [imagePath, metadataPath].sort());- }),- ).pipe(Effect.provide(layer));-});-it.effect.each(["darwin", "win32"] as const)("drops shortcut bursts during flight and accepts a fresh capture after landing on %s",(platform) => {@@ -1030,41 +984,6 @@ it.effect.each(["succeeds", "fails"] as const)(},);-it.effect("keeps newer native feedback when older accessibility persistence fails", () => {- const fixture = concurrentCaptureFixture("linux", true);- fixture.state.failFirstPersistence = true;- return Effect.scoped(- Effect.gen(function* () {- const service = yield* DesktopSnapShot.make;- yield* service.configure(fixture.settings);- fixture.first.pixels.resolve();- const first = yield* Effect.promise(fixture.trigger).pipe(- Effect.forkChild({ startImmediately: true }),- );- yield* Effect.promise(() => fixture.first.handoff.promise);- yield* TestClock.adjust("200 millis");- fixture.second.pixels.resolve();- const second = yield* Effect.promise(fixture.trigger).pipe(- Effect.forkChild({ startImmediately: true }),- );- yield* Effect.promise(() => fixture.second.handoff.promise);- fixture.first.context.resolve({ accessibleText: "Discord accessibility" });- yield* Fiber.join(first);-- assert.lengthOf(fixture.readyIds, 0);- assert.lengthOf(fixture.second.feedback.close.mock.calls, 0);- assert.lengthOf(fixture.second.feedback.complete.mock.calls, 0);- fixture.second.context.resolve({ accessibleText: "Explorer accessibility" });- yield* Fiber.join(second);- assert.lengthOf(fixture.readyIds, 1);- const newer = yield* service.read(fixture.readyIds[0]!);- assert.equal(newer.source.windowTitle, fixture.second.title);- yield* service.acknowledge(fixture.readyIds[0]!);- assert.lengthOf(fixture.second.feedback.complete.mock.calls, 1);- }).pipe(Effect.ensuring(Effect.sync(fixture.releaseAll))),- ).pipe(Effect.provide(fixture.layer), Effect.ensuring(Effect.sync(fixture.reset)));-});-it.effect("matches Windows accessibility windows on a scaled display", () => {const png = Buffer.from([1, 2, 3]);const active = {@@ -1227,75 +1146,6 @@ it.effect.each(["gnome", "niri", "kde", "hyprland"] as const)(},);-it.effect("persists a window capture from a portal activation without a setup test", () => {- vi.stubEnv("XDG_SESSION_TYPE", "wayland");- linuxCaptureMock.mockClear().mockResolvedValueOnce({- png: Buffer.from([1, 2, 3]),- window: {- title: "Shortcut capture",- appName: "Text Editor",- appIdentifier: "org.kde.kwrite",- processId: 123,- bounds: { x: 0, y: 0, width: 700, height: 520 },- },- });- let metadata = "";- const writes: Uint8Array[] = [];- return Effect.scoped(- Effect.gen(function* () {- const service = yield* DesktopSnapShot.make;- yield* service.configure({- ...DEFAULT_CLIENT_SETTINGS,- snapShotEnabled: true,- snapShotIncludeAccessibility: false,- snapShotShortcut: {- key: "2",- ctrlKey: true,- shiftKey: true,- altKey: false,- metaKey: false,- modKey: false,- },- });- yield* Effect.promise(portalShortcutInstances[0]!.onCapture);- assert.lengthOf(linuxCaptureMock.mock.calls, 1);- assert.deepEqual(writes, [Buffer.from([1, 2, 3])]);- const saved = yield* decodePendingMetadata(metadata);- assert.equal(saved.source.windowTitle, "Shortcut capture");- assert.equal(saved.source.appIdentifier, "org.kde.kwrite");- const state = yield* service.state;- assert.isTrue(state.shortcutVerified);- assert.isNull(state.message);- const portal = portalShortcutInstances[0]!;- portal.state = {- shortcutRegistered: false,- shortcutPending: false,- shortcutMessage: "Permission revoked",- };- portal.onStateChanged();- const revoked = yield* service.state;- assert.isFalse(revoked.shortcutVerified);- assert.isFalse(revoked.shortcutRegistered);- }),- ).pipe(- Effect.provide(- layerTest("linux", {- makeDirectory: () => Effect.void,- rename: () => Effect.void,- writeFile: (_, bytes) =>- Effect.sync(() => {- writes.push(bytes);- }),- writeFileString: (_, text) =>- Effect.sync(() => {- metadata = text;- }),- }),- ),- Effect.ensuring(Effect.sync(() => vi.unstubAllEnvs())),- );-});-it("covers straddling captures and intervening monitors without spanning unrelated displays", () => {const displays = [{ bounds: { x: -1_920, y: 0, width: 1_920, height: 1_080 } },@@ -1605,8 +1455,6 @@ it.each(["darwin", "win32"] as const)(it.each([["darwin", "", "value", 650],- ["win32", "", "value", 650],- ["linux", "x11", "value", 650],["linux", "wayland", "value", 650],["darwin", "", "name", 100],] as const)(@@ -1914,64 +1762,6 @@ it("keeps a truncated element tree when the flat text read fails", async () => {);});-it.effect("keeps snapshots disabled when client settings cannot be read at startup", () => {- const readError = new DesktopClientSettings.DesktopClientSettingsReadError({- operation: "read-file",- path: "/state/client-settings.json",- cause: new Error("unavailable"),- });-- return Effect.scoped(- Effect.gen(function* () {- const service = yield* DesktopSnapShot.make;- yield* service.initialize;- assert.isFalse((yield* service.state).shortcutRegistered);- }),- ).pipe(Effect.provide(layerTest("win32", {}, Option.none(), Effect.fail(readError))));-});--it.effect("requests macOS permissions only for an explicit enable action", () => {- accessibilityTrustedMock.mockReset().mockReturnValue(false);- mediaAccessStatusMock.mockReset().mockReturnValue("not-determined");- getSourcesMock.mockReset().mockResolvedValue([]);- openExternalMock.mockClear();-- return Effect.scoped(- Effect.gen(function* () {- const service = yield* DesktopSnapShot.make;- yield* service.requestPermissions(true);-- assert.deepEqual(accessibilityTrustedMock.mock.calls, [[true]]);- assert.lengthOf(getSourcesMock.mock.calls, 1);- assert.lengthOf(openExternalMock.mock.calls, 1);- }),- ).pipe(Effect.provide(layerTest("darwin")));-});--it.effect("reports macOS permission status and requests each permission on its own", () => {- accessibilityTrustedMock.mockReset().mockReturnValue(false);- mediaAccessStatusMock.mockReset().mockReturnValue("granted");- getSourcesMock.mockReset().mockResolvedValue([]);- openExternalMock.mockClear();-- return Effect.scoped(- Effect.gen(function* () {- const service = yield* DesktopSnapShot.make;- const state = yield* service.state;- assert.deepEqual(state.macPermissions, { screenRecording: true, accessibility: false });-- yield* service.setup("allow-accessibility");- assert.deepEqual(accessibilityTrustedMock.mock.calls.at(-1), [true]);- assert.lengthOf(getSourcesMock.mock.calls, 0);-- mediaAccessStatusMock.mockReturnValue("not-determined");- yield* service.setup("allow-screen-recording");- assert.lengthOf(getSourcesMock.mock.calls, 1);- assert.lengthOf(openExternalMock.mock.calls, 1);- }),- ).pipe(Effect.provide(layerTest("darwin")));-});-it.effect("flags revoked macOS permissions on read and re-registers once they return", () => {accessibilityTrustedMock.mockReset().mockReturnValue(true);mediaAccessStatusMock.mockReset().mockReturnValue("granted");@@ -2012,30 +1802,6 @@ it.effect("flags revoked macOS permissions on read and re-registers once they re).pipe(Effect.provide(layerTest("darwin")));});-it.effect("starts the Shift listener outside the Electron main process", () => {- shortcutForkArgs.length = 0;- shortcutForkOptions.length = 0;- shortcutProcesses.length = 0;- const settings = { ...DEFAULT_CLIENT_SETTINGS, snapShotEnabled: true };-- return Effect.scoped(- Effect.gen(function* () {- const service = yield* DesktopSnapShot.make;- yield* service.configure(settings);- const state = yield* service.state;-- assert.isTrue(state.shortcutRegistered);- assert.lengthOf(shortcutProcesses, 1);- assert.deepEqual(shortcutForkArgs[0], ["shift"]);- assert.strictEqual(shortcutForkOptions[0]?.env?.ELECTRON_RUN_AS_NODE, "1");-- shortcutProcesses[0]?.emit("exit", 1);- yield* Effect.promise(() => new Promise<void>((resolve) => queueMicrotask(resolve)));- assert.isFalse((yield* service.state).shortcutRegistered);- }),- ).pipe(Effect.provide(layerTest("win32")));-});-it.effect("an unrelated client-setting change keeps the registered shortcut", () => {registerShortcutMock.mockReset().mockReturnValue(true);unregisterShortcutMock.mockReset();@@ -2169,63 +1935,6 @@ it.effect(},);-it.effect("exposes pending portal permission and then the real assigned shortcut", () => {- vi.stubEnv("XDG_SESSION_TYPE", "wayland");- registerShortcutMock.mockReset().mockReturnValue(true);- nextPortalState.value = {- shortcutRegistered: false,- shortcutPending: true,- shortcutMessage: "Waiting for permission",- };- const shortcut = {- key: "2",- metaKey: false,- ctrlKey: true,- shiftKey: true,- altKey: false,- modKey: false,- } as const;- const settings = {- ...DEFAULT_CLIENT_SETTINGS,- snapShotEnabled: true,- snapShotShortcut: shortcut,- };-- return Effect.scoped(- Effect.gen(function* () {- const service = yield* DesktopSnapShot.make;- yield* service.configure(settings);-- const state = yield* service.state;- assert.lengthOf(registerShortcutMock.mock.calls, 0);- assert.isFalse(state.shortcutRegistered);- assert.isTrue(state.shortcutPending);- assert.deepEqual(state.shortcut, shortcut);- assert.equal(state.shortcutMessage, "Waiting for permission");-- portalShortcutInstances[0]!.state = {- shortcutRegistered: true,- shortcutPending: false,- shortcutLabel: "Ctrl+Shift+7",- shortcutMessage: null,- };- assert.equal((yield* service.state).shortcutLabel, "Ctrl+Shift+7");- assert.isTrue((yield* service.state).shortcutRegistered);- portalShortcutInstances[0]!.state = {- shortcutRegistered: false,- shortcutPending: false,- shortcutMessage: "Permission denied",- };- const failed = yield* service.state;- assert.isFalse(failed.shortcutRegistered);- assert.equal(failed.shortcutMessage, "Permission denied");- }),- ).pipe(- Effect.provide(layerTest("linux")),- Effect.ensuring(Effect.sync(() => vi.unstubAllEnvs())),- );-});-it.effect("verifies only native shortcut delivery and captures normally", () => {vi.stubEnv("XDG_SESSION_TYPE", "wayland");vi.stubEnv("XDG_CURRENT_DESKTOP", "test-desktop");diff --git a/apps/desktop/src/snapShot/GnomeCaptureSetup.test.ts b/apps/desktop/src/snapShot/GnomeCaptureSetup.test.tsindex 06434c20b20..fd0bfdfd15d 100644--- a/apps/desktop/src/snapShot/GnomeCaptureSetup.test.ts+++ b/apps/desktop/src/snapShot/GnomeCaptureSetup.test.ts@@ -113,13 +113,9 @@ it("refuses to replace symlinks or downgrade a newer extension", async () => {});it.each([- [{}, "not-installed"],- [{ state: 2, version: 3 }, "disabled"],[{ state: 1, version: 3 }, "enabled"],- [{ state: 1, version: 1 }, "update-required"],[{ state: 1, version: 2, shell: "51.0" }, "update-required"],[{ state: 2, version: 3, enabled: false }, "extensions-disabled"],- [{ state: 3, version: 3, error: "Load failed" }, "error"],[{ shell: "52.0" }, "unsupported"],] as const)("reports GNOME setup state %j", async (options, status) => {const { setup, call } = fixture(options);diff --git a/apps/desktop/src/snapShot/PortalCaptureShortcut.test.ts b/apps/desktop/src/snapShot/PortalCaptureShortcut.test.tsindex 0eccf9ed897..35c007e35dc 100644--- a/apps/desktop/src/snapShot/PortalCaptureShortcut.test.ts+++ b/apps/desktop/src/snapShot/PortalCaptureShortcut.test.ts@@ -158,17 +158,6 @@ it("accepts Hyprland's action-only binding without claiming the keys are reserveexpect(client.state.shortcutActionRegistered).toBe(false);});-it("does not accept an empty trigger as approval on other desktops", async () => {- const bus = new FakeBus();- bus.actualLabel = "";- const { client, capture } = start(bus);- await client.ready;- expect(client.state.shortcutRegistered).toBe(false);- expect(client.state.shortcutActionRegistered).not.toBe(true);- bus.activate();- expect(capture).not.toHaveBeenCalled();-});-it.each([["2", "CTRL+SHIFT+2"],["f12", "CTRL+SHIFT+F12"],diff --git a/apps/desktop/src/snapShot/SnapShotAccessibilityProcess.test.ts b/apps/desktop/src/snapShot/SnapShotAccessibilityProcess.test.tsindex 2a335933778..e4e80c6c4db 100644--- a/apps/desktop/src/snapShot/SnapShotAccessibilityProcess.test.ts+++ b/apps/desktop/src/snapShot/SnapShotAccessibilityProcess.test.ts@@ -1,6 +1,5 @@import { assert, beforeEach, it } from "@effect/vitest";import * as NodeEvents from "node:events";-import * as NodeProcess from "node:process";import { vi } from "vite-plus/test";const forkMock = vi.hoisted(() =>@@ -62,20 +61,6 @@ it("returns immediately when accessibility crashes before the screenshot is readassert.isUndefined(await read.result);});-it("returns accessibility extracted by the helper", async () => {- const process = startSnapShotAccessibilityProcess("accessibility.cjs");- const read = process.read(request);- const context = { accessibleText: "Meeting controls" };- worker.emit("message", "ready");- worker.emit("message", "started");- worker.emit("message", { type: "result", context });-- await read.started;- assert.deepEqual(await read.result, context);- assert.strictEqual(forkMock.mock.calls[0]?.[2]?.env?.ELECTRON_RUN_AS_NODE, "1");- assert.strictEqual(forkMock.mock.calls[0]?.[2]?.execPath, NodeProcess.execPath);-});-it("replaces a warm helper that exits before capture", async () => {const exitedWorker = makeWorker();const captureWorker = makeWorker();diff --git a/apps/desktop/src/snapShot/WindowsCaptureFeedback.test.ts b/apps/desktop/src/snapShot/WindowsCaptureFeedback.test.tsindex d0c9f5977d7..aa56de09089 100644--- a/apps/desktop/src/snapShot/WindowsCaptureFeedback.test.ts+++ b/apps/desktop/src/snapShot/WindowsCaptureFeedback.test.ts@@ -33,19 +33,3 @@ it("disables Chromium window animation only while showing the capture overlay",expect(flagsDuringShow).toEqual([["unrelated-switch", animationSwitch]]);expect([...switches]).toEqual(["unrelated-switch"]);});--it.each([false, true])(- "restores the original switch state when showing throws (preexisting: %s)",- (preexisting) => {- if (preexisting) switches.add(animationSwitch);- const original = [...switches];- const failure = new Error("Overlay was destroyed");- const window = overlay(() => {- expect(switches.has(animationSwitch)).toBe(true);- throw failure;- });-- expect(() => showWindowsCaptureOverlay(window)).toThrow(failure);- expect([...switches]).toEqual(original);- },-);diff --git a/apps/desktop/src/snapShot/captureConfigEdit.test.ts b/apps/desktop/src/snapShot/captureConfigEdit.test.tsindex 6d57d35ee8b..9db407be961 100644--- a/apps/desktop/src/snapShot/captureConfigEdit.test.ts+++ b/apps/desktop/src/snapShot/captureConfigEdit.test.ts@@ -39,14 +39,6 @@ describe("Niri capture config edits", () => {`\uFEFFbinds {\r\n ${binding}\r\n}\r\n`,);});- it("preserves Unicode spacing around nodes and line continuations", () => {- const spaces =- "\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000";- const before = `binds${spaces}\\${spaces}\n{\n}\n`;- expect(editCaptureConfig(before, "niri", app, "install").after).toBe(- before.replace("}\n", ` ${binding}\n}\n`),- );- });it("does not duplicate an existing binding, including a custom chord", () => {const before = `binds {\n ${binding.replace("Ctrl+Shift+2", "Alt+Ctrl+Y")}\n}\n`;const result = editCaptureConfig(before, "niri", app, "install");@@ -68,11 +60,6 @@ describe("Niri capture config edits", () => {expect(niriConfigConflict(before, app, "Ctrl+Shift+2")).toBe(true);expect(() => editCaptureConfig(before, "niri", app, "install")).toThrow("already used");});- it("does not count a slash-dash-disabled key as occupied", () => {- expect(niriConfigConflict("binds { /- Ctrl+Shift+2 { quit; }; }", app, "Ctrl+Shift+2")).toBe(- false,- );- });it.each(["binds {", "binds {}\nbinds {}", "/* unfinished", 'spawn "unfinished'])("fails safely for malformed structure: %s",(source) => {@@ -115,10 +102,6 @@ describe("Hyprland capture config edits", () => {editCaptureConfig("bind = SHIFT CTRL, 2, exec, kitty\n", "hyprland", app, "install"),).toThrow("already used");});- it("leaves commented bindings alone", () => {- const before = "# bind = CTRL SHIFT, 2, global, com.t3tools.T3Code:capture-window\n";- expect(editCaptureConfig(before, "hyprland", app, "remove").after).toBe(before);- });it.each(["return {}",'--[[\nhl.bind("CTRL + SHIFT + 2", hl.dsp.global("com.t3tools.T3Code:capture-window"))\n]]',diff --git a/apps/desktop/src/snapShot/snapShot.test.ts b/apps/desktop/src/snapShot/snapShot.test.tsindex 028233d95da..26ae8fbf9eb 100644--- a/apps/desktop/src/snapShot/snapShot.test.ts+++ b/apps/desktop/src/snapShot/snapShot.test.ts@@ -315,17 +315,6 @@ describe("findAccessibleWindow", () => {expect(findAccessibleWindow(windows, captured)).toBe(windows[1]);});- it("uses the matched source title when macOS omits the active title", () => {- const windows = [{ name: "Editor", bounds: captured.bounds }];- expect(- findAccessibleWindow(windows, {- ...captured,- title: "",- sourceTitle: "Editor",- }),- ).toBe(windows[0]);- });-it("uses the captured source title when the active title changed", () => {const windows = [{ name: "Editor — saved", bounds: captured.bounds }];diff --git a/apps/desktop/src/ssh/DesktopSshEnvironment.test.ts b/apps/desktop/src/ssh/DesktopSshEnvironment.test.tsdeleted file mode 100644index 9d72525f67b..00000000000--- a/apps/desktop/src/ssh/DesktopSshEnvironment.test.ts+++ /dev/null@@ -1,101 +0,0 @@-import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";-import * as NodeServices from "@effect/platform-node/NodeServices";-import { assert, describe, it } from "@effect/vitest";-import * as NetService from "@t3tools/shared/Net";-import * as Effect from "effect/Effect";-import * as FileSystem from "effect/FileSystem";-import * as Layer from "effect/Layer";-import * as Path from "effect/Path";--import * as DesktopSshEnvironment from "./DesktopSshEnvironment.ts";-import * as DesktopSshPasswordPrompts from "./DesktopSshPasswordPrompts.ts";--function makeTempHomeDir() {- return Effect.gen(function* () {- const fs = yield* FileSystem.FileSystem;- return yield* fs.makeTempDirectoryScoped({ prefix: "t3-ssh-env-test-" });- });-}--describe("sshEnvironment", () => {- it.effect("wires desktop host discovery through the ssh package runtime", () =>- Effect.gen(function* () {- const fs = yield* FileSystem.FileSystem;- const path = yield* Path.Path;- const homeDir = yield* makeTempHomeDir();- const sshDir = path.join(homeDir, ".ssh");- yield* fs.makeDirectory(path.join(sshDir, "config.d"), { recursive: true });- yield* fs.writeFileString(- path.join(sshDir, "config"),- ["Include config.d/*.conf", "Host devbox", " HostName devbox.example.com", ""].join("\n"),- );- yield* fs.writeFileString(- path.join(sshDir, "config.d", "team.conf"),- [- "Host staging",- " HostName staging.example.com",- "Host *",- " ServerAliveInterval 30",- "",- ].join("\n"),- );- yield* fs.writeFileString(- path.join(sshDir, "known_hosts"),- [- "known.example.com ssh-ed25519 AAAA",- "|1|hashed|entry ssh-ed25519 AAAA",- "[bastion.example.com]:2222 ssh-ed25519 AAAA",- "",- ].join("\n"),- );-- const sshEnvironment = yield* DesktopSshEnvironment.DesktopSshEnvironment;- const hosts = yield* sshEnvironment.discoverHosts({ homeDir });- assert.deepEqual(hosts, [- {- alias: "bastion.example.com",- hostname: "bastion.example.com",- username: null,- port: null,- source: "known-hosts",- },- {- alias: "devbox",- hostname: "devbox.example.com",- username: null,- port: null,- source: "ssh-config",- },- {- alias: "known.example.com",- hostname: "known.example.com",- username: null,- port: null,- source: "known-hosts",- },- {- alias: "staging",- hostname: "staging.example.com",- username: null,- port: null,- source: "ssh-config",- },- ]);- }).pipe(- Effect.provide(- DesktopSshEnvironment.layer().pipe(- Layer.provideMerge(- Layer.succeed(DesktopSshPasswordPrompts.DesktopSshPasswordPrompts, {- request: () => Effect.die("unexpected password prompt request"),- resolve: () => Effect.die("unexpected password prompt resolution"),- }),- ),- Layer.provideMerge(NodeServices.layer),- Layer.provideMerge(NodeHttpClient.layerUndici),- Layer.provideMerge(NetService.layer),- ),- ),- Effect.scoped,- ),- );-});diff --git a/apps/desktop/src/ssh/DesktopSshPasswordPrompts.test.ts b/apps/desktop/src/ssh/DesktopSshPasswordPrompts.test.tsindex 96a36f6dd14..b86cc275df2 100644--- a/apps/desktop/src/ssh/DesktopSshPasswordPrompts.test.ts+++ b/apps/desktop/src/ssh/DesktopSshPasswordPrompts.test.ts@@ -143,37 +143,6 @@ describe("DesktopSshPasswordPrompts", () => {}).pipe(Effect.provide(layer(testWindow.window)), Effect.scoped);});- it.effect("cleans up a prompt that fails during renderer delivery", () => {- const cause = new Error("renderer unavailable");- const testWindow = makeTestWindow({ sendError: cause });-- return Effect.gen(function* () {- const prompts = yield* DesktopSshPasswordPrompts.DesktopSshPasswordPrompts;- const error = yield* prompts- .request({- destination: "devbox",- username: "julius",- prompt: "Enter the SSH password.",- attempt: 1,- })- .pipe(Effect.flip);-- assert.instanceOf(error, DesktopSshPasswordPrompts.DesktopSshPromptPresentationError);- assert.equal(error.operation, "send-prompt-request");- assert.equal(error.destination, "devbox");- const requestId = error.requestId;- if (requestId === null) {- assert.fail("renderer delivery failures must retain their request id");- }- assert.equal(testWindow.closedListenerCount(), 0);-- const resolveError = yield* prompts- .resolve({ requestId, password: "secret" })- .pipe(Effect.flip);- assert.instanceOf(resolveError, DesktopSshPasswordPrompts.DesktopSshPromptExpiredError);- }).pipe(Effect.provide(layer(testWindow.window)), Effect.scoped);- });-it.effect("keeps a submitted password when a later presentation step fails", () => {const testWindow = makeTestWindow({isMinimizedError: new Error("failed to read minimized state"),diff --git a/apps/desktop/src/telemetry/DesktopTelemetryPublisher.test.ts b/apps/desktop/src/telemetry/DesktopTelemetryPublisher.test.tsindex d274e891e75..f3f0163401a 100644--- a/apps/desktop/src/telemetry/DesktopTelemetryPublisher.test.ts+++ b/apps/desktop/src/telemetry/DesktopTelemetryPublisher.test.ts@@ -1,17 +1,13 @@-import { DesktopHostTelemetryMessage } from "@t3tools/contracts";import * as NodeServices from "@effect/platform-node/NodeServices";import { assert, describe, it } from "@effect/vitest";import * as Deferred from "effect/Deferred";import * as Duration from "effect/Duration";import * as Effect from "effect/Effect";import * as Exit from "effect/Exit";-import * as Fiber from "effect/Fiber";import * as FileSystem from "effect/FileSystem";import * as Layer from "effect/Layer";-import * as Option from "effect/Option";import * as Schema from "effect/Schema";import * as Scope from "effect/Scope";-import * as Stream from "effect/Stream";import * as TestClock from "effect/testing/TestClock";import type * as Electron from "electron";@@ -95,81 +91,6 @@ describe("DesktopTelemetryPublisher", () => {assert.isDefined(closeFiber.pollUnsafe());}),);-- it.effect("routes requestDesktopUpdate control messages and replays update reports", () =>- Effect.gen(function* () {- const layerPower = Layer.succeed(- ElectronPowerMonitor.ElectronPowerMonitor,- ElectronPowerMonitor.ElectronPowerMonitor.of({- isOnBatteryPower: Effect.succeed(false),- getSystemIdleTime: Effect.succeed(0),- getSystemIdleState: () => Effect.succeed("active"),- getCurrentThermalState: Effect.succeed("nominal"),- onSimpleEvent: () => Effect.void,- onThermalStateChange: () => Effect.void,- onSpeedLimitChange: () => Effect.void,- }),- );- const layer = DesktopTelemetryPublisher.layer.pipe(- Layer.provide(Layer.mergeAll(layerElectronApp([]), layerPower, layerHistory)),- );-- yield* Effect.gen(function* () {- const publisher = yield* DesktopTelemetryPublisher.DesktopTelemetryPublisher;-- const requestFiber = yield* Stream.runHead(publisher.updateRequests).pipe(Effect.forkChild);- yield* Effect.yieldNow;- yield* publisher.handleControlForSource("test", {- version: 1,- type: "requestDesktopUpdate",- requestId: "req-9",- });- const received = yield* Fiber.join(requestFiber);- assert.equal(Option.getOrThrow(received).requestId, "req-9");-- const report = {- version: 1,- type: "desktopUpdateStatus",- outcome: "up-to-date",- state: {- enabled: true,- status: "up-to-date",- channel: "latest",- currentVersion: "1.2.3",- hostArch: "arm64",- appArch: "arm64",- runningUnderArm64Translation: false,- availableVersion: null,- downloadedVersion: null,- releaseNotes: [],- downloadPercent: null,- checkedAt: null,- message: null,- errorContext: null,- canRetry: false,- omittedReleaseCount: 0,- },- } as const;- yield* publisher.publishUpdateReport(report);-- const decoder = new TextDecoder();- const decodeMessage = Schema.decodeUnknownEffect(- Schema.fromJsonString(DesktopHostTelemetryMessage),- );- const replayed = yield* publisher.encoded.pipe(- Stream.mapEffect((bytes) => decodeMessage(decoder.decode(bytes).trim())),- Stream.filter((message) => message.type === "desktopUpdateStatus"),- Stream.runHead,- );- const replayedReport = Option.getOrThrow(replayed);- if (replayedReport.type !== "desktopUpdateStatus") {- return assert.fail("Expected a desktop update status report.");- }- assert.equal(replayedReport.outcome, "up-to-date");- assert.equal(replayedReport.state.currentVersion, "1.2.3");- }).pipe(Effect.provide(layer));- }),- );});describe("DesktopRendererHistory", () => {diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.tsindex 1f1dc2bcbbb..d2f24143fc2 100644--- a/apps/desktop/src/updates/DesktopUpdates.test.ts+++ b/apps/desktop/src/updates/DesktopUpdates.test.ts@@ -209,28 +209,6 @@ describe("DesktopUpdates", () => {}),);- it.effect("keeps raw updater event failures out of update state", () => {- const harness = makeHarness();- const cause = new Error(- "request failed for https://user:[email protected]/update?token=secret",- );-- return Effect.scoped(- Effect.gen(function* () {- const updates = yield* DesktopUpdates.DesktopUpdates;- yield* updates.configure;-- harness.emit("error", cause);- yield* flushCallbacks;-- const state = yield* updates.getState;- assert.equal(state.status, "error");- assert.equal(state.message, "Desktop updater background operation reported an error.");- assert.notInclude(state.message ?? "", "secret");- }),- ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));- });-it.effect("preserves a queued installer after a background updater error", () => {const harness = makeHarness();@@ -479,6 +457,7 @@ describe("DesktopUpdates", () => {).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));});+ // regression: #19291 an install that did apply was still flagged as not appliedit.effect("does not flag an install that applied", () => {const harness = makeHarness({installRecord: JSON.stringify({ fromVersion: "1.2.2", targetVersion: "1.2.3" }),@@ -734,40 +713,6 @@ describe("DesktopUpdates", () => {).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));});- it.effect("fails channel changes with a typed error while a check is in progress", () =>- Effect.gen(function* () {- const checkStarted = yield* Deferred.make<void>();- const releaseCheck = yield* Deferred.make<void>();- const harness = makeHarness({- checkForUpdates: Deferred.succeed(checkStarted, undefined).pipe(- Effect.andThen(Deferred.await(releaseCheck)),- ),- });-- yield* Effect.scoped(- Effect.gen(function* () {- const updates = yield* DesktopUpdates.DesktopUpdates;- yield* updates.configure;-- const checkFiber = yield* updates.check("manual").pipe(Effect.forkScoped);- yield* Deferred.await(checkStarted);-- const exit = yield* Effect.exit(updates.setChannel("nightly"));- assert.equal(exit._tag, "Failure");- if (exit._tag === "Failure") {- const error = Cause.squash(exit.cause);- assert.instanceOf(error, DesktopUpdates.DesktopUpdateActionInProgressError);- assert.equal(error.action, "check");- assert.equal(error.requestedChannel, "nightly");- }-- yield* Deferred.succeed(releaseCheck, undefined);- yield* Fiber.join(checkFiber);- }),- ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));- }),- );-it.effect("rejects checks while an update channel change is being persisted", () =>Effect.gen(function* () {const channelChangeStarted = yield* Deferred.make<void>();@@ -799,36 +744,6 @@ describe("DesktopUpdates", () => {).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));}),);-- it.effect("preserves settings failure context when an update channel cannot be persisted", () => {- const diskFailure = new Error("disk exploded");- const settingsFailure = new DesktopAppSettings.DesktopSettingsWriteError({- operation: "replace-settings-file",- path: "/tmp/settings.json",- cause: diskFailure,- });- const harness = makeHarness({ setUpdateChannelError: settingsFailure });-- return Effect.scoped(- Effect.gen(function* () {- const updates = yield* DesktopUpdates.DesktopUpdates;- yield* updates.configure;-- const error = yield* updates.setChannel("nightly").pipe(Effect.flip);-- assert.instanceOf(error, DesktopUpdates.DesktopUpdateChannelPersistenceError);- assert.equal(error.channel, "nightly");- assert.strictEqual(error.cause, settingsFailure);- assert.strictEqual(error.cause.cause, diskFailure);- assert.equal(error.message, "Failed to persist the nightly desktop update channel.");- assert.notInclude(error.message, diskFailure.message);-- const checkResult = yield* updates.check("manual");- assert.isTrue(checkResult.checked);- assert.equal(harness.checkCount(), 1);- }),- ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));- });});describe("describeUpdateErrorCause", () => {diff --git a/apps/desktop/src/updates/releaseNotes.test.ts b/apps/desktop/src/updates/releaseNotes.test.tsindex ddaa3cb3eee..008a83eab03 100644--- a/apps/desktop/src/updates/releaseNotes.test.ts+++ b/apps/desktop/src/updates/releaseNotes.test.ts@@ -103,6 +103,7 @@ describe("normalizeDesktopUpdateReleaseNotes", () => {expect(result.omittedReleaseCount).toBe(0);});+ // regression: #11753 prerelease entries leaked into a channel's update changelogit("keeps only stable releases on the latest channel", () => {const result = normalizeDesktopUpdateReleaseNotes([diff --git a/apps/desktop/src/updates/remoteUpdateFlow.test.ts b/apps/desktop/src/updates/remoteUpdateFlow.test.tsindex 9eaff608e92..5247931221f 100644--- a/apps/desktop/src/updates/remoteUpdateFlow.test.ts+++ b/apps/desktop/src/updates/remoteUpdateFlow.test.ts@@ -2,7 +2,6 @@ import { assert, describe, it } from "@effect/vitest";import type { DesktopUpdateState } from "@t3tools/contracts";import {- MAX_REMOTE_UPDATE_CHECKS,MAX_REMOTE_UPDATE_DOWNLOADS,nextRemoteDesktopUpdateStep,type RemoteDesktopUpdateAttempts,@@ -116,23 +115,6 @@ describe("nextRemoteDesktopUpdateStep", () => {});});- it("rides along while a check or download is already in flight", () => {- assert.deepEqual(- nextRemoteDesktopUpdateStep(makeState({ status: "checking" }), NO_ATTEMPTS, null),- {- action: "wait",- },- );- assert.deepEqual(- nextRemoteDesktopUpdateStep(- makeState({ status: "downloading", availableVersion: "1.2.4", downloadPercent: 40 }),- NO_ATTEMPTS,- null,- ),- { action: "wait" },- );- });-it("downloads an available update until the attempt cap, then fails", () => {const available = makeState({ status: "available", availableVersion: "1.2.4" });assert.deepEqual(nextRemoteDesktopUpdateStep(available, NO_ATTEMPTS, null), {@@ -199,22 +181,4 @@ describe("nextRemoteDesktopUpdateStep", () => {reason: "The desktop app update failed.",});});-- it("checks from idle until the attempt cap, then fails", () => {- assert.deepEqual(nextRemoteDesktopUpdateStep(makeState(), NO_ATTEMPTS, null), {- action: "check",- });- assert.deepEqual(- nextRemoteDesktopUpdateStep(- makeState(),- { checks: MAX_REMOTE_UPDATE_CHECKS, downloads: 0 },- null,- ),- {- action: "done",- outcome: "failed",- reason: "The desktop app did not report an update result.",- },- );- });});diff --git a/apps/desktop/src/updates/remoteUpdateFlow.ts b/apps/desktop/src/updates/remoteUpdateFlow.tsindex 91fb45fee3a..f7c65b35820 100644--- a/apps/desktop/src/updates/remoteUpdateFlow.ts+++ b/apps/desktop/src/updates/remoteUpdateFlow.ts@@ -22,7 +22,7 @@ export interface RemoteDesktopUpdateAttempts {readonly downloads: number;}-export const MAX_REMOTE_UPDATE_CHECKS = 2;+const MAX_REMOTE_UPDATE_CHECKS = 2;export const MAX_REMOTE_UPDATE_DOWNLOADS = 3;function isInstallableDesktopUpdateState(state: DesktopUpdateState): boolean {diff --git a/apps/desktop/src/window/DesktopWindow.test.ts b/apps/desktop/src/window/DesktopWindow.test.tsindex 6fa8e0fb79c..dbdde033cae 100644--- a/apps/desktop/src/window/DesktopWindow.test.ts+++ b/apps/desktop/src/window/DesktopWindow.test.ts@@ -45,7 +45,7 @@ import * as ElectronMenu from "../electron/ElectronMenu.ts";import * as ElectronShell from "../electron/ElectronShell.ts";import * as ElectronTheme from "../electron/ElectronTheme.ts";import * as ElectronWindow from "../electron/ElectronWindow.ts";-import { MENU_ACTION_CHANNEL, SNAP_SHOT_EVENT_CHANNEL } from "../ipc/channels.ts";+import { SNAP_SHOT_EVENT_CHANNEL } from "../ipc/channels.ts";import * as DesktopServerExposure from "../backend/DesktopServerExposure.ts";import * as DesktopWindow from "./DesktopWindow.ts";import * as PreviewManager from "../preview/Manager.ts";@@ -472,27 +472,6 @@ describe("DesktopWindow", () => {);});- it("recognizes only same-origin renderer navigations", () => {- assert.isTrue(- DesktopWindow.isSameOriginRendererNavigation({- applicationUrl: "t3code://app/",- navigationUrl: "t3code://app/settings/connections",- }),- );- assert.isFalse(- DesktopWindow.isSameOriginRendererNavigation({- applicationUrl: "t3code://app/",- navigationUrl: "https://accounts.microsoft.com/oauth",- }),- );- assert.isFalse(- DesktopWindow.isSameOriginRendererNavigation({- applicationUrl: "t3code://app/",- navigationUrl: "not a url",- }),- );- });-it.effect("opens and reopens the window without backend readiness when local execution is disabled",() =>@@ -1043,29 +1022,6 @@ describe("DesktopWindow", () => {}),);- it.effect("dispatches menu actions after backend readiness when no main window exists", () =>- Effect.gen(function* () {- const splash = makeFakeBrowserWindow();- const main = makeFakeBrowserWindow();- const scenario = yield* makeSplashScenario([splash.window, null, main.window]);-- yield* Effect.gen(function* () {- const desktopWindow = yield* DesktopWindow.DesktopWindow;-- yield* desktopWindow.showConnectingSplash;- const readyExit = yield* Effect.exit(- desktopWindow.handleBackendReady(new URL("http://127.0.0.1:3773")),- );- assert.equal(readyExit._tag, "Failure");-- yield* desktopWindow.dispatchMenuAction("open-settings");-- assert.equal(yield* Ref.get(scenario.createCalls), 3);- assert.deepEqual(main.send.mock.calls, [[MENU_ACTION_CHANNEL, "open-settings"]]);- }).pipe(Effect.provide(scenario.layer));- }),- );-it.effect("delivers capture completion and late errors without taking focus back", () =>Effect.gen(function* () {const operations: Array<string> = [];@@ -1106,34 +1062,6 @@ describe("DesktopWindow", () => {}),);- it.effect("delivers the renderer event even when the reveal fails", () =>- Effect.gen(function* () {- const fakeWindow = makeFakeBrowserWindow();- const createCount = yield* Ref.make(0);- const mainWindow = yield* Ref.make<Option.Option<Electron.BrowserWindow>>(Option.none());- const layer = layerTest({- window: fakeWindow.window,- createCount,- mainWindow,- onReveal: () => {- throw new Error("another process kept the foreground");- },- });-- yield* Effect.gen(function* () {- const desktopWindow = yield* DesktopWindow.DesktopWindow;- yield* desktopWindow.handleBackendReady(new URL("http://127.0.0.1:3773"));- yield* Effect.exit(- desktopWindow.dispatchSnapShotEvent({ type: "started", id: captureOne }),- );-- assert.deepEqual(fakeWindow.send.mock.calls, [- [SNAP_SHOT_EVENT_CHANNEL, { type: "started", id: captureOne }],- ]);- }).pipe(Effect.provide(layer));- }),- );-it.effect("does not reopen a closed main window for a completed capture", () =>Effect.gen(function* () {const fakeWindow = makeFakeBrowserWindow();diff --git a/apps/desktop/src/window/DesktopWindow.ts b/apps/desktop/src/window/DesktopWindow.tsindex 8fd26ef94a0..297c67ddace 100644--- a/apps/desktop/src/window/DesktopWindow.ts+++ b/apps/desktop/src/window/DesktopWindow.ts@@ -185,7 +185,7 @@ function buildConnectingSplashDataUrl(shouldUseDarkColors: boolean): string {return `data:text/html;charset=utf-8,${encodeURIComponent(html)}`;}-export function isSameOriginRendererNavigation(input: {+function isSameOriginRendererNavigation(input: {readonly applicationUrl: string;readonly navigationUrl: string;}): boolean {diff --git a/apps/desktop/src/wsl/wslPathParsing.test.ts b/apps/desktop/src/wsl/wslPathParsing.test.tsindex d4be446325a..0a814229665 100644--- a/apps/desktop/src/wsl/wslPathParsing.test.ts+++ b/apps/desktop/src/wsl/wslPathParsing.test.ts@@ -47,16 +47,6 @@ describe("parseWslDistroList", () => {]);});- it("handles output without BOM", () => {- const text = [- " NAME STATE VERSION",- "* Ubuntu Running 2",- ].join("\r\n");- const output = Buffer.from(text, "utf16le");- const distros = parseWslDistroList(output);- expect(distros).toEqual([{ name: "Ubuntu", isDefault: true, version: 2 }]);- });-it("handles UTF-8 output", () => {const text = [" NAME STATE VERSION",@@ -73,10 +63,6 @@ describe("extractDistroFromUncPath", () => {"Ubuntu-22.04",);});-- it("extracts the distro from the legacy \\\\wsl$ UNC paths", () => {- expect(extractDistroFromUncPath("\\\\wsl$\\Debian\\home\\josh")).toBe("Debian");- });});describe("wslUncPathToLinuxPath", () => {