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, 07:00 UTC
fix(server): project content search finds matches past a line's first 512 characters (#29167)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 3, 2026 at 01:34 UTC
8430db67328c15f92bdccc9fe56586e989402760
2 files changed
+25
-1
apps/server/src/workspace/WorkspaceEntries.test.ts
+23
@@ -675,6 +675,29 @@ it.layer(layerTest, { excludeTestServices: true })("WorkspaceEntries", (it) => {
675
}),
676
);
677
678
+ it.effect("keeps matches past the truncated part of a long line", () =>
679
+ Effect.gen(function* () {
680
+ const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-long-line-" });
681
+ yield* writeTextFile(cwd, "dist/app.min.js", `${"x".repeat(600)} needleSuffix\n`);
682
+
683
+ const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
684
+ const search = (wholeWord: boolean) =>
685
+ workspaceEntries.searchContents({
686
+ cwd,
687
+ query: "needle",
688
+ limit: 100,
689
+ caseSensitive: true,
690
+ wholeWord,
691
+ useRegex: false,
692
+ });
693
+
694
+ expect((yield* search(false)).matches).toEqual([
695
+ expect.objectContaining({ path: "dist/app.min.js", lineNumber: 1 }),
696
+ ]);
697
+ expect((yield* search(true)).matches).toEqual([]);
698
+ }),
699
+ );
700
+
701
it.effect("keeps answering from the live index when a refresh outlasts the scan wait", () =>
702
Effect.gen(function* () {
703
const cwd = yield* makeTempDir({ prefix: "t3code-workspace-content-refresh-" });
apps/server/src/workspace/WorkspaceSearchIndex.ts
+2
-1
@@ -505,7 +505,8 @@ export const make = Effect.fn("WorkspaceSearchIndex.make")(function* (
505
const matchRanges = mapContentMatchRanges(match.lineContent, match.matchRanges).filter(
506
(range) => !input.wholeWord || isWholeWordRange(match.lineContent, range),
507
);
508
- if (matchRanges.length === 0) continue;
508
+ // fff reports hits past its 512-char lineContent cap with no ranges, so whole words can't be verified there.
509
+ if (input.wholeWord && matchRanges.length === 0) continue;
510
matches.push({
511
path: toPosixPath(match.relativePath),
512
lineNumber: match.lineNumber,