mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
The For You (personalized) and Trending tabs ranked strictly by tier/score and view count, which stacked a creator's whole back-catalogue into one block. Add spreadAuthors() to the feed sorters: a gentle diversity re-rank that keeps the caller's ranked order as the priority but avoids runs of the same author — at each step it takes the highest-ranked remaining item whose author wasn't among the last `window` picks (default 1), falling back to the plain top item when every remaining candidate is a recent author. The #1 ranked item is always chosen first, so "best-fit"/"most-viewed" stays topmost, and each author's items keep their relative ranked order. Applied to createForYouScoreSorter (personalized branch) and createTrendingSorter (live items). Unlike interleaveByAuthor (full round-robin, used only for For You's no-signal fallback + Explore), this preserves ranking rather than flattening it, so each tab keeps its unique ordering process — just de-clustered. Recent (chronological) and Explore (already diversified) are unchanged. Tests: tests/feed-engine/spread-authors.test.mjs (7 — top preserved, no avoidable adjacent dupes, per-author order kept, single-author/short/anon edge cases, window:2 spread). Co-Authored-By: Claude Opus 4.8 <[email protected]>