WPB-22877: Allow filtering for type (regular, app) in /search/contacts - #4986
Conversation
becb0ef to
f2e40d5
Compare
f2e40d5 to
45ca48c
Compare
fisx
left a comment
There was a problem hiding this comment.
i think this integration test and implementation are "complete" (no more TODOs), just need to make it bug-free now.
8825c00 to
04a71c2
Compare
battermann
left a comment
There was a problem hiding this comment.
There is still a question mark. and I understand that it's about how to treat a missing user type filter locally. So given this gets resolved, I approve this PR.
There was a problem hiding this comment.
Pull request overview
Adds support for filtering /search/contacts results by user type (e.g. regular, app) and propagates this filter through local search, ElasticSearch queries, and federated search.
Changes:
- Introduces
UserTypeFilterand exposes it as an optionaltypequery parameter onGET /search/contacts. - Applies the user-type filter in ElasticSearch-backed search as well as federated exact-handle search paths.
- Updates/extends integration + unit tests and adds a changelog entry for the API change.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| services/brig/test/integration/API/Federation.hs | Updates federation integration tests to pass the new types field in SearchRequest. |
| services/brig/src/Brig/User/Search/SearchIndex.hs | Extends search settings and ES query construction to restrict results by user type. |
| services/brig/src/Brig/API/Public.hs | Extends the public /search/contacts handler to accept and forward type filters. |
| services/brig/src/Brig/API/Federation.hs | Extends federated search request handling and applies filtering for exact-handle results. |
| libs/wire-subsystems/test/unit/Wire/UserSubsystem/InterpreterSpec.hs | Updates unit test calls to include the new mTypes parameter. |
| libs/wire-subsystems/test/unit/Wire/MockInterpreters/IndexedUserStore.hs | Extends the mock interpreter interface for search to accept mTypes. |
| libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs | Threads mTypes through local and remote search paths (including federated client calls). |
| libs/wire-subsystems/src/Wire/UserSubsystem.hs | Extends UserSubsystem.SearchUsers effect to include optional type filters. |
| libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs | Adds ES query restriction for user type and threads mTypes through search query builders. |
| libs/wire-subsystems/src/Wire/IndexedUserStore.hs | Extends IndexedUserStore.SearchUsers effect to include optional type filters. |
| libs/wire-api/src/Wire/API/User/Search.hs | Introduces UserTypeFilter parsing/encoding and conversion helpers. |
| libs/wire-api/src/Wire/API/Routes/Public/Brig.hs | Adds the type query parameter and documents its “omitted/empty means no filtering” semantics. |
| libs/wire-api-federation/test/Test/Wire/API/Federation/API/BrigSpec.hs | Updates golden/roundtrip tests for the federated SearchRequest shape change. |
| libs/wire-api-federation/src/Wire/API/Federation/API/Brig.hs | Extends federated SearchRequest with types :: Maybe [UserTypeFilter]. |
| integration/test/Testlib/Assertions.hs | Changes shouldMatchSet behavior to ignore duplicates (via nub). |
| integration/test/Test/Search.hs | Adds integration coverage for federated search with user-type filtering. |
| integration/test/API/Brig.hs | Adds a helper to call /search/contacts with optional type query parameter. |
| changelog.d/1-api-changes/WPB-22877-filter-user-search-by-type | Documents the new type filter parameter for /search/contacts. |
| Makefile | Changes ci-safe behavior (now runs integration only). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
blackheaven
left a comment
There was a problem hiding this comment.
just some clarification to avoid confusion
https://wearezeta.atlassian.net/browse/WPB-22877
Checklist
changelog.d