Skip to content

Add reverse-order sorting for lane facets (PP-3147)#3017

Merged
jonathangreen merged 2 commits intomainfrom
feature/reverse-order-sorting
Feb 3, 2026
Merged

Add reverse-order sorting for lane facets (PP-3147)#3017
jonathangreen merged 2 commits intomainfrom
feature/reverse-order-sorting

Conversation

@jonathangreen
Copy link
Member

Description

Add reverse-order sorting options to the OPDS feed facets. When a library enables a sort option (e.g., "Author"), both directions are now automatically available in feeds:

  • "Author (A-Z)" - ascending order (original behavior)
  • "Author (Z-A)" - descending order (new reverse variant)

Changes

  • Added new reverse order constants: ORDER_TITLE_DESC, ORDER_AUTHOR_DESC, ORDER_ADDED_TO_COLLECTION_ASC
  • Added ORDER_FACET_TO_REVERSE_VARIANT mapping to automatically pair base facets with their reverse variants
  • Updated facet_groups property to yield reverse variants alongside base facets
  • Updated display titles to clarify sort direction (e.g., "Title (A-Z)", "Title (Z-A)")
  • Added OpenSearch and database field mappings for the new variants

Motivation and Context

We have designs that include reverse-order sorting for lanes, but this was not previously supported in the backend. This change enables patrons to sort lanes in either direction without requiring additional library configuration or significant client-side changes.

How Has This Been Tested?

  • Added comprehensive unit tests in tests/manager/feed/facets/test_reverse_order.py
  • Updated existing tests in tests/manager/feed/facets/test_feed.py
  • All 309 feed tests pass
  • mypy type checking passes

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@jonathangreen jonathangreen added the feature New feature label Jan 30, 2026
@jonathangreen jonathangreen marked this pull request as draft January 30, 2026 20:09
@jonathangreen jonathangreen changed the base branch from main to chore/facets-strict-typing January 30, 2026 20:10
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.01%. Comparing base (91a5fe4) to head (409ac17).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/palace/manager/feed/facets/feed.py 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3017   +/-   ##
=======================================
  Coverage   93.01%   93.01%           
=======================================
  Files         481      481           
  Lines       43607    43625   +18     
  Branches     6058     6063    +5     
=======================================
+ Hits        40561    40578   +17     
- Misses       1969     1970    +1     
  Partials     1077     1077           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from chore/facets-strict-typing to main February 2, 2026 17:13
@jonathangreen jonathangreen force-pushed the feature/reverse-order-sorting branch 2 times, most recently from 26b6c2b to b92188b Compare February 2, 2026 19:06
When a library enables a sort option (e.g., Author), both directions
are now automatically available in feeds:
- "Author (A-Z)" - ascending (original)
- "Author (Z-A)" - descending (new reverse variant)

This allows patrons to sort lanes in reverse order without requiring
additional library configuration or significant client-side changes.
@jonathangreen jonathangreen force-pushed the feature/reverse-order-sorting branch from b92188b to ef5ecd4 Compare February 3, 2026 13:38
@jonathangreen jonathangreen requested a review from a team February 3, 2026 14:15
@jonathangreen jonathangreen marked this pull request as ready for review February 3, 2026 14:15
Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

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

This looks good! 🥇

@jonathangreen jonathangreen merged commit 4db0f96 into main Feb 3, 2026
19 checks passed
@jonathangreen jonathangreen deleted the feature/reverse-order-sorting branch February 3, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants