Page MenuHomePhabricator

Create a simple edit check to gain feedback about the API / creation process
Open, Needs TriagePublic

Description

We should have someone who doesn't know a great deal about the edit check system create a basic check and gather feedback from this process. This might cause us to refine the API, and should also serve as the basis for documentation.

Because this is mostly a test of the API / multicheck experience, we should avoid anything which would be technically complicated to actually calculate.

Initial suggestions include:

  • Naïve link suggestion check ("find things that look noun-y in your edit, check whether the document already contains a link to an article with that name, suggest you add a link otherwise")
  • Puffery check, just checking for a certain threshold of words listed in WP:PEACOCK and suggesting you rephrase (or just delete them, since they're mostly adjectives?)
  • Add an image check, just seeing whether you've added an entire section that doesn't contain an image

It'd be nice if we wound up with something useful enough to be released once we're done, but that's not incredibly important for the goals of this task.

Done

  • Patch demo is created that enables people to try the Edit Check concept
  • What was relatively easy and difficult about writing a new Check is documented on this ticket

Event Timeline

Yoink! I'm making a check for uncaptioned images.

I think my main feedback so far is that includes/ResourceLoaderData.php is hard to find, but it is necessary to specifically set variables such as minimumCharacters for functions such as mw.editcheck.BaseEditCheck.prototype.getModifiedContentRanges() to work properly.

I've been rebasing onto the new multicheck code, and discovering that I didn't understand the codebase as well as I thought. Progress is happening!

Further update on the experience of creating a check:

  • Functions that depend on includes/ResourceLoaderData.php values need defaults. Possibly we could add explicit comments in existing checks about where these are set, seeing as they're examples as well as features
  • Likewise, it's probably worth noting that a new check needs adding to extension.json and editcheck/modules/init.js
  • It's fairly straightforward to understand that one should create an onDocumentChange or onBeforeSave function which returns a list of EditCheck objects
  • Although I'm already slightly familiar with the document model, understanding how to manipulate it well took most of the time:
    • How to get nodes of a particular type
    • How ranges relate to selections, and how selections relate to fragments
    • Range manipulation, such as determining whether a node was fully within an edited range, knowing whether to use outer range
    • I didn't end up navigating the tree much for my check, but I did in the process of building it. Some of this comes down to simply understanding ve's data model
  • Having correctly identified the targets of my check, it's time to act()
    • It was a useful sidequest to understand how selections and context works, and it's certainly a possibility that giving users boilerplate code or a helper function to activate a sensible context action might make life a lot easier
    • I had to go and re-learn how windows work, eg that they often exist in a closed state and need to be opened with instance-specific data. I'm a little fastidious here, other developers will likely copy code and get working code but I wanted to be sure I was getting things right. It was useful to find out how to pass the fragment so that the media dialog would open in the correct mode
    • It's probably useful to also document how you might present options other than accept and reject in an action dialog
    • I didn't want to implement a dismiss function because I knew that there was going to be a more generic one coming down the pipe.

Edit: sorry for the edit to create the second half of the comment, I shift-entered when I meant to enter

Change #1083873 had a related patch set uploaded (by Zoe; author: Zoe):

[mediawiki/extensions/VisualEditor@master] WIP: Add an edit check for uncaptioned images

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

Next Step
Per today's team meeting, Editing Engineering will review and respond T374066#10337785 seeing as how the Edit Check API has evolved since this feedback was shared.