Page MenuHomePhabricator

Stabilize sorting of feed stories with similar strength
ClosedPublic

Authored by epriestley on Wed, May 22, 12:04 AM.

Details

Summary

See PHI1222. When we publish several transactions to feed at once, we sort them by "action strength" to figure out which one gets to be the title story.

This sort currently uses msort(), which uses asort(), which is not a stable sort and has inconsistent behavior across PHP versions:

Switch to msortv(), which is a stable sort. Previously, see also T6861.

If all transactions have the same strength, we'll now consistently pick the first one.

This probably (?) does not impact anything in the upstream, but is good from a consistency point of view.

Test Plan

Top story was published after this change and uses the chronologically first transaction as the title story.

Bottom story was published before this change and uses the chronologically second transaction as the title story.

Both stories have two transactions with the same strength ("create" + "add reviewer").

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Wed, May 22, 12:04 AM
epriestley requested review of this revision.Wed, May 22, 12:05 AM
amckinley edited the summary of this revision. (Show Details)Wed, May 22, 9:15 PM
amckinley accepted this revision.Wed, May 22, 9:18 PM
This revision is now accepted and ready to land.Wed, May 22, 9:18 PM

Reading PHI1222; nice catch!