Repository navigation
fix(sections): deduplicate items within home rows - #928
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (5)
Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour. 📝 WalkthroughWalkthroughRecent TV queries can collapse repeated targets before counting and pagination. Section response construction also removes invalid and duplicate items within each section while retaining first occurrences and repairing safe totals. ChangesRecent TV target deduplication
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to The change deduplicates Recently Added TV targets and invalid or repeated section cards while preserving row boundaries and correcting counts. Focused coverage and reported repository checks support merge readiness. Sequence Diagram(s)sequenceDiagram
participant SectionsFetcher
participant RecentTVRepository
participant Database
participant buildSectionsResponse
SectionsFetcher->>RecentTVRepository: Request recent TV with UniqueTargets
RecentTVRepository->>Database: Count and page unique targets
Database-->>RecentTVRepository: Return deduplicated targets
RecentTVRepository-->>SectionsFetcher: Return recent TV items
SectionsFetcher->>buildSectionsResponse: Build section response
buildSectionsResponse->>buildSectionsResponse: Remove invalid and duplicate section items
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Problem
Related issue: #927
Home section responses must not contain the same non-empty
content_idmore than once within one row. Currentmaincan violate that invariant in Recently Added TV: the repository emits one card-producing event per scan run, so two multi-episode scan batches for the same series produce the same series card twice. Those duplicates can crash clients that usecontent_idas a keyed-list identity.The production report did not capture the affected section type. This change therefore fixes the deterministic current-source producer and adds a final response guard for every native section path.
Approach
LIMIT, orOFFSET, so duplicates do not consume page slots and the retained card keeps the newest playback anchor.Validation
The new regressions were confirmed failing before the implementation: the repository returned six events instead of five unique targets, and the response builder retained four keyed items instead of three.
Passed on the final diff:
Additional validation notes:
TestEpisodeSearchPostgresAndDocumentSource: PostgreSQL returned thesilo_recommendationsvector key with a nil value where the test expected no key. The focused PostgreSQL regression above and the normal full Go suite pass.make verify-settings-bindings-allverified the server binding, then could not run the unchanged web binding's formatting check becauseprettieris not installed in this worktree. The server-only verification above passes.Risks
If the response guard logs another producer, follow-up work should fix that producer so duplicates cannot consume its item limit before serialization.
Checklist
AI Disclosure
n/a); independent review subagents usedgpt-5.6-solwith high reasoning effortgpt-5.6-solhigh-reasoning subagent workstreams covered producer diagnosis, regression design, catalog/jellycompat/client compatibility, SQL and response-boundary correctness, and over-engineering. The complexity review identified a redundant page-local CTE chain, repeated SQL result projection, a one-use CTE, and an unnecessary slice return; all were removed or consolidated, cutting 76 net lines before the final test pass. The final staged-diff reviews found no unresolved correctness or complexity findings.Summary by CodeRabbit