Skip to content

Conversation

@battermann
Copy link
Contributor

@battermann battermann commented Nov 21, 2025

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

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 Nov 21, 2025
@battermann battermann marked this pull request as ready for review November 21, 2025 09:12
@battermann battermann requested review from a team as code owners November 21, 2025 09:12
@battermann battermann requested a review from Copilot November 21, 2025 09:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the channel search endpoint (GET /teams/:tid/channels/search) to sort results case-insensitively. Previously, channels were sorted alphabetically with case sensitivity (e.g., "Apple" before "banana"), which created inconsistent ordering. The fix ensures that sorting treats uppercase and lowercase letters equivalently (e.g., "Apple" and "apple" sort together alphabetically).

Key Changes

  • Modified PostgreSQL queries to use lower(name) in ORDER BY clauses for case-insensitive sorting
  • Updated pagination cursor logic to apply Text.toLower for consistent case-insensitive comparisons
  • Added a database index on (team, group_conv_type, lower(name), id) to optimize the case-insensitive queries
  • Refactored test helper to extract common channel configuration setup
  • Added comprehensive integration test validating ascending and descending case-insensitive sort order

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
libs/wire-subsystems/src/Wire/ConversationStore/Postgres.hs Modified searchConversationsImpl to use lower(name) in ORDER BY clauses (both inner CTE and outer query) and updated pagination cursor comparison to use Text.toLower for consistency
libs/wire-subsystems/postgres-migrations/20251121090452-conversation_team_group_type_lower_name_id_idx.sql Created database index on (team, group_conv_type, lower(name), id) to support efficient case-insensitive channel search queries
integration/test/Test/ChannelSearch.hs Extracted channel config setup into a reusable helper function and added testChannelSearchSortCaseInsensitive test to verify case-insensitive sorting works correctly in both ascending and descending order
changelog.d/3-bug-fixes/WPB-21917 Added changelog entry documenting the bug fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@supersven supersven left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@battermann battermann merged commit 9f1541f into develop Nov 21, 2025
10 checks passed
@battermann battermann deleted the WPB-21917-get-teams-tid-channels-search-results-should-be-sorted-case-insensitive branch November 21, 2025 15:46
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.

4 participants