@devries-cameron20 / t3code Mirror · read-only / commits / ded4dacec1
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 04:30 UTC

test(server): replay tests delete their temp directories (#23445)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Victor committed Nov 5, 2026 at 14:18 UTC ded4dacec19c532332b6b92c43514d4bd547dca8
5 files changed +25 -5
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.testkit.ts
+1 -1
@@ -48,7 +48,7 @@ function layerAcpRegistryProviderAdapterRegistryReplay(
48 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
49 const replayGate = options.replayGate;
50 const replayDir = yield* fileSystem
51 - .makeTempDirectory({
51 + .makeTempDirectoryScoped({
52 prefix: `t3-orchestration-v2-acp-registry-replay-${transcript.scenario}-`,
53 })
54 .pipe(Effect.orDie);
apps/server/src/orchestration-v2/Adapters/FxAdapterV2.testkit.ts
+1 -1
@@ -46,7 +46,7 @@ function layerFxProviderAdapterRegistryReplay(
46 const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
47 const replayGate = options.replayGate;
48 const replayDir = yield* fileSystem
49 - .makeTempDirectory({
49 + .makeTempDirectoryScoped({
50 prefix: `t3-orchestration-v2-fx-replay-${transcript.scenario}-`,
51 })
52 .pipe(Effect.orDie);
apps/server/src/orchestration-v2/Adapters/GrokAdapterV2.testkit.ts
+1 -1
@@ -50,7 +50,7 @@ function layerGrokProviderAdapterRegistryReplay(
50 const continuationRequests = yield* ProviderContinuationRequests.ProviderContinuationRequests;
51 const replayGate = options.replayGate;
52 const replayDir = yield* fileSystem
53 - .makeTempDirectory({
53 + .makeTempDirectoryScoped({
54 prefix: `t3-orchestration-v2-grok-replay-${transcript.scenario}-`,
55 })
56 .pipe(Effect.orDie);
apps/server/src/orchestration-v2/testkit/ProviderReplayHarness.test.ts new
+19
@@ -0,0 +1,19 @@
1 +import * as NodeServices from "@effect/platform-node/NodeServices";
2 +import { assert, it } from "@effect/vitest";
3 +import * as Effect from "effect/Effect";
4 +import * as FileSystem from "effect/FileSystem";
5 +
6 +import { makeReplayServerConfig } from "./ProviderReplayHarness.ts";
7 +
8 +it.effect("deletes its temp state directory when the scenario scope closes", () =>
9 + Effect.gen(function* () {
10 + const fs = yield* FileSystem.FileSystem;
11 + const baseDir = yield* Effect.gen(function* () {
12 + const config = yield* makeReplayServerConfig("temp-cleanup");
13 + assert.isTrue(yield* fs.exists(config.stateDir));
14 + return config.baseDir;
15 + }).pipe(Effect.scoped);
16 +
17 + assert.isFalse(yield* fs.exists(baseDir));
18 + }).pipe(Effect.provide(NodeServices.layer)),
19 +);
apps/server/src/orchestration-v2/testkit/ProviderReplayHarness.ts
+3 -2
@@ -12,6 +12,7 @@ import * as FileSystem from "effect/FileSystem";
12 import * as Layer from "effect/Layer";
13 import * as Path from "effect/Path";
14 import * as PlatformError from "effect/PlatformError";
15 +import type * as Scope from "effect/Scope";
16 import type * as SqlClient from "effect/sql/SqlClient";
17 import type { MigrationError } from "effect/sql/Migrator";
18 import type { SqlError } from "effect/sql/SqlError";
@@ -80,13 +81,13 @@ export function makeReplayServerConfig(
81 ): Effect.Effect<
82 ServerConfig.ServerConfig["Service"],
83 PlatformError.PlatformError,
83 - FileSystem.FileSystem | Path.Path
84 + FileSystem.FileSystem | Path.Path | Scope.Scope
85 > {
86 const safeScenario = scenario.replace(/[^a-z0-9_-]+/gi, "-");
87 return Effect.gen(function* () {
88 const fs = yield* FileSystem.FileSystem;
89 const path = yield* Path.Path;
89 - const baseDir = yield* fs.makeTempDirectory({
90 + const baseDir = yield* fs.makeTempDirectoryScoped({
91 prefix: `t3-orchestration-v2-replay-${safeScenario}-`,
92 });
93 const stateDir = path.join(baseDir, "userdata");