Skip to content

Commit 9cbdcf4

Browse files
committed
Replace VcsProcessExitError with CheckpointInvariantError for validation failures
VcsProcessExitError was being misused with fabricated exitCode values (0 and 1) for application-level invariant violations: empty tree OID, empty commit OID, and unavailable checkpoint refs. These are not process exit failures. Use CheckpointInvariantError instead, which is already imported and is the correct semantic fit for these validation-level conditions.
1 parent 10907e9 commit 9cbdcf4

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

apps/server/src/checkpointing/Layers/CheckpointStore.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { randomUUID } from "node:crypto";
1414
import { Effect, Layer, FileSystem, Path } from "effect";
1515

1616
import { CheckpointInvariantError } from "../Errors.ts";
17-
import { VcsProcessExitError } from "@t3tools/contracts";
1817
import { VcsDriver } from "../../vcs/VcsDriver.ts";
1918
import { CheckpointStore, type CheckpointStoreShape } from "../Services/CheckpointStore.ts";
2019
import { CheckpointRef } from "@t3tools/contracts";
@@ -128,11 +127,8 @@ const makeCheckpointStore = Effect.gen(function* () {
128127
});
129128
const treeOid = writeTreeResult.stdout.trim();
130129
if (treeOid.length === 0) {
131-
return yield* new VcsProcessExitError({
130+
return yield* new CheckpointInvariantError({
132131
operation,
133-
command: "git write-tree",
134-
cwd: input.cwd,
135-
exitCode: 0,
136132
detail: "git write-tree returned an empty tree oid.",
137133
});
138134
}
@@ -146,11 +142,8 @@ const makeCheckpointStore = Effect.gen(function* () {
146142
});
147143
const commitOid = commitTreeResult.stdout.trim();
148144
if (commitOid.length === 0) {
149-
return yield* new VcsProcessExitError({
145+
return yield* new CheckpointInvariantError({
150146
operation,
151-
command: "git commit-tree",
152-
cwd: input.cwd,
153-
exitCode: 0,
154147
detail: "git commit-tree returned an empty commit oid.",
155148
});
156149
}
@@ -234,11 +227,8 @@ const makeCheckpointStore = Effect.gen(function* () {
234227
}
235228

236229
if (!fromCommitOid || !toCommitOid) {
237-
return yield* new VcsProcessExitError({
230+
return yield* new CheckpointInvariantError({
238231
operation,
239-
command: "git diff",
240-
cwd: input.cwd,
241-
exitCode: 1,
242232
detail: "Checkpoint ref is unavailable for diff operation.",
243233
});
244234
}

0 commit comments

Comments
 (0)