Repository navigation
fix(customers): normalize formatted phone queries in customer list search - #433
Merged
Merged
Conversation
Contributor
Greptile SummaryThe PR fixes customer-list searches so formatted phone numbers are matched using normalized digits while digit-bearing names and emails no longer overmatch phone records.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| main/routes/customers.ts | The search classification now preserves formatted-phone matching while resolving the previously reported mixed-query overmatch. |
| tests/phone-search-integration.test.ts | Integration coverage verifies formatted phone lookup, digit-bearing name and email behavior, pagination, sorting, and active filtering. |
Reviews (2): Last reviewed commit: "fix(customers): avoid phone overmatching..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Normalize formatted phone queries in the customer list search so admins can find customers by pasted phone numbers without breaking name, email, pagination, sorting, or active filtering.
What Changed
phone_digits, so formatted numbers like+1 (555) 123-4567or555-123-4567now find the matching customerphone_digitsLIKE clause entirely when the search contains no digits, preventing false matches on pure text queriesRisk Assessment
✅ Low: Minimal, well-scoped change that strips non-digits from the search term before matching against the digits-only phone_digits column, while preserving raw text matching for name/email. The else branch for digit-free queries is a safe optimization that avoids a no-op LIKE against a digits-only column.
Testing
Phone-search integration test (36/36 pass) validates formatted phone normalization against the admin /customers?search= endpoint: stripped digits match phone_digits, while raw text matches name/email; pagination, sort order, and is_active filter preserved.
Evidence: phone-search-integration test run
36/36 passed, 0 failed — formatted phone queries (+1 (555) 123-4567, 555-123-4567, +91 98765-43210) match correctly; name, email, pagination, sorting, active filtering all intactPipeline
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.
node tests/run-electron-node-test.cjs tests/phone-search-integration.test.ts✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.