Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): message search keeps results when a short non-Latin word differs in case #30332

MergedMarcoDotIO(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/30332/headmerged by maria-rcks View on GitHub

Problem

Message search drops a thread when a short word in the query only appears in the message with different case or accents, if that word is not ASCII. Searching ошибка в does not find a message reading В логах ошибка, and fermée éc does not find École fermée à Lyon. The thread also disappears while typing: ошибка ло loses Логи: ошибка until the next letter makes the word long enough for the index.

Call path: the command palette, mobile search and t3_thread_search all reach searchMessages in ThreadSearch.ts. buildMessageSearch sends tokens shorter than three characters as substrings, and messageHitsQuery rejects a row when instr(lower(text), token) = 0. SQLite's lower() folds ASCII only, while messageSearchTokens lowercases with JavaScript, so в never equals В in SQL. messageMatcher, which ignores case and accents, never sees the row.

Change

buildMessageSearch now checks each non-ASCII short token against the case and accent spellings it can match (в as в or В, éc as éc, Éc, ec and so on), with or without the index. Short tokens are at most two characters, so that is at most 16 spellings. The check stays in SQL so these tokens still narrow hits before the hit limit, and messageMatcher still decides the final match. ASCII short tokens stay in SQL, because they are what keep a rare short word from being cut off by the hit limit.

Scope and approval

Small, focused fix of an obvious bug: one filter in one function plus a test. No contract, client or schema change.

Verification

Added ThreadSearch short words outside ASCII > finds them in any case or accent, with or without the index, which runs against real SQLite with the trigram index and again after dropping it.

Before the fix:

FAIL src/orchestration-v2/ThreadSearch.test.ts > ThreadSearch short words outside ASCII > finds them in any case or accent, with or without the index
AssertionError: expected [] to deeply equal [ 'thread:short-russian' ]
Tests  1 failed | 26 skipped (27)

After the fix, the whole file:

Test Files  1 passed (1)
     Tests  29 passed (29)

Targeted vp lint and vp fmt --check on apps/server/src/orchestration-v2 and tsc --noEmit in apps/server pass.

Not checked: a running client. This changes which results come back, not how they render.

A second test, narrows short words outside ASCII before the hit limit, puts 2,000 newer messages with only the long word ahead of an older message with both, with and without the index, and fails if the short word stops narrowing before the limit.

Not addressed: an ASCII short word against an accented letter (fermée ec for École) is still rejected in SQL. Letting those through would mean skipping the check for any message with a non-ASCII character, which weakens the narrowing the hit limit depends on. The next letter reaches the index, which folds accents.

Claude Opus 5.5 (Claude Code desktop app)

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at a00ca2a

      Macroscope's review found this PR approvable — Message search now preserves candidates when short non-Latin words differ in case. Final matching, visibility filters, and search limits remain unchanged, keeping the impact limited to search results.

      Notes:

      • Code review disabled. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review.

      Walkthrough

      Thread search now generates spelling alternatives for short non-ASCII query tokens and checks those alternatives in SQL. Tests cover matching across case and accent variations, absent terms, and older matching messages, both with and without the search index.

      Changes: Thread search matching

      Layer / File(s)Summary
      Short non-ASCII token filtering
      apps/server/src/orchestration-v2/ThreadSearch.ts
      Search requests now carry spelling alternatives for short non-ASCII tokens. Search construction separates those tokens from the existing substring filters, and SQL checks each token against its alternatives.
      Search matching and limit regressions
      apps/server/src/orchestration-v2/ThreadSearch.test.ts
      Tests cover Russian and French matches across case or accent variations, absent-token filtering, and an older Russian match despite 2,000 newer partial matches. The tests cover indexed and non-indexed searches.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Suggested labels: bugfix

      Suggested reviewers: t3dotgg, macroscopeapp

      Merge Risk: Minimal · up to 6c9fa

      The remaining narrow accent-search limitation predates this change. No new issue identified here prevents merging after normal checks.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title names the main change: message search keeps results when a short non-Latin word differs in case. The objectives and the raw summary confirm the change adds case and accent spellings for shor…
      Description checkPassedThe description follows the template sections (Problem, Change, Scope and approval, Verification). The Problem section gives the failing inputs, the call path, and the root cause. The Change section e…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title names the main change: message search keeps results when a short non-Latin word differs in case. The objectives and the raw summary confirm the change adds case and accent spellings for short non-ASCII tokens in the SQL filter. The title is specific and follows the conventional commit format, so it passes.

      Full details: Description check

      Explanation

      The description follows the template sections (Problem, Change, Scope and approval, Verification). The Problem section gives the failing inputs, the call path, and the root cause. The Change section explains the per-token spelling check and why ASCII short tokens stay in SQL. The Scope section gives a justification for a small obvious bug fix without a linked issue, which the template allows. The Verification section lists the new test, its failure before the fix, and passing results after the fix, plus what was not checked. The template asks for the model and harness used, and the description includes that. The description is mostly complete and passes.

      Finishing Touches
      Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      CodeRabbit Verify

      • Run CodeRabbit Verify to test the changes in this pull request.
      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between a00ca2ab008483f525d570e23a3ae509970ce7e9 and 6c9fa82fd2c3778da8d7894714ff5796ea80a0b8.

      Files selected for processing: 2
      • apps/server/src/orchestration-v2/ThreadSearch.test.ts
      • apps/server/src/orchestration-v2/ThreadSearch.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

      • Fix comments: Fix CodeRabbit comments on this PR
    4. maria-rckscommented

      Note

      Written by gpt-6.1-sol on behalf of Maria

      Verified in a real dev environment

      verified exact head 6c9fa82fd2c3778da8d7894714ff5796ea80a0b8 on linux using the dev web app, repository playwright, /usr/bin/google-chrome, and real codex gpt-6.1-sol turns through the local proxy. no code changes were needed.

      created the project and messages through the app. on github/main (7c22e24e3f), ошибка в and fermée éc returned no threads despite the matching messages. a separate thread disappeared at сбой ло and returned at сбой лог. stopped main's server, then ran this exact pr head against a copy of that dev state.

      on the pr, both russian and french searches return the matching thread. the result stays while typing сбой ло to сбой лог. sidebar and command-palette results open the correct thread with find highlighting. ошибка я still rejects the thread. a fresh codex turn completed on the pr, and its Riverbank message was searchable.

      main, russian search:

      main rejects the russian short token

      pr, same data and query:

      pr finds the russian short token

      main, french search:

      main rejects the french short token

      pr, same data and query:

      pr finds the french short token

      recording of typing retention, result navigation, command-palette search, and absent-word rejection. inspected the clip and verified uploaded playback and seeking:

      real search interactions on the pr

      focused checks ran through blacksmith: vp i && vp test run apps/server/src/orchestration-v2/ThreadSearch.test.ts, all 29 tests passed. these include indexed/fallback searches and filtering before the 2,000-hit limit. the inspected head also had 28 successful ci contexts, zero failing or pending.

      command and runtime transcript

      Not verified

      native ios/android, the electron shell, and multi-environment/relay/tunnel searches were not exercised on this linux vm. the real app dataset did not contain 2,000 partial matches, and i did not disable its fts index; those paths passed in the focused sqlite tests. the ascii-short-token/accent limitation already documented in the pr remains outside this fix.

    5. maria-rcks merged thisb800f99

    6. maria-rcks closed this

Sign in to join this conversation.