#7275 · Non-ASCII capitalization changes path search matching
Verdict: REPRODUCED · Root-cause confidence: high · Reproduction label: confirmed-repro
1. TL;DR
The workspace path matcher returns a lowercase Cyrillic filename for a lowercase query, but drops it when the same query is capitalized. The shared fuzzy matcher treats any Unicode uppercase character as a request for case-sensitive matching. The composer passes the query to that matcher without undoing this behavior, so changing capitalization can remove the desired mention candidate. A tiny in-memory path list reproduces the result without a vault, an index, a running server, or macOS. The same agent repeated the reproduction from a second clean checkout at the same trusted commit.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| Uppercase Cyrillic causes a lowercase path to disappear. | Verified | заметка returns docs/заметка.md; Заметка and заМетКа return no matches in both clean checkouts. |
| The cause lies in the path fuzzy matcher. | Verified | The daemon calls the shared fuzzyMatchPaths; its three matching branches and its prefix comparison use smart-case behavior. |
| This can also affect other scripts. | Verified for Greek only | Σημείωση does not match docs/σημείωση.md. Other scripts were not exercised. |
| The fzf implementation is vendored in the repository. | Refuted | The trusted package manifest declares the external fzf dependency; the installed version is 0.5.2. |
| The ASCII prefilter explains the missing Cyrillic candidate. | Not supported | The candidate prefilter returns no needle for a non-ASCII query and therefore does not eliminate these candidates. |
| General search and file navigation always find these files; a large macOS vault produces the reported API result counts and menu text. | Unverified | No reporter data, original installation, live HTTP route, or browser was used. The decisive shared matching boundary was tested directly instead. |
3. Environment
- Trusted public repository:
get-bb/bb, base commit shown above, fetched from origin/main. - Linux x86_64; Node v22.19.0; pnpm 9.15.0; Vitest 4.1.12; fzf 0.5.2.
- Two distinct temporary detached Git worktrees, each initially clean and at the exact base commit, with separate frozen-lockfile installs.
- No provider, runtime account, app process, port, or persistent data directory was required. All filename fixtures are synthetic.
4. Minimal reproduction
- Clone the trusted repository and select the base commit:
git clone https://github.com/get-bb/bb.git bb-7275 cd bb-7275 git checkout --detach 55135d1e5045d6c5d3c24f5a4d5556ed3e11cb00 pnpm install --frozen-lockfile --prefer-offline
- Save the following self-contained reproduction as
check.mjsat the checkout root. It imports the actual repository matcher; it does not reimplement matching:import assert from "node:assert/strict"; import path from "node:path"; import { pathToFileURL } from "node:url"; const { fuzzyMatchPaths } = await import( pathToFileURL(path.join(process.argv[2], "packages/fuzzy-match/src/index.ts")) ); const cases = [ ["docs/заметка.md", "заметка"], ["docs/заметка.md", "Заметка"], ["docs/заметка.md", "заМетКа"], ["docs/заметка.md", "docs/Заметка"], ["заметки/запись.md", "Заметки/"], ["docs/σημείωση.md", "Σημείωση"], ["docs/memo.md", "Memo"], ["docs/Memo.md", "Memo"], ]; const results = cases.map(([candidate, query]) => { const matches = fuzzyMatchPaths({ items: [candidate], query, getPath: (item) => item, limit: 16, }); return { candidate, query, matches: matches.map((match) => match.item) }; }); for (const result of results) { console.log(JSON.stringify(result)); } const capitalized = results[1]; assert.deepEqual(capitalized.matches, [capitalized.candidate]); - Run
node --import tsx check.mjs "$PWD". Expected: the capitalized Cyrillic query returns["docs/заметка.md"]and the assertion succeeds. Actual output in each clean checkout:{"candidate":"docs/заметка.md","query":"заметка","matches":["docs/заметка.md"]} {"candidate":"docs/заметка.md","query":"Заметка","matches":[]} {"candidate":"docs/заметка.md","query":"заМетКа","matches":[]} {"candidate":"docs/заметка.md","query":"docs/Заметка","matches":[]} {"candidate":"заметки/запись.md","query":"Заметки/","matches":[]} {"candidate":"docs/σημείωση.md","query":"Σημείωση","matches":[]} {"candidate":"docs/memo.md","query":"Memo","matches":[]} {"candidate":"docs/Memo.md","query":"Memo","matches":["docs/Memo.md"]} AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected + [] - [ - 'docs/заметка.md' - ] Exit status: 1
This is a functional matching reproduction, not a visual screenshot reproduction. Raw scripts and logs stay outside this public repository; the complete script and decisive output are embedded here per its publication policy.
5. Root cause
The composer’s mention hook hands the text to path suggestions. The project path query forwards it through the SDK. The server route forwards it to host.list_paths, and the daemon’s path finalization calls the shared matcher.
In plain query matching, Fzf is configured with casing: "smart-case". The installed fzf dependency implements that option by comparing the query to its Unicode lowercase form; the following excerpt was inspected in its installed distribution:
case "smart-case":
if (query.toLowerCase() !== query) {
caseSensitive = true;
}
break;
Therefore a capitalized Cyrillic query is case-sensitive even against a lowercase filename. This is not isolated to one instantiation: structured segment matching and exact directory-prefix matching use smart-case too. Comparable-value normalization also preserves the original case whenever any uppercase character occurs. Changing only the plain Fzf option would leave directory and ranking behavior inconsistent.
The candidate prefilter is conservative for non-ASCII inputs and does not cause this failure. The package manifest declares fzf as an external dependency, not a vendored implementation.
6. Proposed fix and tested candidate
Normalize query case once at the fuzzyMatchPaths boundary when the query contains no ASCII uppercase letter. This gives all path-matching and relevance-ranking branches the same lowercase query for the reported non-ASCII case, while retaining existing ASCII smart-case opt-in. Original paths and highlight positions are not rewritten. A query containing ASCII uppercase continues to request case-sensitive matching, including mixed-script queries; this deliberately avoids changing that existing behavior.
The candidate changes only the shared matcher and its existing test file: 42 changed text lines (41 additions + 1 deletion), 2 files. It adds no dependency, generated output, data change, public contract, or protocol field. Three parameterized regression cases exercise plain and structured Cyrillic queries and Greek capitalization; a fourth test preserves the ASCII smart-case control.
7. Verification
Second clean run: the same agent created a separate detached worktree at 55135d1e5045d6c5d3c24f5a4d5556ed3e11cb00, confirmed clean Git status, installed with the frozen lockfile, and ran the same script via node --import tsx /path/to/check.mjs "$PWD". It printed the same eight rows and failed the same assertion with exit 1. No ports or data directories were needed. This is a repeat by the same agent, not an independent reviewer. No report correction was needed.
| Check | Observed result |
|---|---|
Focused regression before production change:pnpm exec turbo run test --filter=@bb/fuzzy-match -- --testNamePattern='non-ASCII query casing|preserves ASCII smart-case' | 3 failed, 1 passed, 32 skipped; failure is the missing path for capitalized non-ASCII queries. |
After fix:pnpm exec turbo run test typecheck --filter=@bb/fuzzy-match | 36 tests passed; typecheck passed. |
Complete relevant existing daemon suites:pnpm exec turbo run test --filter=@bb/host-daemon -- src/command-handlers/file-list.test.ts src/command-handlers/workspace-path-list.test.ts | 32 tests passed across both suites. |
Additional daemon selection:pnpm exec turbo run test --filter=@bb/host-daemon -- --testNamePattern='file|path' | 116 tests passed, 755 skipped; not represented as the full daemon suite. |
| Standalone reproduction against fixed source | All non-ASCII examples match; ASCII controls are unchanged; exit 0. |
pnpm exec oxfmt --check packages/fuzzy-match/src/index.ts packages/fuzzy-match/test/index.test.tsgit diff --check | Both pass; diff contains only the two text files described above. |
The initial full pnpm exec turbo run build hit missing generated SDK distribution files on the pristine checkout. Running pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk followed by the full build completed successfully: 73 tasks successful. Unrelated tracked web route generation was restored and is not part of the fix.
8. Related issues
#7274 reports the same symptom. No open pull request linked to #7275 was found during the investigation. Neither issue text nor linked changes supplied executable code for this reproduction.
9. Appendix
All root-cause links above point to the recorded trusted base. Reproduction and fix were authored from repository evidence; suggested changes in the untrusted issue were not executed. The original user’s workspace, API counts, stable binary, macOS behavior, and general-search comparison were not validated. The in-memory reproduction eliminates filesystem enumeration and indexing as necessary causes of the demonstrated failure.
Key command sequence: fetch origin/main; create two detached worktrees; frozen installs; run the embedded script in each; create slopcop/issue-7275 from the latest trusted origin/main; add and run the failing regression; normalize query case; run the matcher suite, typecheck, existing daemon file-list suites, formatter, and diff checks. No application instance was started, so no runtime cleanup was required.