[ITEM-189] WP-1987-sort-insensitive#247
Merged
wazo-community-zuul[bot] merged 17 commits intomasterfrom Mar 18, 2026
Merged
Conversation
why: improve readability and prepare next change
why: since rows is already a list, we can use slice directly
Since default implementation is provide expected behavior for personal, to more code is required
This is only a safeguard: DB allow None value, but not API
why: to add some logic in get sort in next commits
why: avoid breaking code when ListSchema from lib-python add a new field
Sorting logic was duplicated between BaseDAO and SelfSortingServiceMixin. Using a single implementation avoids divergence and brings NFKD normalization to all backends using the mixin.
_apply_pagination_params and order_insensitive are no longer used since personal contacts now sort via SelfSortingServiceMixin.
why: half of usage was done through "true" mixin, others were used through static method
NFKD decomposes accented characters into base + combining marks
(e.g. 'Ä' → 'A' + U+0308), but the combining mark has a high
codepoint so accented names still sort after all ASCII names —
the opposite of the intended behavior.
unidecode strips diacritics entirely ('Ä' → 'A'), which correctly
groups accented names with their base letter. This matches the
behavior introduced in 2016 (commit 69bcbc2) specifically to fix
sort order with accentuated characters in the phonebook.
Contributor
|
Build succeeded. ✔️ tox-linters SUCCESS in 3m 33s |
DrPyser
approved these changes
Mar 18, 2026
Contributor
DrPyser
left a comment
There was a problem hiding this comment.
LGTM, E2E tested (WDA) on personal, phonebook, google (logic should be the same for office365).
WDA-level sorting is still accent-sensitive, to be addressed separately.
Contributor
|
Build succeeded (gate pipeline). ✔️ tox-linters SUCCESS in 3m 18s |
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.
Depends-on: wazo-platform/xivo-lib-python#176
Note
Medium Risk
Changes core in-memory sorting/pagination paths for multiple backends (personal, phonebook, Google, Office365, profiles), which could alter ordering and pagination behavior in production listings. Risk is moderate because logic is centralized and covered by updated unit/integration tests, but it affects many list endpoints.
Overview
Introduces a shared
sort_contactshelper (accent-folding viaunidecode, optional case-insensitive ordering, and safe handling of missing/Nonevalues) and removes the oldSelfSortingServiceMixin/BaseDAO in-memory sorting logic.Updates personal contact listing to use the new sorting + simplified slicing for pagination (with explicit invalid
orderdetection), and wires the new sorter into backend/profile services plus phonebook contact listing (also passing list params explicitly).Enables case-insensitive sorting for selected contact list endpoints by adding
sort_insensitive_columnsto Google, Office365, phonebook, and phonebook-backend schemas, and adjusts/adds integration tests to validate the new ordering (including a new phonebook HTTP case-insensitive sort test). Also makes SQLAlchemyechologging configurable in integration tests viaDB_ECHO.Written by Cursor Bugbot for commit 7d40a82. This will update automatically on new commits. Configure here.