HomePhabricator

Stabilize sorting of feed stories with similar strength

Authored by epriestley on May 21 2019, 11:57 PM.

Description

Stabilize sorting of feed stories with similar strength

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").

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20540

Details

Committed
epriestleyMay 22 2019, 10:50 PM
Pushed
epriestleyMay 22 2019, 10:51 PM
Reviewer
amckinley
Differential Revision
D20540: Stabilize sorting of feed stories with similar strength
Parents
rPf91bef64f163: Stack chart functions in a more physical way
Branches
Unknown
Tags
Unknown
Build Status
Buildable 22891
Build 31402: Run Core Tests