Skip to content

Conversation

@jonathangreen
Copy link
Member

@jonathangreen jonathangreen commented Jan 16, 2026

Description

Enhance the admin suppressed feed with:

  1. Policy-filtered works: Works hidden by library content filtering (audience/genre) now appear in the suppressed feed alongside manually suppressed works. Each work shows its visibility status as a category.

  2. Search functionality: Add /admin/suppressed/search endpoint with OpenSearch support for searching within hidden works. Includes SuppressedWorkFilter that inverts normal filter behavior to match only suppressed/filtered works.

  3. Visibility facets: Add facet links to filter by visibility status:

    • All: shows all hidden works (default)
    • Manually Hidden: shows only manually suppressed works
    • Policy Filtered: shows only works filtered by audience/genre settings

Policy-filtered works don't get suppress/unsuppress links since they are controlled by library settings rather than manual suppression.

With these changes, the feed looks like this in the Admin UI:
Screenshot 2026-01-16 at 12 48 48 PM

Motivation and Context

Admins need visibility into all hidden works, not just manually suppressed ones. This allows them to see which works are being filtered by library policy and search within the hidden works when there are many.

Implements PP-3525.

How Has This Been Tested?

  • Added comprehensive tests for new functionality
  • All existing tests pass

Checklist

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

@jonathangreen jonathangreen added the feature New feature label Jan 16, 2026
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 96.19565% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.94%. Comparing base (34a7c21) to head (3272ffd).

Files with missing lines Patch % Lines
src/palace/manager/search/external_search.py 75.00% 2 Missing and 4 partials ⚠️
src/palace/manager/feed/admin/suppressed.py 99.03% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2990      +/-   ##
==========================================
+ Coverage   92.93%   92.94%   +0.01%     
==========================================
  Files         453      453              
  Lines       42957    43120     +163     
  Branches     5989     6014      +25     
==========================================
+ Hits        39923    40079     +156     
- Misses       1966     1968       +2     
- Partials     1068     1073       +5     

☔ 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 bugfix/remove-load-work-filter-check to chore/rename-admin-feed-to-suppressed January 16, 2026 18:52
Base automatically changed from chore/rename-admin-feed-to-suppressed to main January 16, 2026 19:01
Enhance the admin suppressed feed with:

1. Policy-filtered works: Works hidden by library content filtering
   (audience/genre) now appear in the suppressed feed alongside manually
   suppressed works. Each work shows its visibility status category.

2. Search functionality: Add /admin/suppressed/search endpoint with
   OpenSearch support for searching within hidden works. Includes
   SuppressedWorkFilter that inverts normal filter behavior.

3. Visibility facets: Add facet links to filter by visibility status:
   - All: shows all hidden works (default)
   - Manually Hidden: shows only manually suppressed works
   - Policy Filtered: shows only works filtered by audience/genre

Policy-filtered works don't get suppress/unsuppress links since they
are controlled by library settings rather than manual suppression.
- Add detailed docstring to FacetGroup dataclass
- Document SuppressedWorkFilter's intentional use of subset of Filter properties
- Add route test for suppressed_search endpoint
Add tests to TestAdminSuppressedFeed that use the actual search index
to verify SuppressedWorkFilter correctly matches:
- Manually suppressed works
- Audience-filtered works (library policy)
- Genre-filtered works (library policy)
- Empty results when no suppressed works match
- Collection scoping to library's collections
- Navigation links in search results
Test the FeedController.suppressed_search method:
- Returns OpenSearch description document when no query provided
- Returns OPDS feed with search results when query provided
- Requires librarian authorization
- Returns empty feed when no results match
Test that pagination links are correctly generated:
- 'next' link appears when there might be more results
- 'first' and 'previous' links appear on later pages
End-to-end tests for pagination links:
- 'next' link when there might be more results
- 'first' and 'previous' links on later pages

Controller tests for error cases:
- Invalid pagination parameters return ProblemDetail
- Missing search engine configuration returns ProblemDetail
@jonathangreen jonathangreen force-pushed the feature/suppressed-feed-improvements branch from ee7c630 to 59b38cf Compare January 16, 2026 19:07
- Add helper methods to reduce code duplication:
  - links_for_rel: filter links by rel attribute
  - visibility_categories: extract visibility status categories
  - suppressed_search: execute search with common parameters
- Merge test_suppressed_feed_includes_facet_links and
  test_suppressed_feed_facet_links_reflect_current_filter into single test
- Parametrize query filter tests (all, manually-suppressed, policy-filtered)
- Update search tests to use the new suppressed_search helper
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