The multiple sort criteria first "timestamp", then "pageid" / "page_id" (?) at
history/diff should be the same as at "Special:Contributions/foo" and
[[Special:Recentchanges]].

The links at Special:Contributions/foo are using diff=prev&oldid=<oldid_no>.
The links at Special:Recentchanges are using
curid=<curid_no>&diff=<diff_no>&oldid=<oldid_no>.
Both seems to be sorted by timestamp and <diff_no>.

best regards reinhardt [[user:gangleri]]

*note*
history/diff is not mentioned at
Bug 2468: The code that generates the namespace form for Special:Contributions,
Special:Allpages and Special:Recentchanges should be merged
but I think that sort criterias should be the same exept for Special:Allpages

I have another example of the "Next diff", "Prev diff" links not working right. Seehttp://commons.wikimedia.org/w/index.php?title=Template:Description&diff=next&oldid=246447
That link is supposed to show the difference between revision 246447
and the chronologically next revision. Instead, it shows the difference between
246447 and the ''previous'' revision, 246448. Apparently the diff view assumes
that page ID numbers are in chronological order, when they really aren't.

Reason being most likely the oldid's not being in date/time order.
Here, the revisions newer than oldid=6720 have been created before all the older versions up to and including
oldid=6720 were created via Special:Import. As of now, no newer revisions have been made since.

Changing summary, confusing to say "the edit history is wrong" when sorting based on timestamp is the expected behaviour from a user's perspective, making the edit history 'correct' and diff links 'wrong'.

Per Gurch, the issue is not that the edit history is wrong, but that the timestamps are wrong. This isn't MediaWiki's fault, if anything it's either a WikiMedia server cluster bug or it's that we should be using something other than timestamps to sort edits. There be dragons, in my opinion, with using something other than timestamp to sort because then users get confused, and short of buying a few atomic clocks there's no way to improve timestamp accuracy, as I presume each cluster is NTPing together. Is there anything to be done on this bug or can it be closed?

I don't think it's relevant whether the timestamps are right or wrong. There will be valid reasons where sorting by ID and by timestamp give different results (e.g. transwiki imports, or article merges). The problem is that the sorting is done by timestamps in one place (revision list), and IDs in another ('diff with previous' link).

All sorting of revisions should be done by timestamp, then ID, in all cases. This would remove inconsistencies within the various user interfaces where revisions are displayed/used.

Problems on the cluster that result in incorrect timestamps (if they exist) are a completely separate issue, and should be handled by a different bug.