Reports · Issue #7274

#7274 · Unicode query casing changes path recall

2026-11-09 · Bug · Priority: Medium · Effort: Low · Area: ui
Trusted base: 55135d1e5045d6c5d3c24f5a4d5556ed3e11cb00

REPRODUCED · Root-cause confidence: high · Reproduction label: confirmed-repro

1. Summary

The path matcher used by workspace mentions loses lowercase Cyrillic filenames when the query contains an uppercase Cyrillic letter. A synthetic candidate, notes/drafts/журнал.md, is found for журнал, but not for Журнал, жУрнал, or ЖУРНАЛ. This happens in plain queries, exact directory-prefix queries, and structured directory queries. Two separately installed clean checkouts reproduce the same five failing assertions with six passing controls.

The mechanism is the path matcher's explicit smart-case policy, not an indexing or filesystem failure. ASCII uppercase exhibits the same exclusion. Generic text matching is explicitly case-insensitive and does retain the same Cyrillic candidate. Choosing to remove path smart-case altogether or to change its Unicode trigger is a product-policy decision; this report does not silently make that choice.

2. Claims and findings

ClaimFindingEvidence
Uppercase Cyrillic can hide lowercase filenames.VerifiedFive failing case-recall assertions in both clean runs.
The failure belongs to the path matcher.Verified at the matcher boundaryThe same isolated candidate is present in every invocation; only query casing changes.
Text search can find the same candidate.Verified at the shared text-matcher boundaryfuzzyMatchText returns the candidate for Журнал.
This is uniquely a non-Latin problem.Not supportedJournal also excludes notes/journal.md; journal finds it.
The ASCII prefilter causes the miss.Ruled outNon-ASCII query needles bypass that prefilter before reaching path ranking.
Other scripts and a particular macOS UI or server response behave identically.Not testedNo browser, HTTP endpoint, macOS installation, real vault, or other script was exercised.

3. Environment and isolation

4. Repeatable reproduction

Use a fresh checkout of the recorded commit. Save the complete inline regression probe from this report as /tmp/issue-7274.test.ts, then copy it into the checkout as shown below. The test was written from trusted repository interfaces and synthetic data, not copied from issue code.

git clone https://github.com/get-bb/bb.git bb-7274
cd bb-7274
git checkout --detach 55135d1e5045d6c5d3c24f5a4d5556ed3e11cb00
pnpm install --frozen-lockfile --prefer-offline
cp /tmp/issue-7274.test.ts packages/fuzzy-match/test/issue-7274.test.ts
pnpm exec turbo run test --filter=@bb/fuzzy-match -- test/issue-7274.test.ts

Expected case-recall contract: all eight Cyrillic path queries retain notes/drafts/журнал.md. Actual: the five queries containing uppercase Cyrillic return []. The three lowercase Cyrillic queries, lowercase ASCII control, ASCII smart-case exclusion control, and text-matcher control pass.

QueryActual path result
журналCandidate retained
Журнал, жУрнал, ЖУРНАЛNo result
notes/drafts/журнал, drafts/журналCandidate retained
notes/drafts/Журнал, drafts/ЖурналNo result
Tests  5 failed | 6 passed (11)
AssertionError: expected [] to deeply equal [ 'notes/drafts/журнал.md' ]
Exit status: 1, expected because this probe asserts the reported desired recall.

For existing coverage without the added contract assertions:

pnpm exec turbo run test --filter=@bb/fuzzy-match -- test/index.test.ts
Tests  32 passed (32)
Exit status: 0

5. Root cause

  1. The host's listed-path ranking adapter delegates to fuzzyMatchPaths.
  2. Plain path ranking explicitly requests casing: "smart-case". An uppercase Cyrillic query switches the installed fzf dependency to case-sensitive matching, so it cannot match the lowercase synthetic candidate.
  3. The same option is used for structured segments and exact-directory-prefix tails. Changing only plain matching would leave inconsistent recall or ranking between query forms.
  4. The repository's own comparison helper likewise preserves case whenever query !== query.toLowerCase(). This is not solely dependency behavior.
  5. Candidate prefiltering returns no ASCII needle for a Cyrillic query; candidate collection therefore keeps the supplied item. It is subsequently rejected during ranking.
  6. Text ranking explicitly uses case-insensitive, explaining the passing text control. The fzf implementation is an npm dependency declared by this package, not a vendored matcher implementation in the host file.

6. Fix proposal and automatic-fix safety

First choose whether path search should be case-insensitive for every query or retain ASCII smart-case while treating non-ASCII uppercase differently. Both address the demonstrated recall problem, but they are different user-visible policies. The latter must explicitly define mixed-script queries. Then apply the chosen policy consistently to plain matching, structured segments, exact-prefix tails, and path comparison/ranking helpers. Extend the regression table to cover uppercase directory names, reverse case direction, and mixed-script queries.

No automatic pull request: the verified behavior is the existing explicit smart-case policy, including ASCII. Selecting a replacement requires a product-policy decision, which fails the rule's no-product-decision simple-fix condition. No production patch was applied, committed, or pushed. The failing regression probe is published as evidence only, not as a proposed passing test suite.

7. Pull requests and related evidence

No linked open pull request appeared in issue timeline metadata; an open-PR search for the numeric issue also returned none. No pull request branch or code was executed. Existing test/index.test.ts covers lowercase Unicode and mixed-case paths whose capitalization agrees with uppercase queries; those cases do not establish recall from uppercase input to a lowercase-only candidate.

8. Verification

The same agent repeated the reproduction, without a workflow or additional agents. A second clean temporary clone, named verify separately from the first source clone, was checked out at the exact same base commit and was clean before adding the test. It received its own frozen install and only the same synthetic regression file. No production code, issue patch, linked branch, live instance, or shared application data was used.

pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run test --filter=@bb/fuzzy-match -- test/issue-7274.test.ts
Second run: 5 failed | 6 passed (11); exit 1.

The failing queries and assertions agree with the first run. No verdict correction was needed. All root-cause permalinks were checked against the recorded base. This is repeat verification by the same agent, not independent verification. The report establishes the matcher defect; it does not claim an end-to-end browser or HTTP reproduction.

9. Complete reproduction test

The complete test follows. Raw run logs remain outside the public repository; exact failure output and counts are included above.

import { describe, expect, it } from "vitest";
import { fuzzyMatchPaths, fuzzyMatchText } from "../src/index.js";

describe("issue 7274: path query case recall", () => {
  const path = "notes/drafts/журнал.md";

  it.each([
    "журнал",
    "Журнал",
    "жУрнал",
    "ЖУРНАЛ",
    "notes/drafts/журнал",
    "notes/drafts/Журнал",
    "drafts/журнал",
    "drafts/Журнал",
  ])("retains the lowercase path for %s", (query) => {
    expect(
      fuzzyMatchPaths({
        items: [path],
        query,
        getPath: (item) => item,
        limit: 16,
      }).map((match) => match.item),
    ).toEqual([path]);
  });

  it("keeps a lowercase ASCII control discoverable", () => {
    expect(
      fuzzyMatchPaths({
        items: ["notes/journal.md"],
        query: "journal",
        getPath: (item) => item,
        limit: 16,
      }).map((match) => match.item),
    ).toEqual(["notes/journal.md"]);
  });

  it("also excludes lowercase ASCII paths for uppercase queries", () => {
    expect(
      fuzzyMatchPaths({
        items: ["notes/journal.md"],
        query: "Journal",
        getPath: (item) => item,
        limit: 16,
      }),
    ).toEqual([]);
  });

  it("retains the same Cyrillic candidate through text matching", () => {
    expect(
      fuzzyMatchText({
        items: [path],
        query: "Журнал",
        getText: (item) => item,
        limit: 16,
      }).map((match) => match.item),
    ).toEqual([path]);
  });
});

The first frozen install succeeded. The initial full Turbo build encountered an unbuilt SDK runtime prerequisite. Building the existing SDK with pnpm exec turbo run build --filter=@get-bb/plugin-sdk, then repeating pnpm exec turbo run build, succeeded: 73 tasks successful. No dependency or lockfile change was needed. Generated build output was not used as a code change.

Untrusted-data handling: issue content and suggestions were treated only as claims. No issue-provided command, script, patch, external link, or linked pull request was run. All exercised production code came from trusted main. Synthetic filenames avoid exposing the reporter's private workspace. No visual evidence is included because the tested defect is a deterministic matching result, not a rendering defect.

> AGENT GENERATED