Page MenuHomePhabricator

Spike: Investigate Options for Section Name in Diff [8 hours]
Open, Needs TriagePublic

Description

As a Community Tech team member, I want to know to know the various options/considerations for Section Name in Diff, so that the team can begin planning the work.

Relevant Resources:

Acceptance Criteria:

  • Review previous relevant work to determine what we can reuse, which includes:
    • The investigation conducted by Max: T231698
    • Section headings work previously done by Max
    • Work by iOS team: The updates Wikidiff2 and its wrapper to support the mobile diff presentation in the apps. Some of this work is likely reusable, or at least the process is a potential path for the Section names in diffs wishlist item.
      • Master ticket for diffs was here, and its non-UI children are likely relevant: T228793
      • Additional related tickets: T234096, T234930, T236189
  • Write up and share general proposal for how this work can be done, including potential risks & dependencies

Event Timeline

ifried created this task.Jan 8 2020, 7:13 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 8 2020, 7:13 PM
ifried updated the task description. (Show Details)Jan 13 2020, 4:50 PM
ifried updated the task description. (Show Details)Jan 13 2020, 5:00 PM
ifried updated the task description. (Show Details)Jan 13 2020, 10:57 PM
ifried updated the task description. (Show Details)
ifried updated the task description. (Show Details)
ifried renamed this task from Spike: Section Name in Diff [placeholder] to Spike: Investigate Options for Section Name in Diff.Jan 13 2020, 11:01 PM
ifried updated the task description. (Show Details)
ifried updated the task description. (Show Details)
ifried renamed this task from Spike: Investigate Options for Section Name in Diff to Spike: Investigate Options for Section Name in Diff [8 hours].Jan 15 2020, 12:20 AM
ifried moved this task from To Be Estimated/Discussed to Estimated on the Community-Tech board.
ifried moved this task from Estimated to Kanban-Q3-2019-20 on the Community-Tech board.

I'll be honest, I don't know how to really answer this without doing some coding. Max's investigation says a lot: T231698#5512527. Since that time, the wikidiff2 output apparently includes section names with the relevant line numbers (T234096). This includes both the left side and the right side (see for example REST API output), which I think alleviates Max's performance concern. If I'm understanding things correctly, the work would be limited to MediaWiki's DifferenceEngine.php to make use of the section titles. I suppose system administrators can swap out the diff engine (MediaWki appears to use sebastianbergmann/diff by default), our changes will have to only show section titles if the engine provides this information.

I was wrong! The HTML output is generated by the C++ library. It doesn't look that bad to work with, though, and I think https://gerrit.wikimedia.org/r/c/mediawiki/php/wikidiff2/+/539906 will offer some clues. So:

Potential risks associated with this project from a technical perspective

  • Our changes to the diff HTML might effect other places than just Special:Diff, such as Special:ComparePages (this is probably fine)
  • Make sure the new functionality has no conflicts with Revision-Slider (it shouldn't)
  • In updating the wikidiff2 library, only WMF wikis are guaranteed the new section title functionality. We could also optionally port this change to the MediaWiki diff engine for other wikis that use it.
  • Since the code changes live outside of MediaWiki, we won't be able to control the display with a feature flag, or at least I think we'd need to do it through a INI flag rather than something in LocalSettings.php

Potential dependencies associated with this project from a technical perspective

Recommendation for implementation of this change

  • Get some of idea of what we want it to look like. This might effect where we need to make code changes and how difficult they will be.
  • (Re-)learn some basic C++
  • Try out the docker container and get that hooked up into your local MW installation.
  • Try to go off of the patch that added section titles to the JSON, and do the same for the HTML output.
  • Hopefully profit.

Rough estimate/sense of difficulty or effort required by this project

  • Updating wikidiff2: medium, perhaps large if you include the learning curve.
  • Updating the core diff engine (optional): large