test(contacts): pin company search to substring ILIKE, not leading prefix #279

Merged
vas2000-work merged 1 commit from fix/pms-372-company-search-substring into main 2026-06-16 23:50:44 +02:00
Owner

PMS-372 reported that the company picker's GET /contacts/companies?q= matched only a leading prefix, so the exact full multi-word name and interior words returned zero rows. Investigation of the current backend shows list_companies already binds the search term as ILIKE %q% (src/modules/contacts/service.rs), which is a case-insensitive substring match, so the acceptance criteria are already met by the code; the reported prefix-only behaviour does not reproduce against main.

This adds a regression test covering all three acceptance criteria so the substring semantics cannot silently regress to a leading-prefix match: the exact full name (ZQA live), an interior word matched case-insensitively across multiple companies (live -> ZQA live and Acme Live Corp, excluding unrelated rows), and a leading prefix (ZQA) all return the expected companies. Verified passing against the dev Postgres.

#PMS-372

PMS-372 reported that the company picker's GET /contacts/companies?q= matched only a leading prefix, so the exact full multi-word name and interior words returned zero rows. Investigation of the current backend shows list_companies already binds the search term as ILIKE %q% (src/modules/contacts/service.rs), which is a case-insensitive substring match, so the acceptance criteria are already met by the code; the reported prefix-only behaviour does not reproduce against main. This adds a regression test covering all three acceptance criteria so the substring semantics cannot silently regress to a leading-prefix match: the exact full name (`ZQA live`), an interior word matched case-insensitively across multiple companies (`live` -> `ZQA live` and `Acme Live Corp`, excluding unrelated rows), and a leading prefix (`ZQA`) all return the expected companies. Verified passing against the dev Postgres. #PMS-372
test(contacts): pin company search to substring ILIKE, not leading prefix
All checks were successful
E2E / Playwright against staging (pull_request) Successful in 1m21s
Check / fmt + clippy + compile + unit/doc tests (pull_request) Successful in 3m59s
Integration / integration tests (pull_request) Successful in 8m50s
Create release / Create release from merged PR (pull_request) Has been skipped
6a16cf2bc9
PMS-372 reported that the company picker's GET /contacts/companies?q= matched only a leading prefix, so the exact full multi-word name and interior words returned zero rows. Investigation of the current backend shows list_companies already binds the search term as ILIKE %q% (src/modules/contacts/service.rs), which is a case-insensitive substring match, so the acceptance criteria are already met by the code; the reported prefix-only behaviour does not reproduce against main.

This adds a regression test covering all three acceptance criteria so the substring semantics cannot silently regress to a leading-prefix match: the exact full name (`ZQA live`), an interior word matched case-insensitively across multiple companies (`live` -> `ZQA live` and `Acme Live Corp`, excluding unrelated rows), and a leading prefix (`ZQA`) all return the expected companies. Verified passing against the dev Postgres.

#PMS-372
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!279
No description provided.