Page MenuHomePhabricator

[Spike] missing-image-alt-text lint randomized queue prototype
Open, MediumPublic

Description

In T344378 we've prototyped a linter check to detect missing image alt text which we can then draw from; need to confirm whether we can suitably pick a random matching page from a very long list (potentially hundreds of thousands of matches or more) without overstacking things from one end or the other or becoming too slow.

Randomization is hard. ;)

Todo:

  • look at the Extension:Linter API endpoint to confirm how to fetch matches via it now
  • do some query tests to see if similar queries with large random offsets perform well
  • if not, devise an alternate fetch method, eg a pre-sorted queue

Acceptable possibilities:

  • extend the linter API with suitable parameters if needed
  • add a second extension with a targeted API if it doesn't fit well
  • a second table with a suitably sorted queue may need to be maintained. this will be expected to be small in absolute terms, and self-contained with easy deployment characteristics
    • if this is easy to do for all lints, do it that way, it will be useful later for other microtasks

Event Timeline

Seddon renamed this task from Spike: missing-image-alt-text lint randomized queue prototype to [Spike] missing-image-alt-text lint randomized queue prototype.Feb 23 2024, 10:34 PM

General notes based on reviewing Linter API: (https://www.mediawiki.org/wiki/Extension:Linter#API)

Assuming we go forward with using the Linter extension to store/query this, we can roughly think of the set of matching lints, in order of detection (and thus lint id order), make a global queue.

We can match items within that category's 'queue' starting from a certain lint id with list=linterrors and lntfrom=, which allows for 'picking up' from the queue in order to avoid duplicates. If no items are found, we've hit the end of the queue and should restart from the beginning.

Matching records will include the page, the lint id (for later reference), the source location as of the linted edit, and the name of the image file. This could allow for showing a thumbnail of the relevant image along with the page title before loading the entire page source or parsoid HTML.

We can also randomize the input of each client by pulling a series of items instead of a single one (lntlimit=), and then selecting a random item within it to display, so that two fresh instances next to each other don't see the exact same data.

Of note is that modified pages may end up recreating their lints, so pages may move from the start of the queue to later in the queue over time, and may thus re-appear but at the end, never near the beginning.

This logic can be done by the API client on both Android and iOS implementations, and should have no major database performance implications, but may still lead to a general overemphasis on pages in the starting position if they don't get kicked off the queue by edits (eg they look to confusing to fix and nobody else edits the page).

Things to consider:

  • is there a stricted randomization requirement? (might be hard)
  • or additional requirements like deny-lists of categories? (probably not hard)
  • skip/retry needs?

Starting at a semi-random position in the queue might be feasible, or might require an additional server-side modification to do efficiently

It might also be worth explicitly surfacing the idea of selecting several items and allowing the user to choose one or ask for another bunch (not all items may be obvious how to deal with).

Note there's a possibility people will be too grumbly about adding this to the linter extension in which case we'd do the exact same thing but store it in a similar table with a similar api and a different name. I'd prefer to avoid that though.

de-assigning