Skip to content

fix(web): use locale-independent lowercase in search matching#80

Merged
wolfiesch merged 1 commit into
LycaonLLC:mainfrom
dylantirandaz:fix/locale-insensitive-search
Jul 19, 2026
Merged

fix(web): use locale-independent lowercase in search matching#80
wolfiesch merged 1 commit into
LycaonLLC:mainfrom
dylantirandaz:fix/locale-insensitive-search

Conversation

@dylantirandaz

@dylantirandaz dylantirandaz commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

What this changes

Case-insensitive search in the web app used String.prototype.toLocaleLowerCase(), which is locale-sensitive. Under Turkish/Azeri locales, 'IMAGE'.toLocaleLowerCase() produces 'ımage' (dotless ı), so an uppercase ASCII query silently fails to match lowercase text.

This replaces toLocaleLowerCase() with the locale-independent toLowerCase() at all seven search-matching call sites:

  • apps/web/src/features/transcript-search/model.ts (plainTextHighlightSegments)
  • apps/web/src/features/transcript-search/fixtures.ts (fixture search matching)
  • apps/web/src/lib/session-tree.ts (rail session search)
  • apps/web/src/features/settings/SettingsWorkspace.tsx (settings search)

A repo-wide grep confirms these are the only toLocaleLowerCase() occurrences, so none were left behind. Also updates the reference-only provenance checksum for apps/web/src/lib/session-tree.ts (required by check-provenance).

Regression tests in apps/web/test/transcript-search.test.tsx and apps/web/test/session-tree.test.ts stub String.prototype.toLocaleLowerCase to simulate a Turkish locale (Iı, restored in afterEach) and assert that uppercase queries (IMAGE, PAGINATION) still match lowercase text.

Verification

  • pnpm --filter @t4-code/web test — 71 files, 997 tests, all pass.
  • Pre-fix proof: stashed only the four source files and re-ran the two touched test files — exactly the two new tests failed (transcript search model > matches uppercase ASCII queries under a Turkish locale and buildProjectGroups > matches uppercase ASCII queries under a Turkish locale); restored the fix and both pass.
  • pnpm check passes (release consistency, provenance 0 failures, lint --deny-warnings, typecheck).
  • Full pnpm test: the only failure is the pre-existing packages/client test/transcript-retention.test.ts ("keeps the newest contiguous suffix under count, entry, and cumulative bytes"), which also fails on unmodified main and is unrelated to this PR.

Checklist

  • pnpm check passes (release contract, provenance, lint, typecheck)
  • pnpm test passes; new behavior has a test that fails without this change
  • Any pasted logs or screenshots are redacted: no secrets, tokens, pairing codes, or private paths
  • Ported code (T3 Code / OMP) follows the provenance rules in THIRD_PARTY_NOTICES.md

@wolfiesch
wolfiesch force-pushed the fix/locale-insensitive-search branch 2 times, most recently from 315a7de to c147b00 Compare July 19, 2026 22:38
Case-insensitive search used String.prototype.toLocaleLowerCase().
Under Turkish/Azeri locales, 'IMAGE'.toLocaleLowerCase() yields
'ımage' (dotless ı), so uppercase ASCII queries silently fail to
match lowercase text. Switch the seven search-matching call sites to
toLowerCase(), which is locale-independent:

- transcript search highlight segments (model.ts)
- transcript search fixture matching (fixtures.ts)
- rail session search (session-tree.ts)
- settings workspace search (SettingsWorkspace.tsx)

Add regression tests that stub toLocaleLowerCase to simulate a
Turkish locale and assert uppercase queries still match; both fail
without this change. Update the provenance checksum for the
reference-only tracked session-tree.ts.
@wolfiesch
wolfiesch force-pushed the fix/locale-insensitive-search branch from c147b00 to 06e125b Compare July 19, 2026 22:45
@wolfiesch
wolfiesch merged commit 7533ad2 into LycaonLLC:main Jul 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants