Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const make = Effect.gen(function* () {
Effect.map((parsed) =>
Option.fromNullishOr(parsed.t3codeCommitHash).pipe(Option.flatMap(normalizeCommitHash)),
),
Effect.catch(() => Effect.succeed(Option.none<string>())),
Effect.orElseSucceed(() => Option.none<string>()),
),
});
});
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src/backend/tailscaleEndpointProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ export const resolveTailscaleAdvertisedEndpoints = Effect.fn("resolveTailscaleAd
input.statusJson === undefined
? yield* readTailscaleStatus.pipe(
Effect.map((status) => status.magicDnsName),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
)
: input.statusJson
? yield* parseTailscaleMagicDnsName(input.statusJson).pipe(
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
)
: null;
const magicDnsEndpoint = yield* resolveTailscaleMagicDnsAdvertisedEndpoint({
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/settings/DesktopAppSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function readSettings(
onSome: (raw) =>
decodeDesktopSettingsJson(raw).pipe(
Effect.map((parsed) => normalizeDesktopSettingsDocument(parsed, appVersion)),
Effect.catch(() => Effect.succeed(defaultSettings)),
Effect.orElseSucceed(() => defaultSettings),
),
}),
),
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/settings/DesktopClientSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const readClientSettings = (
onSome: (raw) =>
decodeClientSettingsJson(raw).pipe(
Effect.map((settings) => Option.some(settings)),
Effect.catch(() => Effect.succeed(Option.none<ClientSettings>())),
Effect.orElseSucceed(() => Option.none<ClientSettings>()),
),
}),
),
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/settings/DesktopSavedEnvironments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function readRegistryDocument(
onSome: (raw) =>
decodeSavedEnvironmentRegistryDocumentJson(raw).pipe(
Effect.map(normalizeSavedEnvironmentRegistryDocument),
Effect.catch(() => Effect.succeed({ version: 1, records: [] })),
Effect.orElseSucceed(() => ({ version: 1, records: [] })),
),
}),
),
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/shell/DesktopShellEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const runCommandOutput = Effect.fn("desktop.shellEnvironment.runCommandOutput")(
.pipe(
Effect.timeoutOption(input.timeout),
Effect.map(Option.getOrElse(() => "")),
Effect.catch(() => Effect.succeed("")),
Effect.orElseSucceed(() => ""),
);
});

Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/updates/DesktopUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function parseAppUpdateYml(raw: string): Effect.Effect<Option.Option<AppUpdateYm

return decodeAppUpdateYmlConfig(entries).pipe(
Effect.map((config) => (config.provider ? Option.some(config) : Option.none())),
Effect.catch(() => Effect.succeed(Option.none<AppUpdateYmlConfig>())),
Effect.orElseSucceed(() => Option.none<AppUpdateYmlConfig>()),
);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@t3tools/shared": "workspace:*",
"@t3tools/tailscale": "workspace:*",
"@t3tools/web": "workspace:*",
"@types/bun": "catalog:",
"@types/bun": "1.3.14",
"@types/node": "catalog:",
"effect-acp": "workspace:*",
"effect-codex-app-server": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/checkpointing/Layers/CheckpointStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const makeCheckpointStore = Effect.gen(function* () {
const isGitRepository: CheckpointStoreShape["isGitRepository"] = (cwd) =>
vcsRegistry.resolve({ cwd, requestedKind: "git" }).pipe(
Effect.map(() => true),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);

const captureCheckpoint: CheckpointStoreShape["captureCheckpoint"] = Effect.fn(
Expand Down
4 changes: 1 addition & 3 deletions apps/server/src/cloud/ManagedEndpointRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ export const makeCloudManagedEndpointRuntime = Effect.gen(function* () {
const nextConfigKey = runtimeConfigKey(config);
const active = yield* Ref.get(activeRef);
if (active?.configKey === nextConfigKey) {
const isRunning = yield* active.child.isRunning.pipe(
Effect.catch(() => Effect.succeed(false)),
);
const isRunning = yield* active.child.isRunning.pipe(Effect.orElseSucceed(() => false));
if (isRunning) {
return {
status: "running",
Expand Down
14 changes: 7 additions & 7 deletions apps/server/src/git/GitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {

const tempDir = process.env.TMPDIR ?? process.env.TEMP ?? process.env.TMP ?? "/tmp";
const canonicalizeExistingPath = (value: string) =>
fileSystem.realPath(value).pipe(Effect.catch(() => Effect.succeed(value)));
fileSystem.realPath(value).pipe(Effect.orElseSucceed(() => value));
const normalizeStatusCacheKey = canonicalizeExistingPath;
const nonRepositoryStatusDetails = {
isRepo: false,
Expand Down Expand Up @@ -766,7 +766,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
if (details.isDefaultBranch && latest.state !== "open") return null;
return toStatusPr(latest);
}),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
)
: null;

Expand All @@ -788,7 +788,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
);

const readConfigValueNullable = (cwd: string, key: string) =>
gitCore.readConfigValue(cwd, key).pipe(Effect.catch(() => Effect.succeed(null)));
gitCore.readConfigValue(cwd, key).pipe(Effect.orElseSucceed(() => null));

const resolveHostingProvider = Effect.fn("resolveHostingProvider")(function* (
cwd: string,
Expand Down Expand Up @@ -972,7 +972,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
) {
const terms = yield* sourceControlProvider(cwd).pipe(
Effect.map((provider) => getChangeRequestTerminologyForKind(provider.kind)),
Effect.catch(() => Effect.succeed(getChangeRequestTerminologyForKind("unknown"))),
Effect.orElseSucceed(() => getChangeRequestTerminologyForKind("unknown")),
);
const summary = summarizeGitActionResult(result, terms);
let latestOpenPr: PullRequestInfo | null = null;
Expand Down Expand Up @@ -1016,7 +1016,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
upstreamRef: finalBranchContext.upstreamRef,
}).pipe(
Effect.flatMap((headContext) => findOpenPr(cwd, headContext)),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
}

Expand Down Expand Up @@ -1080,7 +1080,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {

const defaultFromProvider = yield* sourceControlProvider(cwd).pipe(
Effect.flatMap((provider) => provider.getDefaultBranch({ cwd })),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
if (defaultFromProvider) {
return defaultFromProvider;
Expand Down Expand Up @@ -1686,7 +1686,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
const changeRequestTerms = wantsPr
? yield* sourceControlProvider(input.cwd).pipe(
Effect.map((provider) => getChangeRequestTerminologyForKind(provider.kind)),
Effect.catch(() => Effect.succeed(getChangeRequestTerminologyForKind("unknown"))),
Effect.orElseSucceed(() => getChangeRequestTerminologyForKind("unknown")),
)
: null;

Expand Down
26 changes: 8 additions & 18 deletions apps/server/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ export const otlpTracesProxyRouteLayer = HttpRouter.add(
otlpTracesUrl,
}),
),
Effect.catch(() =>
Effect.succeed(HttpServerResponse.text("Trace export failed.", { status: 502 })),
Effect.orElseSucceed(() =>
HttpServerResponse.text("Trace export failed.", { status: 502 }),
),
);
}).pipe(
Expand Down Expand Up @@ -205,9 +205,7 @@ export const attachmentsRouteLayer = HttpRouter.add(
}

const fileSystem = yield* FileSystem.FileSystem;
const fileInfo = yield* fileSystem
.stat(filePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
const fileInfo = yield* fileSystem.stat(filePath).pipe(Effect.orElseSucceed(() => null));
if (!fileInfo || fileInfo.type !== "File") {
return HttpServerResponse.text("Not Found", { status: 404 });
}
Expand All @@ -218,9 +216,7 @@ export const attachmentsRouteLayer = HttpRouter.add(
"Cache-Control": "public, max-age=31536000, immutable",
},
}).pipe(
Effect.catch(() =>
Effect.succeed(HttpServerResponse.text("Internal Server Error", { status: 500 })),
),
Effect.orElseSucceed(() => HttpServerResponse.text("Internal Server Error", { status: 500 })),
);
}).pipe(
Effect.catchTags({
Expand Down Expand Up @@ -265,9 +261,7 @@ export const projectFaviconRouteLayer = HttpRouter.add(
"Cache-Control": PROJECT_FAVICON_CACHE_CONTROL,
},
}).pipe(
Effect.catch(() =>
Effect.succeed(HttpServerResponse.text("Internal Server Error", { status: 500 })),
),
Effect.orElseSucceed(() => HttpServerResponse.text("Internal Server Error", { status: 500 })),
);
}).pipe(
Effect.catchTags({
Expand Down Expand Up @@ -337,14 +331,12 @@ export const staticAndDevRouteLayer = HttpRouter.add(
}
}

const fileInfo = yield* fileSystem
.stat(filePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
const fileInfo = yield* fileSystem.stat(filePath).pipe(Effect.orElseSucceed(() => null));
if (!fileInfo || fileInfo.type !== "File") {
const indexPath = path.resolve(staticRoot, "index.html");
const indexData = yield* fileSystem
.readFile(indexPath)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
if (!indexData) {
return HttpServerResponse.text("Not Found", { status: 404 });
}
Expand All @@ -355,9 +347,7 @@ export const staticAndDevRouteLayer = HttpRouter.add(
}

const contentType = Mime.getType(filePath) ?? "application/octet-stream";
const data = yield* fileSystem
.readFile(filePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
const data = yield* fileSystem.readFile(filePath).pipe(Effect.orElseSucceed(() => null));
if (!data) {
return HttpServerResponse.text("Internal Server Error", { status: 500 });
}
Expand Down
6 changes: 2 additions & 4 deletions apps/server/src/orchestration/Layers/ProjectionPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ const runAttachmentSideEffects = Effect.fn("runAttachmentSideEffects")(function*
const attachmentsRootDir = serverConfig.attachmentsDir;
const readAttachmentRootEntries = fileSystem
.readDirectory(attachmentsRootDir, { recursive: false })
.pipe(Effect.catch(() => Effect.succeed([] as Array<string>)));
.pipe(Effect.orElseSucceed(() => [] as Array<string>));

const removeDeletedThreadAttachmentEntry = Effect.fn("removeDeletedThreadAttachmentEntry")(
function* (threadSegment: string, entry: string) {
Expand Down Expand Up @@ -397,9 +397,7 @@ const runAttachmentSideEffects = Effect.fn("runAttachmentSideEffects")(function*
}

const absolutePath = path.join(attachmentsRootDir, relativePath);
const fileInfo = yield* fileSystem
.stat(absolutePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
const fileInfo = yield* fileSystem.stat(absolutePath).pipe(Effect.orElseSucceed(() => null));
if (!fileInfo || fileInfo.type !== "File") {
return;
}
Expand Down
6 changes: 2 additions & 4 deletions apps/server/src/project/Layers/ProjectFaviconResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ export const makeProjectFaviconResolver = Effect.gen(function* () {
if (!isPathWithinProject(projectCwd, candidate)) {
continue;
}
const stats = yield* fileSystem
.stat(candidate)
.pipe(Effect.catch(() => Effect.succeed(null)));
const stats = yield* fileSystem.stat(candidate).pipe(Effect.orElseSucceed(() => null));
if (stats?.type === "File") {
return candidate;
}
Expand All @@ -105,7 +103,7 @@ export const makeProjectFaviconResolver = Effect.gen(function* () {
const sourcePath = path.join(cwd, sourceFile);
const source = yield* fileSystem
.readFileString(sourcePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
if (!source) {
continue;
}
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/provider/providerMaintenance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export const resolveProviderMaintenanceCapabilitiesEffect = Effect.fn(
const fileSystem = yield* FileSystem.FileSystem;
const realCommandPath = yield* fileSystem
.realPath(resolvedCommandPath)
.pipe(Effect.catch(() => Effect.succeed(resolvedCommandPath)));
.pipe(Effect.orElseSucceed(() => resolvedCommandPath));
return resolver.resolve({
...options,
realCommandPath,
Expand Down Expand Up @@ -406,7 +406,7 @@ const fetchNpmLatestVersion = Effect.fn("fetchNpmLatestVersion")(function* (pack
).pipe(HttpClientRequest.setHeader("accept", "application/json"));
const response = yield* client.execute(request).pipe(
Effect.timeoutOption(LATEST_VERSION_TIMEOUT_MS),
Effect.catch(() => Effect.succeed(Option.none())),
Effect.orElseSucceed(() => Option.none()),
);
if (Option.isNone(response)) {
return null;
Expand All @@ -417,7 +417,7 @@ const fetchNpmLatestVersion = Effect.fn("fetchNpmLatestVersion")(function* (pack
}
const payload = yield* httpResponse.json.pipe(
Effect.flatMap(Schema.decodeUnknownEffect(NpmLatestVersionResponse)),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
return payload ? nonEmptyString(payload.version) : null;
});
Expand Down
4 changes: 1 addition & 3 deletions apps/server/src/review/ReviewService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ export const make = Effect.fn("makeReviewService")(function* () {
const git = yield* GitVcsDriver.GitVcsDriver;

const canonicalizePath = (value: string) =>
fileSystem
.realPath(path.resolve(value))
.pipe(Effect.catch(() => Effect.succeed(path.resolve(value))));
fileSystem.realPath(path.resolve(value)).pipe(Effect.orElseSucceed(() => path.resolve(value)));

const isWithinRoot = (candidate: string, root: string) => {
const relative = path.relative(root, candidate);
Expand Down
12 changes: 6 additions & 6 deletions apps/server/src/sourceControl/BitbucketApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ function responseError(
response: HttpClientResponse.HttpClientResponse,
): Effect.Effect<never, BitbucketApiError> {
return response.text.pipe(
Effect.catch(() => Effect.succeed("")),
Effect.orElseSucceed(() => ""),
Effect.flatMap((body) =>
Effect.fail(
new BitbucketApiError({
Expand Down Expand Up @@ -524,7 +524,7 @@ export const make = Effect.fn("makeBitbucketApi")(function* () {
);

const readConfigValueNullable = (cwd: string, key: string) =>
git.readConfigValue(cwd, key).pipe(Effect.catch(() => Effect.succeed(null)));
git.readConfigValue(cwd, key).pipe(Effect.orElseSucceed(() => null));

const resolveCheckoutRemote = Effect.fn("BitbucketApi.resolveCheckoutRemote")(function* (input: {
readonly cwd: string;
Expand All @@ -544,7 +544,7 @@ export const make = Effect.fn("makeBitbucketApi")(function* () {
if (!input.isCrossRepository) {
const remoteName = yield* git
.resolvePrimaryRemoteName(input.cwd)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
if (remoteName) return remoteName;
}

Expand Down Expand Up @@ -575,7 +575,7 @@ export const make = Effect.fn("makeBitbucketApi")(function* () {
host: Option.some("bitbucket.org"),
detail: Option.none<string>(),
})),
Effect.catch(() => Effect.succeed(authFromConfig(config))),
Effect.orElseSucceed(() => authFromConfig(config)),
),
listPullRequests: (input) =>
resolveRepository(input).pipe(
Expand Down Expand Up @@ -685,8 +685,8 @@ export const make = Effect.fn("makeBitbucketApi")(function* () {
{
repository: getRepositoryFromLocator(locator),
branchingModel: getBranchingModelFromLocator(locator).pipe(
Effect.catch(() =>
Effect.succeed<typeof RawBitbucketBranchingModelSchema.Type | null>(null),
Effect.orElseSucceed(
(): typeof RawBitbucketBranchingModelSchema.Type | null => null,
),
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export const refineUnknownRemoteProvider = Effect.fn("refineUnknownRemoteProvide
auth,
}),
),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
),
);
const provider = providers.find((candidate) => candidate !== null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,10 @@ export const make = Effect.fn("makeSourceControlRepositoryService")(function* ()
})
.pipe(
Effect.map(() => true),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);
if (!hasCommits) {
const details = yield* git
.statusDetails(input.cwd)
.pipe(Effect.catch(() => Effect.succeed(null)));
const details = yield* git.statusDetails(input.cwd).pipe(Effect.orElseSucceed(() => null));
return {
repository: toRepositoryInfo(providerKind, urls),
remoteName,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/telemetry/Layers/AnalyticsService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ it.layer(NodeServices.layer)("AnalyticsService test", (it) => {

const payload = yield* request.json.pipe(
Effect.map((body) => body as RecordedBatchRequest["body"]),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);

capturedRequests.push({ path: request.url, body: payload });
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/terminal/Layers/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ export const makeTerminalManagerWithOptions = Effect.fn("makeTerminalManagerWith
const threadPrefix = `${toSafeThreadId(threadId)}_`;
const entries = yield* fileSystem
.readDirectory(logsDir, { recursive: false })
.pipe(Effect.catch(() => Effect.succeed([] as Array<string>)));
.pipe(Effect.orElseSucceed(() => [] as Array<string>));
yield* Effect.forEach(
entries.filter(
(name) =>
Expand Down
Loading
Loading