Skip to content

Commit fd6fdc1

Browse files
test(server): assert failed git actions retain their original error
1 parent cad46e2 commit fd6fdc1

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎apps/server/src/ws.test.ts‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,16 +1536,21 @@ it.effect("a missing thread worktree gets its project's skills in the cwd snapsh
15361536
it.effect("a git action that fails partway still refreshes the repository status", () =>
15371537
Effect.gen(function* () {
15381538
const failure = new GitManagerError({ operation: "test", cwd: "/repo", detail: "push failed" });
1539+
const refreshFailure = new GitManagerError({
1540+
operation: "refresh",
1541+
cwd: "/repo",
1542+
detail: "refresh failed",
1543+
});
15391544
const refreshed = yield* Deferred.make<string>();
1540-
const exits = yield* Queue.unbounded<string>();
1545+
const exits = yield* Queue.unbounded<Exit.Exit<unknown, unknown>>();
15411546
const services = Layer.mergeAll(
15421547
layerUnusedConfigRpcServices,
15431548
Layer.mock(GitWorkflowService.GitWorkflowService)({
15441549
runStackedAction: () => Effect.fail(failure),
15451550
}),
15461551
Layer.mock(VcsStatusBroadcaster.VcsStatusBroadcaster)({
15471552
refreshStatus: (cwd) =>
1548-
Deferred.succeed(refreshed, cwd).pipe(Effect.andThen(Effect.fail(failure))),
1553+
Deferred.succeed(refreshed, cwd).pipe(Effect.andThen(Effect.fail(refreshFailure))),
15491554
}),
15501555
Layer.mock(ExternalLauncher.ExternalLauncher)({}),
15511556
Layer.mock(ProviderRegistry.ProviderRegistry)({}),
@@ -1560,7 +1565,7 @@ it.effect("a git action that fails partway still refreshes the repository status
15601565
const server = yield* RpcServer.makeNoSerialization(WsRpcGroup, {
15611566
...WS_RPC_SERVER_OPTIONS,
15621567
onFromServer: (response) =>
1563-
response._tag === "Exit" ? Queue.offer(exits, response.exit._tag) : Effect.void,
1568+
response._tag === "Exit" ? Queue.offer(exits, response.exit) : Effect.void,
15641569
}).pipe(
15651570
Effect.provide(
15661571
layerWsRpc(
@@ -1587,7 +1592,8 @@ it.effect("a git action that fails partway still refreshes the repository status
15871592
payload: { actionId: "action", cwd: "/repo", action: "commit_push" },
15881593
headers: Headers.empty,
15891594
});
1590-
assert.equal(yield* Queue.take(exits), "Failure");
1595+
const exit = yield* Queue.take(exits);
1596+
assert.deepEqual(Exit.isFailure(exit) ? Cause.squash(exit.cause) : exit, failure);
15911597
assert.equal(yield* Deferred.await(refreshed), "/repo");
15921598
}).pipe(
15931599
Effect.provide(

0 commit comments

Comments
 (0)