Repository navigation
fix(orders): keep FTS search candidates a superset of Unicode queries - #1262
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@greptileai review this at plus |
[Medium impact] The PR appears safe to merge; both previous findings are fixed and no new actionable issues were found.
|
|
@greptileai review this at plus |
Fixes #1256
Intent
Fix finding N4 (GitHub issue #1256) in FreeOpenSourcePOS/FloCafe: in
GET /api/orders(main/routes/orders.ts), keep SQLite FTS5 trigram search candidates a strict superset of authoritative JavaScriptorders_search_containsmatches by restrictinghasFtscandidate pre-filtering to printable ASCII queries of length >= 3 that cannot fold across Turkish dotted capitalİ(/^[\x20-\x7E]+$/.test(search) && !/[iI]$/.test(search) && search.length >= 3) and using the existingudfClausefallback for non-ASCII Unicode queries (such as GeorgianაბგmatchingᲐᲑᲒand Turkish decomposedi\u0307stmatchingİstanbul) and trailing-i/Iqueries (such as"ali"matching"ALİ"), while preserving the FTS5 trigram fast path for ASCII order, customer, and phone searches.What Changed
GET /api/ordersFTS search candidate pre-filtering to printable ASCII queries of length >= 3 that do not end iniorI.i/Ito the SQLite UDF fallback to preserve case-folded matches across Turkish and Georgian scripts.tests/orders-search-api.test.tsverifying order number and customer name searches for Georgian case variants, Turkish decomposed characters, and trailing-iqueries.Risk Assessment
✅ Low: The change is minimal, surgical, and directly implements the authorized user intent by restricting FTS candidate pre-filtering to ASCII queries not ending in 'i'/'I' while delegating Unicode queries to the authoritative UDF search fallback.
Testing
Exercised the live Express API on port 3001 and the automated test suite for
GET /api/orderssearch functionality across 7 targeted scenarios: non-ASCII Georgian Mtavruli/Mkhedruli queries, Turkish decomposed lowercase queries matching uppercase dotted capital İ, trailing ASCII i/I queries routed to UDF fallback to avoid FTS5 case folding mismatches, non-ASCII order number searches, ASCII FTS5 trigram fast-path queries (orders, customer names, and phone digits), adversarial trailing-i vs non-i routing, and short/control-character query boundaries. All live scenarios and test suites passed with HTTP 200 responses and verified order matches without regressions.Evidence: Live HTTP validation run log
Evidence: Live scenarios summary JSON
Evidence: Scenario 1 Georgian script search result
Evidence: Scenario 2 Turkish decomposed query search result
Evidence: Scenario 3 Turkish trailing-i query search result
Evidence: Scenario 4 Non-ASCII order number searches result
Evidence: Scenario 5 ASCII FTS5 trigram fast-path query result
Evidence: Scenario 6 Trailing-i vs non-i boundary check result
Evidence: Scenario 7 Short and control character boundary check result
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm run test:orders-search(includestests/orders-search.test.ts,tests/orders-search-api.test.ts, andtests/orders-search-performance.test.ts)Live scenario driverdrive_scenarios.jsagainst standalone HTTP Express server on port 3001 with isolated SQLite test database✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.