Skip to content

WPB-22877: Allow filtering for type (regular, app) in /search/contacts - #4986

Merged
battermann merged 18 commits into
developfrom
WPB-22877-filter-user-search-by-type
Feb 4, 2026
Merged

WPB-22877: Allow filtering for type (regular, app) in /search/contacts#4986
battermann merged 18 commits into
developfrom
WPB-22877-filter-user-search-by-type

Conversation

@fisx

@fisx fisx commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

https://wearezeta.atlassian.net/browse/WPB-22877

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Jan 28, 2026
@fisx
fisx force-pushed the WPB-22877-filter-user-search-by-type branch 2 times, most recently from becb0ef to f2e40d5 Compare January 30, 2026 08:36
@fisx
fisx force-pushed the WPB-22877-filter-user-search-by-type branch from f2e40d5 to 45ca48c Compare January 30, 2026 12:30

@fisx fisx left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this integration test and implementation are "complete" (no more TODOs), just need to make it bug-free now.

@fisx
fisx force-pushed the WPB-22877-filter-user-search-by-type branch from 8825c00 to 04a71c2 Compare January 30, 2026 16:14
Comment thread integration/test/Test/Search.hs Outdated
Comment thread libs/wire-api/src/Wire/API/User.hs Outdated
Comment thread libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs Outdated
Comment thread libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs Outdated
Comment thread services/brig/src/Brig/API/Federation.hs Outdated
@battermann
battermann marked this pull request as ready for review February 2, 2026 12:50
@battermann
battermann requested review from a team as code owners February 2, 2026 12:50
@battermann
battermann self-requested a review February 2, 2026 12:50

@battermann battermann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@battermann battermann changed the title WPB-22877: Allow filtering for type (regular, app, bot) in /search/contacts WPB-22877: Allow filtering for type (regular, app) in /search/contacts Feb 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 UserTypeFilter and exposes it as an optional type query parameter on GET /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.

Comment thread libs/wire-api/src/Wire/API/User/Search.hs Outdated
Comment thread services/brig/src/Brig/User/Search/SearchIndex.hs Outdated
Comment thread services/brig/src/Brig/API/Public.hs Outdated
Comment thread changelog.d/1-api-changes/WPB-22877-filter-user-search-by-type Outdated
Comment thread libs/wire-subsystems/test/unit/Wire/MockInterpreters/IndexedUserStore.hs Outdated

@blackheaven blackheaven left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some clarification to avoid confusion

Comment thread integration/test/Test/Search.hs Outdated
@battermann
battermann merged commit bd72d1e into develop Feb 4, 2026
10 checks passed
@battermann
battermann deleted the WPB-22877-filter-user-search-by-type branch February 4, 2026 09:24
akshaymankar added a commit that referenced this pull request Mar 5, 2026
@akshaymankar akshaymankar mentioned this pull request Mar 5, 2026
2 tasks
akshaymankar added a commit that referenced this pull request Mar 5, 2026
akshaymankar added a commit that referenced this pull request Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants