Skip to content

fix(#2056): an article URL counts as one Trending source - #2059

Merged
larspohlmann merged 2 commits into
developfrom
fix/2056-trending-duplicate-sources
Nov 6, 2026
Merged

larspohlmann merged 2 commits into
developfrom
fix/2056-trending-duplicate-sources

Conversation

@larspohlmann

Copy link
Copy Markdown
Owner

Closes #2056

What changes

  • One source per article URL. The per-reader ranking SQL (TrendingStoryRepository::VISIBLE_STORIES) now drops a story member if a lower-id copy with the same url_hash sits in a feed the reader follows. This is the rule DuplicateCollapseDql uses, applied to the story's own members. It feeds the source count, the reader's minimum and the two-article-feeds rule.
  • Social posts always count. The collapse only applies to article feeds. A post is never folded into an article, and it is never folded into another post either.
  • Lead copies no longer add sources. withCopies still shows a lead's copies from other feeds on the card, but no longer raises outletCount. withMoreOutlets, RankedStoryModel::compare and the re-sort in withLeadCopies are gone: the order comes from SQL alone now.
  • app:trending:explain now prints "N feeds" instead of "N outlets". The build-time count is raw feeds and stays that way on purpose, as an upper bound on any reader's count.

Not changed

  • The build-time pre-filter (TrendingGrouping::stories) still counts raw feeds. A collapse across all feeds can keep a copy the reader doesn't follow, which would drop stories that reader should see.
  • Copying url_hash into trending_story_entry would make the new subquery a single index probe. It needs a migration and today's version is already index-backed, so it is left out.

Verification

  • SQLite suite (ParaTest): 12,482 tests green. cs, stan, PHPMD and tramp are clean (tramp's two warnings are in Chapter, which this change doesn't touch).
  • infection:diff: 100% covered-code MSI.
  • The MySQL leg was not run locally. The main checkout holds another session's branch and the Docker stack serves it, so CI covers MySQL.

…y feeds carry it

A story's source count took every followed feed with one of its entries, so a syndicated or
aggregated copy of the same article read as broader coverage, and copies of the lead from
outside the story were added on top. Now only the lowest-id copy of an article URL the reader
can see in the story counts, the rule the list's duplicate collapse uses; the lead's copies
still show on the card but no longer add a source or re-rank it. Social posts always count.
@larspohlmann
larspohlmann merged commit 74ee66e into develop Nov 6, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trending counts a duplicate copy of an article as one more source

1 participant