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 21, 22:15 UTC
test(server): keep the OpenZFS zed launch test off host system bins (#34277)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Jérôme Poskin committed
Nov 12, 2026 at 00:20 UTC
905311d37e9d9242545cf6f213404dc3c68ea61b
1 file changed
+26
-19
apps/server/src/process/externalLauncher.test.ts
+26
-19
@@ -59,6 +59,7 @@ function makeMockDetachedHandle(input: MockSpawnResult & { readonly onUnref?: ()
59
const layerTest = (input: {
60
readonly platform: NodeJS.Platform;
61
readonly env?: Record<string, string>;
62
+ readonly path?: Path.Path;
63
readonly resolveExecutable?: (command: string) => string | undefined;
64
readonly onSpawn?: (command: ChildProcess.StandardCommand) => void;
65
readonly onUnref?: () => void;
@@ -84,7 +85,15 @@ const layerTest = (input: {
85
);
86
87
return Layer.mergeAll(
87
- ExternalLauncher.layer.pipe(Layer.provide(Layer.merge(NodeServices.layer, layerSpawner))),
88
+ ExternalLauncher.layer.pipe(
89
+ Layer.provide(
90
+ Layer.mergeAll(
91
+ NodeServices.layer,
92
+ layerSpawner,
93
+ input.path ? Layer.succeed(Path.Path, input.path) : Layer.empty,
94
+ ),
95
+ ),
96
+ ),
97
Layer.succeed(HostProcess.Platform, input.platform),
98
Layer.succeed(
99
SpawnExecutableResolution,
@@ -503,6 +512,18 @@ for (const { layout, pathNames, fallbackNames, expected } of [
512
);
513
}
514
515
+// Linux editor discovery also probes fixed system directories; tests point them at a temp
516
+// directory so an editor installed on the host cannot satisfy the lookup.
517
+const withSystemBin = (path: Path.Path, systemBin: string): Path.Path => ({
518
+ ...path,
519
+ join: (...parts) =>
520
+ path.join(
521
+ ...parts.map((part) =>
522
+ ["/usr/local/bin", "/usr/bin", "/snap/bin"].includes(part) ? systemBin : part,
523
+ ),
524
+ ),
525
+});
526
+
527
it.effect.skipIf(windowsHost)("prefers zeditor in a later Linux fallback directory", () =>
528
Effect.gen(function* () {
529
const fs = yield* FileSystem.FileSystem;
@@ -522,15 +543,7 @@ it.effect.skipIf(windowsHost)("prefers zeditor in a later Linux fallback directo
543
const editor = EDITORS.find((editor) => editor.id === "zed")!;
544
const resolve = resolveEditorCommand(editor, { HOME: home, PATH: "" }).pipe(
545
Effect.provideService(HostProcess.Platform, "linux"),
525
- Effect.provideService(Path.Path, {
526
- ...path,
527
- join: (...parts) =>
528
- path.join(
529
- ...parts.map((part) =>
530
- ["/usr/local/bin", "/usr/bin", "/snap/bin"].includes(part) ? systemBin : part,
531
- ),
532
- ),
533
- }),
546
+ Effect.provideService(Path.Path, withSystemBin(path, systemBin)),
547
);
548
assert.deepEqual(
549
yield* resolve,
@@ -563,15 +576,7 @@ it.effect.skipIf(windowsHost)("does not offer the OpenZFS zed daemon as Zed on L
576
const editor = EDITORS.find((editor) => editor.id === "zed")!;
577
const resolve = resolveEditorCommand(editor, { HOME: home, PATH: binDir }).pipe(
578
Effect.provideService(HostProcess.Platform, "linux"),
566
- Effect.provideService(Path.Path, {
567
- ...path,
568
- join: (...parts) =>
569
- path.join(
570
- ...parts.map((part) =>
571
- ["/usr/local/bin", "/usr/bin", "/snap/bin"].includes(part) ? systemBin : part,
572
- ),
573
- ),
574
- }),
579
+ Effect.provideService(Path.Path, withSystemBin(path, systemBin)),
580
);
581
assert.deepEqual(yield* resolve, Option.none());
582
@@ -589,6 +594,7 @@ it.effect.skipIf(windowsHost)("does not open Zed with the OpenZFS zed daemon on
594
const path = yield* Path.Path;
595
const home = yield* fs.makeTempDirectoryScoped({ prefix: "t3-zed-zfs-launch-" });
596
const binDir = path.join(home, "bin");
597
+ const systemBin = path.join(home, "system-bin");
598
yield* fs.makeDirectory(binDir, { recursive: true });
599
yield* fs.writeFileString(path.join(binDir, "zed"), "#!/bin/sh\nexit 1\n");
600
yield* fs.chmod(path.join(binDir, "zed"), 0o755);
@@ -602,6 +608,7 @@ it.effect.skipIf(windowsHost)("does not open Zed with the OpenZFS zed daemon on
608
layerTest({
609
platform: "linux",
610
env: { HOME: home, PATH: binDir },
611
+ path: withSystemBin(path, systemBin),
612
onSpawn: (command) => spawned.push(command),
613
spawnResult: (command) => (command.args[0] === "--version" ? { exitCode: 1 } : undefined),
614
}),