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, 18:30 UTC
fix(server): workspace search ignore filter follows the host path separator (#35697)
Julius Marminge committed
Nov 12, 2026 at 15:38 UTC
7d517188bdda54b96ae988adab071d50b67e47f8
2 files changed
+17
-8
apps/server/src/workspace/WorkspaceSearchIndex.test.ts
+1
-1
@@ -135,7 +135,7 @@ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
135
136
expect(result.entries).toEqual([{ kind: "file", path: "dir\\one/report.txt" }]);
137
}),
138
- ),
138
+ ).pipe(Effect.provide(testLayer)),
139
);
140
141
it.effect("continues whole-word searches after a filtered grep page", () =>
apps/server/src/workspace/WorkspaceSearchIndex.ts
+16
-7
@@ -294,6 +294,7 @@ function withDirectoryAncestors(entries: ReadonlyArray<ProjectEntry>): ProjectEn
294
const listGitIgnoredPaths = Effect.fn("WorkspaceSearchIndex.listGitIgnoredPaths")(function* (
295
vcsProcess: VcsProcess.VcsProcess["Service"],
296
cwd: string,
297
+ hostIsWindows: boolean,
298
) {
299
const result = yield* vcsProcess
300
.run({
@@ -320,7 +321,7 @@ const listGitIgnoredPaths = Effect.fn("WorkspaceSearchIndex.listGitIgnoredPaths"
321
result.stdout
322
.split("\0")
323
.filter((entry) => entry.length > 0)
323
- .map((entry) => trimDirectorySeparator(toPosixPath(entry))),
324
+ .map((entry) => trimDirectorySeparator(toPosixPath(entry, hostIsWindows))),
325
);
326
});
327
@@ -328,9 +329,15 @@ function mixedItemPath(item: MixedItem): string {
329
return item.item.relativePath;
330
}
331
331
-function isIgnoredPath(ignoredPaths: ReadonlySet<string>, relativePath: string): boolean {
332
+function isIgnoredPath(
333
+ ignoredPaths: ReadonlySet<string>,
334
+ relativePath: string,
335
+ hostIsWindows: boolean,
336
+): boolean {
337
if (ignoredPaths.size === 0) return false;
333
- let candidate: string | undefined = trimDirectorySeparator(toPosixPath(relativePath));
338
+ let candidate: string | undefined = trimDirectorySeparator(
339
+ toPosixPath(relativePath, hostIsWindows),
340
+ );
341
while (candidate) {
342
if (ignoredPaths.has(candidate)) return true;
343
candidate = parentPathOf(candidate);
@@ -402,7 +409,7 @@ export const make = Effect.fn("WorkspaceSearchIndex.make")(function* (
409
);
410
let initialScanTimedOut = false;
411
const vcsProcess = yield* VcsProcess.VcsProcess;
405
- let ignoredPaths = yield* listGitIgnoredPaths(vcsProcess, cwd);
412
+ let ignoredPaths = yield* listGitIgnoredPaths(vcsProcess, cwd, hostIsWindows);
413
yield* waitForIndexReady(
414
cwd,
415
finder,
@@ -466,7 +473,9 @@ export const make = Effect.fn("WorkspaceSearchIndex.make")(function* (
473
const fetchSize = size;
474
const result = yield* runSearch(query, fetchSize, operation, () => execute(fetchSize));
475
if (ignoredPaths.size === 0) return result;
469
- const items = result.items.filter((item) => !isIgnoredPath(ignoredPaths, pathOf(item)));
476
+ const items = result.items.filter(
477
+ (item) => !isIgnoredPath(ignoredPaths, pathOf(item), hostIsWindows),
478
+ );
479
if (
480
items.length >= pageSize ||
481
result.items.length >= result.totalMatched ||
@@ -512,7 +521,7 @@ export const make = Effect.fn("WorkspaceSearchIndex.make")(function* (
521
cause,
522
}),
523
).pipe(Effect.catchTags({ WorkspaceSearchIndexScanTimedOut: () => Effect.void }));
515
- ignoredPaths = yield* listGitIgnoredPaths(vcsProcess, cwd);
524
+ ignoredPaths = yield* listGitIgnoredPaths(vcsProcess, cwd, hostIsWindows);
525
});
526
527
const list: WorkspaceSearchIndex["Service"]["list"] = Effect.fn("WorkspaceSearchIndex.list")(
@@ -625,7 +634,7 @@ export const make = Effect.fn("WorkspaceSearchIndex.make")(function* (
634
}
635
636
for (const match of result.items) {
628
- if (isIgnoredPath(ignoredPaths, match.relativePath)) continue;
637
+ if (isIgnoredPath(ignoredPaths, match.relativePath, hostIsWindows)) continue;
638
const matchRanges = mapContentMatchRanges(match.lineContent, match.matchRanges).filter(
639
(range) => !input.wholeWord || isWholeWordRange(match.lineContent, range),
640
);