Page MenuHomePhabricator

Contributions apparently could have wrong pagination
Open, HighPublic


I haven't actually seen this in the wild, but I think since ContributionsQuery::getResult does filtering after the actual query (and doesn't re-query) it could have a similar issue to T108279: Board history pagination controls are missing.

Since the Flow results are mixed in with non-Flow (then sorted), I think it would be more likely to happen if you had a high proportion of Flow edits.

Best solution is probably to have ContributionsQuery re-query until either the filtered set is equal to the limit, or there's nothing left in the DB (which is how the pagination detection is supposed to work).

Alternative approach: Move filtering to ContributionsLineEnding; this is slightly evil since ContributionsLineEnding is only supposed to format, and the abort code is a fallback (complete with HTML comment in output).

(Side note, RecentChanges, the last type changed by rEFLW417f2b4c5882: Suppress topic creation entry from RC, watchlist, contributions and history does not seem negatively affected since it only calls excludeFromRecentChanges in loadMetadataBatch (which is just preloading) and getResult (which is called at the last moment so shouldn't affect pagination), and I think RC pagination works differently so this type of issue doesn't apply anyway. But see T109549: Revisit how we exclude things from RC.

See T130933: "Could not format Special:Contribution row" when user edit on Flow page was deleted.

Event Timeline

I think I now see this in real life use of limit.

This month, I deleted a Flow test board on

If that board still existed, it would be the most recent contribution.

(Below examples use an end time; that is for clarity, but not required to see the issue.) correctly shows the most recent non-deleted contribution (a Flow post) first.

So if I set a limit=1, I should see the same first item (and it should be the only item).

But in reality, shows an earlier non-Flow item first (and only).

Without re-reviewing the code, I suspect what's happening is:

  1. It asks Flow for 1 item.
  2. Flow queries for the latest item (moderated or unmoderated).
  3. It sees it's moderated and removes it, returning an empty result set.
  4. The latest result (after merging Flow and non-Flow) is now non-Flow.

1-3 is wrong. It should give you the latest non-deleted Flow, not just refuse to give you anything since the latest Flow was deleted.