Problem#
While the content index is building, put é 😀 prefixedhit hit_suffix hit in a project file and search Project Content Search for hit\b with Use regular expression and Match whole word enabled. The line should appear and highlight the final hit. The Git fallback kept only the first match's column and found the next hit inside hit_suffix, which the regex had skipped. The whole-word filter dropped the line. With the filter off, the fallback highlighted the skipped occurrence.
Change#
Git 2.55 and later supply each match's byte column. The fallback uses those columns to locate matches and converts them to UTF-16 offsets. Older Git still locates later matches by text. If that leaves the whole-word check uncertain, the line can appear without a highlight. The decoding fallback for invalid UTF-8 and the full-line boundary checks from #43904 still apply.
Scope#
This changes the server's Git fallback and extends its existing warm-up test. The small bug reproduces with one line of text in a temporary repository, so the regression test serves as the reproduction.
Verification#
- The new assertion on
main @ ddc72ec5c9 failed with an empty result on Linux with Git 2.56.1 and 2.43.0.
pnpm exec vp test run src/workspace/WorkspaceSearchIndex.test.ts from apps/server passed 27/27 on each Git version. With 2.56.1 the test checks [28, 31) in whole-word mode and [13, 16) plus [28, 31) with the filter off. With 2.43.0 it checks that the whole-word result keeps the line with no highlight. The file also checks CRLF, invalid UTF-8, long lines and truncated range output.
- Vite+ format and lint checks passed for both changed files, with zero lint warnings or errors.
pnpm exec vp run --filter t3 typecheck exited 0.
- The service test exercises the warm-up path with real Git. The app UI was not exercised.
Written with GPT-6.2 Sol in Codex CLI, which ran the checks above.
The automated pipeline ran the reported steps in the real app without this change, and the problem did not appear. So it cannot show that this change fixes anything.
What was run on
e0661db2c8, the commit before this change:Seeded a git project containing regex-proof.txt with
é 😀 prefixedhit hit_suffix hit. Opened the web app, opened Command palette with Control+k, chose Search project contents, enteredhit\\b, enabled Match whole word and Use regular expression, waited for1 results in 1 files, captured the result, and checked the rendered line. Ran the same steps on base e0661db2c8 and head afd602bd30.How: Web scenario runner with T3CODE_DEV_SEED=0, synthetic git project, real app and browser, Replay dev provider was not needed after switching to the project root.
Closing this pull request. If you can share the exact steps, what you see, and the version and platform you are on, it can be reopened.