test(server): keep provider fixture directories host-portable#9572
1 unresolved thread · Jump to file
0 / 2 viewed2 files changedLine totals unavailable
apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts · Earlier revision bc8fff55 · right 74
Original diff
@@ -51,8 +53,25 @@ it.layer(NodeServices.layer)("Claude capability probe SDK boundary", (it) => {
const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-probe-sdk-" });
const executablePath = path.join(tempDir, "fake-claude.mjs");
const invocationPath = path.join(tempDir, "invocation.json");
- const workspaceCwd = path.join(tempDir, "workspace");
- yield* fs.makeDirectory(workspaceCwd, { recursive: true });
+ // The probe aborts the SDK without awaiting the child's exit, and on
+ // Windows a directory that is still some process's cwd cannot be
+ // removed. Keep the workspace outside the scoped directory and let it
+ // go with a retrying removal once the child has gone.
+ const workspaceCwd = yield* fs.makeTempDirectory({ prefix: "t3-claude-probe-cwd-" });
+ // Node's own retry rather than an Effect schedule: it.effect runs on a
+ // TestClock, so a scheduled retry would wait for time nobody advances.
+ // If the child still holds the directory after that, an empty temp
+ // directory is left behind rather than failing the test for it.
+ yield* Effect.addFinalizer(() =>
+ Effect.promise(() =>
+ NodeFSP.rm(workspaceCwd, {
+ recursive: true,
+ force: true,
+ maxRetries: 20,
+ retryDelay: 250,
+ }).catch(() => undefined),
+ ),
+ );cursorSep 4, 2026
Fake probe never exits after abort
Medium Severity
The fake CLI still keeps the event loop alive after the probe aborts, so it never releases workspaceCwd. On Windows the new retrying rm then fails every attempt, and Node's linear backoff on maxRetries can block teardown for tens of seconds before the leftover directory is ignored.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit bc8fff55c03d5d73d561bbc412409cfe904b4aea. Configure here.