@devries-cameron20 / t3code-1 / commits / 621f0e7e71
Fork 0

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

fix(server): workspace search no longer indexes the home directory (#26126)

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

Julius Marminge committed Nov 11, 2026 at 11:57 UTC 621f0e7e71c742c3df1929ee5ff6ae69632b1d52
2 files changed +35 -2
apps/server/src/workspace/WorkspaceSearchIndex.test.ts
+35
@@ -5,8 +5,12 @@ import {
5 type GrepOptions,
6 type GrepResult,
7 } from "@ff-labs/fff-node";
8 +import * as NodeServices from "@effect/platform-node/NodeServices";
9 import { afterEach, expect, it } from "@effect/vitest";
10 +import * as HostProcess from "@t3tools/shared/HostProcess";
11 import * as Effect from "effect/Effect";
12 +import * as FileSystem from "effect/FileSystem";
13 +import * as Path from "effect/Path";
14 import { vi } from "vite-plus/test";
15
16 import * as WorkspaceSearchIndex from "./WorkspaceSearchIndex.ts";
@@ -139,3 +143,34 @@ it.effect("continues whole-word searches after a filtered grep page", () =>
143 }),
144 ),
145 );
146 +
147 +// fff reads HOME on Linux and macOS but the user profile on Windows, so a temp HOME cannot stand in there.
148 +it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
149 + "refuses to index a workspace rooted at the home directory",
150 + () =>
151 + Effect.scoped(
152 + Effect.gen(function* () {
153 + const fs = yield* FileSystem.FileSystem;
154 + const path = yield* Path.Path;
155 + const home = yield* fs.realPath(
156 + yield* fs.makeTempDirectoryScoped({ prefix: "t3-search-home-" }),
157 + );
158 + yield* fs.makeDirectory(path.join(home, "OneDrive", "Remix"), { recursive: true });
159 + yield* fs.writeFileString(path.join(home, "OneDrive", "Remix", "part.stl"), "solid part\n");
160 + yield* Effect.acquireRelease(
161 + Effect.sync(() => vi.stubEnv("HOME", home)),
162 + () => Effect.sync(() => vi.unstubAllEnvs()),
163 + );
164 +
165 + const result = yield* WorkspaceSearchIndex.make(home).pipe(
166 + Effect.flatMap((searchIndex) => searchIndex.search("stl", 50, undefined, false)),
167 + Effect.map(({ entries }) => entries),
168 + Effect.catchTags({
169 + WorkspaceSearchIndexCreateFailed: (error) => Effect.succeed(error._tag),
170 + }),
171 + );
172 +
173 + expect(result).toBe("WorkspaceSearchIndexCreateFailed");
174 + }),
175 + ).pipe(Effect.provide(NodeServices.layer)),
176 +);
apps/server/src/workspace/WorkspaceSearchIndex.ts
-2
@@ -296,8 +296,6 @@ const createFinder = Effect.fn("WorkspaceSearchIndex.createFinder")(function* (
296 // Content indexing costs CPU/memory; path-only consumers use the lightweight index.
297 disableContentIndexing: variant !== "content",
298 aiMode: false,
299 - enableFsRootScanning: true,
300 - enableHomeDirScanning: true,
299 }),
300 catch: (cause) =>
301 new WorkspaceSearchIndexCreateFailed({