History

Use typed exit codes in VCS process results

- Switch VCS process and git driver results to `ChildProcessSpawner.ExitCode` - Update status checks and fallback results to use the new typed exit code - Refresh tests to match the new result shape

Julius Marminge committed 6 months ago

Commit 0587d8a1 parent 68df27e9 files · +62 −41Browse files

Showing the changes to apps/server/src/sourceControl (2 of 9 files). Show all

Unified · Split

2 files
  1. apps/server/src/sourceControl/SourceControlProviderRegistry.test.ts +2 −3
  2. apps/server/src/sourceControl/SourceControlProviderRegistry.ts +1 −1
apps/server/src/sourceControl/SourceControlProviderRegistry.test.ts+2−3
@@ -1,5 +1,6 @@
1import { assert, it } from "@effect/vitest";1import { assert, it } from "@effect/vitest";
2import { Effect, Layer } from "effect";2import { Effect, Layer } from "effect";
3import { ChildProcessSpawner } from "effect/unstable/process";
3 4
4import { GitHubCli } from "./GitHubCli.ts";5import { GitHubCli } from "./GitHubCli.ts";
5import * as GitVcsDriver from "../vcs/GitVcsDriver.ts";6import * as GitVcsDriver from "../vcs/GitVcsDriver.ts";
@@ -8,9 +9,7 @@ import * as SourceControlProviderRegistry from "./SourceControlProviderRegistry. · 2 unmodified lines
8const processResult = (stdout: string) => ({9const processResult = (stdout: string) => ({
9 stdout,10 stdout,
10 stderr: "",11 stderr: "",
11 code: 0,12 exitCode: ChildProcessSpawner.ExitCode(0),
12 signal: null,
13 timedOut: false,
14 stdoutTruncated: false,13 stdoutTruncated: false,
15 stderrTruncated: false,14 stderrTruncated: false,
16});15});
apps/server/src/sourceControl/SourceControlProviderRegistry.ts+1−1
@@ -89,7 +89,7 @@ export const make = Effect.fn("makeSourceControlProviderRegistry")(function* () · 88 unmodified lines
89 })89 })
90 .pipe(90 .pipe(
91 Effect.map((result) =>91 Effect.map((result) =>
92 result.code === 0 ? firstRemoteUrlFromVerboseOutput(result.stdout) : null,92 result.exitCode === 0 ? firstRemoteUrlFromVerboseOutput(result.stdout) : null,
93 ),93 ),
94 Effect.mapError((error) => providerDetectionError("detectProvider", cwd, error)),94 Effect.mapError((error) => providerDetectionError("detectProvider", cwd, error)),
95 ));95 ));