Add first-class OPDS2 groups support to FeedData (PP-3675)#3100
Merged
jonathangreen merged 4 commits intomainfrom Mar 4, 2026
Merged
Add first-class OPDS2 groups support to FeedData (PP-3675)#3100jonathangreen merged 4 commits intomainfrom
jonathangreen merged 4 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3100 +/- ##
=======================================
Coverage 93.22% 93.23%
=======================================
Files 491 491
Lines 45336 45350 +14
Branches 6239 6243 +4
=======================================
+ Hits 42266 42282 +16
+ Misses 1984 1982 -2
Partials 1086 1086 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f1261ae to
a5adbf6
Compare
Group membership in grouped feeds was previously encoded as per-entry collection links, an OPDS1 convention that the OPDS2 serializer silently dropped. This makes group structure a first-class concept in FeedData by adding FeedEntryGroup, populated upstream in groups(). The OPDS1 serializer flattens groups into entries with collection links, while the OPDS2 serializer builds native PublicationsGroup objects.
2a5daad to
30583ff
Compare
Use Work.id (database PK) instead of id() (memory address) for entry lookup, coerce sublane display_name to str for consistency, make test helper a staticmethod, and tighten empty-group assertion.
Validates that when the same work is returned by multiple sublanes, it correctly appears in each corresponding FeedEntryGroup.
Feed._serialize now keeps all truthy collection fields and only falls back to priority-based selection when none are truthy. This lets the OPDS2 serializer pass all fields directly instead of conditionally building kwargs.
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.
Description
Add first-class group structure to
FeedDataso that the OPDS2 serializer can produce nativegroupsoutput for grouped feeds (e.g.,/groups).Previously, group membership was encoded as
rel="collection"links on individual work entries — an OPDS1 convention.Key changes:
FeedEntryGroupdataclass andentry_groupsfield toFeedDataOPDSAcquisitionFeed.groups()instead of populatingannotator.lanes_by_workentry_groupsinto entries withrel="collection"links (preserving existing behavior)PublicationsGroupobjects fromentry_groupsgroup_uri(),lanes_by_work, and_lanes_by_workfromLibraryAnnotatorannotate_work_entry()Motivation and Context
The
/groupsendpoint should return works organized by sublanes using the OPDS2groupsstructure, but was instead returning a flatpublicationsarray. This is because group information was only carried as per-entry collection links — a pattern that doesn't map to OPDS2. Making groups a first-class concept inFeedDataallows each serializer to handle them idiomatically.How Has This Been Tested?
test_exclude_by_work_idsand addedtest_groups_populates_entry_groupsfor the acquisition feedtest_group_uri_with_flattened_lane(method deleted)Checklist