Page MenuHomePhabricator

Enhance EventLogging Schema diffs with Extension:Diff
Closed, DeclinedPublic

Description

As part of the Wikidata project, Jeoren De Dauw wrote an extension to prettify diffing of Javascript. It'd likely be a good addition for EventLogging to have too!

Logging as a TODO item after discussing with Ori

https://www.mediawiki.org/wiki/Extension:Diff

Example: https://www.wikidata.org/w/index.php?title=Q5589038&diff=8314580&oldid=8314578


Version: unspecified
Severity: enhancement

Details

Reference
bz45865

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:28 AM
bzimport set Reference to bz45865.
bzimport added a subscriber: Unknown Object (MLST).

Jeoren De Dauw wrote an extension to prettify diffing of Javascript.

Not sure who this Jeoren fellow is, though if his extension is doing something similar to mine, it is not aimed at JS at all. Diff is aimed at computing and representing differences between JSON like arrays. Please see the documentation and examples.

https://www.mediawiki.org/wiki/Extension:Diff

And JSON is exactly what EventLogging uses. See https://meta.wikimedia.org/wiki/Schema:GuidedTour?action=edit . The mention of JavaScript in the initial report is incorrect.

Ah... yeah, if you translate that into PHP arrays you can feed it to Diff. ATM Diff does not care about ordering, which I suspect is something you actually do care about here.

Meaning non-associative arrays are treated as sets?

I actually can't think of a case where that would currently cause a problem in EventLogging (the main use case is enums, where it just matters whether it's in the array).

However, it could in the future. Perhaps we can add a OrderedListDiffer for such cases, or rename ListDiffer to SetDiffer (depending how much backwards-compatibility is an issue)?

ListDiffer does not care about order. It can behave as array_diff does, in which case you get behaviour probably not wanted for non-sets. It's default behaviour however holds into account that an element can occur more then once. So that's not a problem. All I'm saying is that if you need ordering, additions will need to be made.

or rename ListDiffer to SetDiffer (depending how much
backwards-compatibility is an issue)?

This rename would be incorrect. And it would break compatibility. This extension has also been designed with the open closed principle in mind. You ought to be able to add new functionality without significantly poking at existing code.

(In reply to comment #0)

As part of the Wikidata project, Jeoren De Dauw wrote an extension to
prettify
diffing of Javascript. It'd likely be a good addition for EventLogging to
have
too!

Close enough! ;)

[moving from MediaWiki extensions to Analytics product - see bug 61946]