Page MenuHomePhabricator

Pass section headers to wikidiff2 to get section header diffs
Open, HighPublic3 Estimate Story Points

Description

The way that we are passing data to wikidiff2, we're not getting section heading diffs.

We need to pass section headings separately.

We also need to output the section header response, which is a top-level property returned by wikidiff2.

Details

Related Gerrit Patches:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 30 2019, 9:55 PM
WDoranWMF triaged this task as High priority.Oct 31 2019, 3:47 PM
WDoranWMF set the point value for this task to 3.
WDoranWMF moved this task from Backlog to Ready on the Core Platform Team Workboards (Green) board.

@Tsevener I think we'll need some help understanding exactly what data needs to be passed to wikidiff2.

tstarling claimed this task.Nov 1 2019, 4:53 AM
tstarling added a subscriber: tstarling.

Best if I take this one since it will involve messing around with the Parser. No need for help at this stage.

I just want to confirm that it's OK to implement this prior to https://gerrit.wikimedia.org/r/c/mediawiki/php/wikidiff2/+/546231 being completed.

I just want to confirm that it's OK to implement this prior to https://gerrit.wikimedia.org/r/c/mediawiki/php/wikidiff2/+/546231 being completed.

Yes please.

It'd be great if there's a way to check the version and pass different arguments to wd2 depending on what parameters it can handle, in case your code lands before wd2 is deployed.

Thanks @tstarling @eprodromou !

I thought it'd be useful to upload an example at least for documentation purposes. This example includes special characters which will affect the byte offsets needed.

From text passed into wikidiff2:

To text passed into wikidiff2:

Section title offsets passed into wikidiff2 (note offsets are against the "to" text, not "from"). These indicate the position when the section title begins.
[ 27, 67, 112, 161, 192 ]

Wikidiff2 expected output:

Feel free to reach out if you have any questions.

Change 548005 had a related patch set uploaded (by Tim Starling; owner: Tim Starling):
[mediawiki/core@master] [WIP] REST compare: pass section offsets to wikidiff2

https://gerrit.wikimedia.org/r/548005

The patch linked above appears to work. The differences between the output I'm getting and your expected output file seem to be due to the fact that I haven't merged 546231 locally yet. I marked it WIP mostly because I'm unsure if this is the way we want to do it at all, per my long comment on 546231.

Different output proposal example based on comments in 546231 and 539906. wikidiff2 could output the byteOffsetStart objects with each line diff item, and sectionInfo could be generated externally in MediaWiki and tacked onto the Rest API compare endpoint. Client-side would check each item's byteOffsetStart and assign it the appropriate section if it falls in one of the sectionInfo array items' byteOffsetRange.

FYI I made an alternate patch for the wikidiff2 portion of of that output above, Phab link is here.

Change 548005 merged by jenkins-bot:
[mediawiki/core@master] REST compare: bundle section offset information

https://gerrit.wikimedia.org/r/548005

Change 550792 had a related patch set uploaded (by Tim Starling; owner: Tim Starling):
[mediawiki/core@wmf/1.35.0-wmf.5] [1.35.0-wmf.5] REST compare: bundle section offset information

https://gerrit.wikimedia.org/r/550792

Change 550792 merged by jenkins-bot:
[mediawiki/core@wmf/1.35.0-wmf.5] [1.35.0-wmf.5] REST compare: bundle section offset information

https://gerrit.wikimedia.org/r/550792