From d02f035934ba22e80a4c980c115e8e3fac2c9db3 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 11 Nov 2026 18:25:29 +0000 Subject: [PATCH 1/2] test(server): workspace search matches square brackets literally Reproduces #34465: a path query containing '[' returns no entries. AI-assisted; verified with the tests and tools listed above. --- apps/server/src/workspace/WorkspaceEntries.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/server/src/workspace/WorkspaceEntries.test.ts b/apps/server/src/workspace/WorkspaceEntries.test.ts index b0633dac04cc7..9c3b2e18a74f0 100644 --- a/apps/server/src/workspace/WorkspaceEntries.test.ts +++ b/apps/server/src/workspace/WorkspaceEntries.test.ts @@ -457,6 +457,20 @@ it.layer(layerTest, { excludeTestServices: true })("WorkspaceEntries", (it) => { }), ); + it.effect("matches square brackets in the query literally", () => + Effect.gen(function* () { + const cwd = yield* makeTempDir({ prefix: "t3code-workspace-brackets-" }); + yield* writeTextFile(cwd, "src/app/game/[id]/index.tsx"); + + for (const query of ["game/[i", "game/[id]"]) { + const result = yield* searchWorkspaceEntries({ cwd, query, limit: 10 }); + expect(result.entries.map((entry) => entry.path)).toContain( + "src/app/game/[id]/index.tsx", + ); + } + }), + ); + it.effect("excludes gitignored paths for git repositories", () => Effect.gen(function* () { const cwd = yield* makeTempDir({ prefix: "t3code-workspace-gitignore-", git: true }); From 4950f5596699f4b0a11616467373e5c4157d16e4 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 11 Nov 2026 19:19:59 +0000 Subject: [PATCH 2/2] fix(server): @ file search matches paths containing square brackets fff reads any query word containing '[' as a glob and offers no escape, so dynamic route folders like [id] never matched. Drop '[' before handing the query to fff; its subsequence fuzzy match still finds and ranks the bracketed path first. Fixes pingdotgg/t3code#34465 AI-assisted; verified with the tests and tools listed above. --- apps/server/src/workspace/WorkspaceSearchIndex.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/server/src/workspace/WorkspaceSearchIndex.ts b/apps/server/src/workspace/WorkspaceSearchIndex.ts index ecb8c6ba87a73..88ea0499e02d4 100644 --- a/apps/server/src/workspace/WorkspaceSearchIndex.ts +++ b/apps/server/src/workspace/WorkspaceSearchIndex.ts @@ -451,7 +451,10 @@ export const make = Effect.fn("WorkspaceSearchIndex.make")(function* ( const search: WorkspaceSearchIndex["Service"]["search"] = Effect.fn( "WorkspaceSearchIndex.search", - )(function* (query, limit, kind, imageOnly) { + )(function* (rawQuery, limit, kind, imageOnly) { + // fff parses any word containing "[" as a glob and has no escape for it; fuzzy + // matching is subsequence-based, so dropping "[" still matches "[id]" folders. + const query = rawQuery.replaceAll("[", ""); const pageSize = imageOnly ? WORKSPACE_INDEX_PAGE_SIZE : Math.max(1, limit + 1); const incompleteBeforeQuery = hasIncompleteInitialScan(); if (kind === "file" || imageOnly) {