Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/desktop/src/app/DesktopAppIdentity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const makeAssetsLayer = (png: Option.Option<string>) =>
icns: Option.none(),
png,
}),
resolveResourcePath: () => Effect.succeed(Option.none()),
resolveResourcePath: () => Effect.succeedNone,
} satisfies DesktopAssets.DesktopAssets["Service"]);

const makeEnvironmentLayer = (overrides: TestEnvironmentInput = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/app/DesktopConnectionCatalogStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function makeSafeStorageLayer(available: boolean, failDecrypt: Ref.Ref<boolean>
return decoded.slice("encrypted:".length);
});
},
selectedStorageBackend: Effect.succeed(Option.none()),
selectedStorageBackend: Effect.succeedNone,
} satisfies ElectronSafeStorage.ElectronSafeStorage["Service"]);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/app/DesktopConnectionCatalogStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const readDocument = (
raw === null
? Effect.succeed(Option.none<EncryptedConnectionCatalogDocument>())
: decodeEncryptedConnectionCatalogDocumentJson(raw).pipe(
Effect.map(Option.some),
Effect.asSome,
Effect.mapError(
(cause) =>
new DesktopConnectionCatalogStoreDocumentDecodeError({
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const makeHandlerLayer = (
icns: Option.none(),
png: input.bundledIcon ? Option.some(BUNDLED_ICON_PATH) : Option.none(),
}),
resolveResourcePath: () => Effect.succeed(Option.none()),
resolveResourcePath: () => Effect.succeedNone,
}),
),
FileSystem.layerNoop({
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src/backend/DesktopBackendConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ const readPersistedBackendObservabilitySettings = Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const environment = yield* DesktopEnvironment.DesktopEnvironment;
const raw = yield* fileSystem.readFileString(environment.serverSettingsPath).pipe(
Effect.map(Option.some),
Effect.asSome,
Effect.catchTags({
PlatformError: (cause) =>
cause.reason._tag === "NotFound"
? Effect.succeed(Option.none())
? Effect.succeedNone
: logBackendObservabilitySettingsReadFailure(environment.serverSettingsPath, cause).pipe(
Effect.as(Option.none()),
),
Expand Down
6 changes: 3 additions & 3 deletions apps/desktop/src/backend/DesktopBackendManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function makeTestInstance(input: MakeInstanceInput) {
forInstance: () => Effect.succeed(stubLog),
} satisfies DesktopObservability.DesktopBackendOutputLogFactory["Service"]),
Layer.succeed(DesktopTelemetryPublisher.DesktopTelemetryPublisher, {
latest: Effect.succeed(Option.none()),
latest: Effect.succeedNone,
changes: Stream.empty,
encoded: input.desktopTelemetryStream ?? Stream.empty,
handleControl: () => Effect.void,
Expand Down Expand Up @@ -1547,7 +1547,7 @@ describe("DesktopBackendManager", () => {

const mockPool = Layer.succeed(DesktopBackendPool.DesktopBackendPool, {
list: Effect.succeed([instance1, instance2]),
get: () => Effect.succeed(Option.none()),
get: () => Effect.succeedNone,
primary: Effect.die(new Error("primary not implemented")),
register: () => Effect.die(new Error("register not implemented")),
unregister: () => Effect.die(new Error("unregister not implemented")),
Expand Down Expand Up @@ -1623,7 +1623,7 @@ describe("DesktopBackendManager", () => {

const mockPool = Layer.succeed(DesktopBackendPool.DesktopBackendPool, {
list: Effect.succeed([instance1, instance2]),
get: () => Effect.succeed(Option.none()),
get: () => Effect.succeedNone,
primary: Effect.die(new Error("primary not implemented")),
register: () => Effect.die(new Error("register not implemented")),
unregister: () => Effect.die(new Error("unregister not implemented")),
Expand Down
9 changes: 5 additions & 4 deletions apps/desktop/src/backend/DesktopBackendPool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function makePoolLayer(
} satisfies DesktopObservability.DesktopBackendOutputLogShape),
} satisfies DesktopObservability.DesktopBackendOutputLogFactory["Service"]),
Layer.succeed(DesktopTelemetryPublisher.DesktopTelemetryPublisher, {
latest: Effect.succeed(Option.none()),
latest: Effect.succeedNone,
changes: Stream.empty,
encoded: Stream.empty,
handleControl: () => Effect.void,
Expand Down Expand Up @@ -137,9 +137,10 @@ describe("DesktopBackendPool", () => {

it.effect("layerTest dies when no instances are supplied", () =>
Effect.exit(
Effect.gen(function* () {
yield* DesktopBackendPool.DesktopBackendPool;
}).pipe(Effect.provide(DesktopBackendPool.layerTest([]))),
DesktopBackendPool.DesktopBackendPool.pipe(
Effect.asVoid,
Effect.provide(DesktopBackendPool.layerTest([])),
),
).pipe(Effect.map((exit) => assert.equal(exit._tag, "Failure"))),
);

Expand Down
3 changes: 1 addition & 2 deletions apps/desktop/src/backend/DesktopLocalEnvironmentAuth.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { assert, describe, it } from "@effect/vitest";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as Ref from "effect/Ref";
import * as HttpClient from "effect/unstable/http/HttpClient";
import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
Expand Down Expand Up @@ -60,7 +59,7 @@ describe("DesktopLocalEnvironmentAuth", () => {
{
id: PRIMARY_LOCAL_ENVIRONMENT_ID,
label: Effect.succeed("Windows"),
currentConfig: Effect.succeed(Option.some(config)),
currentConfig: Effect.succeedSome(config),
},
]),
} as unknown as DesktopBackendPool.DesktopBackendPool["Service"]);
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/electron/ElectronMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export const make = Effect.gen(function* () {
Effect.callback<Option.Option<string>>((resume) => {
const normalizedItems = normalizeContextMenuItems(input.items);
if (normalizedItems.length === 0) {
resume(Effect.succeed(Option.none()));
resume(Effect.succeedNone);
return;
}

Expand Down
5 changes: 3 additions & 2 deletions apps/desktop/src/electron/ElectronShell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe("ElectronShell", () => {
it.effect("rejects encoded or malformed Zed SSH authorities", () =>
Effect.gen(function* () {
const electronShell = yield* ElectronShell.ElectronShell;
const results = yield* Effect.all(
const results = yield* Effect.forEach(
[
"user%40example.com",
"user%3Asecret%40example.com",
Expand All @@ -133,7 +133,8 @@ describe("ElectronShell", () => {
"example.com%0A",
"example.com%20",
"example.com%",
].map((host) => electronShell.openExternal(`zed://ssh/${host}/path`)),
],
(host) => electronShell.openExternal(`zed://ssh/${host}/path`),
);
assert.deepEqual(results, Array(7).fill(false));
assert.equal(openExternalMock.mock.calls.length, 0);
Expand Down
28 changes: 13 additions & 15 deletions apps/desktop/src/ipc/methods/snapShot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("window capture IPC", () => {
Effect.provide(
Layer.mergeAll(
Layer.succeed(ElectronWindow.ElectronWindow, {
main: Effect.succeed(Option.some({ webContents: { id: 7 } })),
main: Effect.succeedSome({ webContents: { id: 7 } }),
} as ElectronWindow.ElectronWindow["Service"]),
Layer.succeed(DesktopSnapShot.DesktopSnapShot, {
previewConfig: () =>
Expand Down Expand Up @@ -87,7 +87,7 @@ describe("window capture IPC", () => {
Effect.provide(
Layer.mergeAll(
Layer.succeed(ElectronWindow.ElectronWindow, {
main: Effect.succeed(Option.some({ webContents: { id: 7 } })),
main: Effect.succeedSome({ webContents: { id: 7 } }),
} as ElectronWindow.ElectronWindow["Service"]),
Layer.succeed(DesktopSnapShot.DesktopSnapShot, {
state: Effect.succeed({
Expand Down Expand Up @@ -120,7 +120,7 @@ describe("window capture IPC", () => {
Effect.provide(
Layer.mergeAll(
Layer.succeed(ElectronWindow.ElectronWindow, {
main: Effect.succeed(Option.some({ webContents: { id: 7 } })),
main: Effect.succeedSome({ webContents: { id: 7 } }),
} as ElectronWindow.ElectronWindow["Service"]),
Layer.succeed(DesktopSnapShot.DesktopSnapShot, {
state: Effect.succeed({ linuxBackend: "niri" }),
Expand Down Expand Up @@ -156,13 +156,11 @@ describe("window capture IPC", () => {
Layer.succeed(
ElectronWindow.ElectronWindow,
ElectronWindow.ElectronWindow.of({
main: Effect.succeed(
Option.some({
getBounds: () => ({ x: 100, y: 80, width: 1_000, height: 700 }),
getContentBounds: () => ({ x: 100, y: 118, width: 1_000, height: 662 }),
webContents,
}),
),
main: Effect.succeedSome({
getBounds: () => ({ x: 100, y: 80, width: 1_000, height: 700 }),
getContentBounds: () => ({ x: 100, y: 118, width: 1_000, height: 662 }),
webContents,
}),
} as ElectronWindow.ElectronWindow["Service"]),
),
Layer.succeed(
Expand Down Expand Up @@ -220,7 +218,7 @@ describe("window capture IPC", () => {
Layer.succeed(
ElectronWindow.ElectronWindow,
ElectronWindow.ElectronWindow.of({
main: Effect.succeed(Option.some({ webContents })),
main: Effect.succeedSome({ webContents }),
} as ElectronWindow.ElectronWindow["Service"]),
),
Layer.succeed(
Expand Down Expand Up @@ -256,7 +254,7 @@ describe("window capture IPC", () => {
Effect.provideService(
ElectronWindow.ElectronWindow,
ElectronWindow.ElectronWindow.of({
main: Effect.succeed(Option.some({ webContents: { id: 7 } })),
main: Effect.succeedSome({ webContents: { id: 7 } }),
} as ElectronWindow.ElectronWindow["Service"]),
),
Effect.provideService(DesktopSnapShot.DesktopSnapShot, null as never),
Expand All @@ -277,7 +275,7 @@ describe("window capture IPC", () => {
Effect.provide(
Layer.mergeAll(
Layer.succeed(ElectronWindow.ElectronWindow, {
main: Effect.succeed(Option.some({ webContents: { id: 7 } })),
main: Effect.succeedSome({ webContents: { id: 7 } }),
} as ElectronWindow.ElectronWindow["Service"]),
Layer.succeed(DesktopSnapShot.DesktopSnapShot, {
setup: (action: string) =>
Expand All @@ -295,7 +293,7 @@ describe("window capture IPC", () => {
Layer.succeed(
ElectronWindow.ElectronWindow,
ElectronWindow.ElectronWindow.of({
main: Effect.succeed(Option.some({ webContents: { id: 7 } })),
main: Effect.succeedSome({ webContents: { id: 7 } }),
} as ElectronWindow.ElectronWindow["Service"]),
),
Layer.succeed(
Expand All @@ -320,7 +318,7 @@ describe("window capture IPC", () => {
Layer.succeed(
ElectronWindow.ElectronWindow,
ElectronWindow.ElectronWindow.of({
main: Effect.succeed(Option.some({ webContents: { id: 7 } })),
main: Effect.succeedSome({ webContents: { id: 7 } }),
} as ElectronWindow.ElectronWindow["Service"]),
),
Layer.succeed(
Expand Down
12 changes: 5 additions & 7 deletions apps/desktop/src/ipc/methods/sshEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,11 @@ export const ensureSshEnvironment = DesktopIpc.makeIpcMethod({
}) {
const sshEnvironment = yield* DesktopSshEnvironment.DesktopSshEnvironment;
return yield* sshEnvironment.ensureEnvironment(target, options).pipe(
Effect.catch((error) =>
DesktopSshEnvironment.isDesktopSshPasswordPromptCancellation(error)
? Effect.succeed({
type: DesktopSshPasswordPromptCancelledType,
message: error.message,
})
: Effect.fail(error),
Effect.catchIf(DesktopSshEnvironment.isDesktopSshPasswordPromptCancellation, (error) =>
Effect.succeed({
type: DesktopSshPasswordPromptCancelledType,
message: error.message,
}),
),
);
}),
Expand Down
26 changes: 12 additions & 14 deletions apps/desktop/src/ipc/methods/window.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const defaultWslInstance: DesktopBackendManager.DesktopBackendInstance = {
label: Effect.succeed("WSL (default distro)"),
start: Effect.void,
stop: () => Effect.void,
currentConfig: Effect.succeed(Option.some(readyWslConfig)),
currentConfig: Effect.succeedSome(readyWslConfig),
snapshot: Effect.succeed({
desiredRunning: true,
ready: true,
Expand Down Expand Up @@ -99,7 +99,7 @@ describe("getLocalEnvironmentBootstraps", () => {
};
const retryingInstance: DesktopBackendManager.DesktopBackendInstance = {
...defaultWslInstance,
currentConfig: Effect.succeed(Option.some(retryingConfig)),
currentConfig: Effect.succeedSome(retryingConfig),
snapshot: Effect.succeed({
desiredRunning: true,
ready: false,
Expand All @@ -126,16 +126,14 @@ describe("getLocalEnvironmentBootstraps", () => {
it.effect("omits a bounded transient bootstrap after retries stop", () => {
const stoppedInstance: DesktopBackendManager.DesktopBackendInstance = {
...defaultWslInstance,
currentConfig: Effect.succeed(
Option.some({
...readyWslConfig,
preflightFailure: Option.some({
reason: "WSL probe timed out",
fatal: false,
retryLimit: 12,
}),
currentConfig: Effect.succeedSome({
...readyWslConfig,
preflightFailure: Option.some({
reason: "WSL probe timed out",
fatal: false,
retryLimit: 12,
}),
),
}),
snapshot: Effect.succeed({
desiredRunning: false,
ready: false,
Expand All @@ -161,7 +159,7 @@ describe("getWindowFullscreenState", () => {
}).pipe(
Effect.provide(
Layer.mock(ElectronWindow.ElectronWindow)({
currentMainOrFirst: Effect.succeed(Option.some(window)),
currentMainOrFirst: Effect.succeedSome(window),
}),
),
);
Expand Down Expand Up @@ -204,7 +202,7 @@ describe("pasteAsText", () => {
}).pipe(
Effect.provide(
Layer.mock(ElectronWindow.ElectronWindow)({
main: Effect.succeed(Option.some(window)),
main: Effect.succeedSome(window),
}),
),
);
Expand All @@ -221,7 +219,7 @@ describe("pickProjectFavicon", () => {
Layer.mergeAll(
Layer.mock(ElectronDialog.ElectronDialog)({ pickFiles }),
Layer.mock(ElectronWindow.ElectronWindow)({
focusedMainOrFirst: Effect.succeed(Option.none()),
focusedMainOrFirst: Effect.succeedNone,
}),
),
),
Expand Down
3 changes: 1 addition & 2 deletions apps/desktop/src/ipc/methods/wsl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { DesktopWslStateSchema } from "@t3tools/contracts";
import { assert, describe, it } from "@effect/vitest";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as Schema from "effect/Schema";

import * as DesktopEnvironment from "../../app/DesktopEnvironment.ts";
Expand Down Expand Up @@ -34,7 +33,7 @@ function makeWslBackendLayer(input: { readonly onReconcile?: Effect.Effect<void>
DesktopWslBackend.DesktopWslBackend,
DesktopWslBackend.DesktopWslBackend.of({
reconcile: input.onReconcile ?? Effect.void,
lastPreflightError: Effect.succeed(Option.none()),
lastPreflightError: Effect.succeedNone,
}),
);
}
Expand Down
4 changes: 1 addition & 3 deletions apps/desktop/src/preview/BrowserImport/ChromiumKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,7 @@ export const resolveChromiumKeys = Effect.fn("ChromiumKeys.resolveChromiumKeys")
// v10 remains importable when Secret Service is absent or does not
// contain a key. An explicit denial/lock/cancel remains a consent
// failure rather than being silently downgraded.
Effect.catch((error) =>
error.reason === "needsKeychainApproval" ? Effect.fail(error) : Effect.succeed(error),
),
Effect.catchIf((error) => error.reason !== "needsKeychainApproval", Effect.succeed),
)
: undefined;
return {
Expand Down
12 changes: 6 additions & 6 deletions apps/desktop/src/preview/BrowserSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ export const make = Effect.gen(function* BrowserSessionMake() {
getSession,
clearCookies: Effect.fn("BrowserSession.clearCookies")(function* (partitions?) {
const sessions = yield* SynchronizedRef.get(sessionsRef);
yield* Effect.all(
selectSessions(sessions, partitions).map(([partition, browserSession]) =>
yield* Effect.forEach(
selectSessions(sessions, partitions),
([partition, browserSession]) =>
Effect.tryPromise({
try: () =>
browserSession.clearStorageData({
Expand All @@ -225,14 +226,14 @@ export const make = Effect.gen(function* BrowserSessionMake() {
cause,
}),
}),
),
{ concurrency: "unbounded", discard: true },
);
}),
clearCache: Effect.fn("BrowserSession.clearCache")(function* (partitions?) {
const sessions = yield* SynchronizedRef.get(sessionsRef);
yield* Effect.all(
selectSessions(sessions, partitions).map(([partition, browserSession]) =>
yield* Effect.forEach(
selectSessions(sessions, partitions),
([partition, browserSession]) =>
Effect.tryPromise({
try: () => browserSession.clearCache(),
catch: (cause) =>
Expand All @@ -241,7 +242,6 @@ export const make = Effect.gen(function* BrowserSessionMake() {
cause,
}),
}),
),
{ concurrency: "unbounded", discard: true },
);
}),
Expand Down
Loading
Loading