Page MenuHomePhabricator

QA: Night mode linting rule
Closed, ResolvedPublic1 Estimated Story Points

Description

Background

In T359205 we deployed a new linting rule:
https://www.mediawiki.org/wiki/Help:Lint_errors/night-mode-unaware-background-color

User story

As an editor I should be able to understand and act on linting rules.

Requirements

Sign off

Event Timeline

ovasileva triaged this task as High priority.
ovasileva set the point value for this task to 1.
Edtadros subscribed.

@Jdlrobson I need a bit more guidance on how to test/verify this.

@Jdlrobson Edward and I chatted about this and I also had some questions.

Review 100 of the lint errors our lint changes flagged in the article namespace with unique templates:

For this part, do you want us to essentially run this js in the first hundred lints? 100 seems like a lot unless you want us to do this programatically?

Identify what %age of them are actionable. ie. is it clear to you how you would fix them?

Do we just do a basic count? How specific do you want to get? Again, were you envisioning a manual process or to run a script?

Edit: We chatted about this again and it sounds we will follow the above assumptions and try to run js on the first 100 pages and get it to spit out a result.

Some follow-up issues that has us slightly blocked:

Screenshot 2024-04-04 at 5.05.36 PM.png (1×2 px, 248 KB)

  1. The empty middle column requires clarification. Should we allocate time to address this, or is it okay that it remains empty? EDIT: This has been addressed with this patch: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Linter/+/1017162.
  2. There are instances of page repetition. Should we disregard these duplications or fix it so the pages don't repeat? EDIT: The repetition is because the linter is recording every instance on the page where a lint error occurs. Many pages will have multiple nodes with the offending inline style. If all you want to know is that a page has an instance of an error, we could stop emitting the lints after the first occurrence, but it is NOT a blocker for this ticket.
  3. Several pages lack templates, displaying only a hyphen in the third column. Should we update the code to replace the - with more detail? EDIT: The dash is indicating the lint error occurred in the wikitext of the page itself, not as a result of including a template. It's possible for a template included on many pages to have a lint error so the distinction is important to know where to go fix up the issue. Hopefully, that's clear but I can try to rephrase it if not.
  4. The JS appears to be incomplete, as it overlooks certain lines. Additionally, when executed on the linted pages, it returns an empty array. We need to refine the script. EDIT: If the JS script returns an empty array, just record it empty for now. We can look back at the pages that return empty arrays to see if they are valid in the second round"

For this part, do you want us to essentially run this js in the first hundred lints? 100 seems like a lot unless you want us to do this programatically?

I think a mix of both for now, it could be good to manually test a few to validate the experience of an editor trying to fix these.
For example when I visit the page and click the first link https://en.wikipedia.org/w/index.php?title=Dead_and_Deader&action=edit&lintid=421428805 it highlights {{House of the Dead}} and if I look at the HTML (or run the code Array.from($('[style*="background"]')).filter((a)=>!a.getAttribute('style').match(/color *:/)) I can see that this is a problem with the abbr tags.

Do we just do a basic count? How specific do you want to get? Again, were you envisioning a manual process or to run a script?

Rough estimate is fine, we just want to understand what the room for improvement is here before putting this in front of editors.

Hey @KSarabia-WMF , Attached is the csv with the results of running the code for the first 100 pages. I've also attached the script I used t do it. Let me know if this is helpful enough to pass/resolve this.

We don't always expect there to be contrast issues, but rather situations where contrast issues might appear in the future due to specific uses of templates. We will document this as part of signoff.

As a final confirmation and sign-off, @KSarabia-WMF will update the documentation to explicitly state that the new linting tool may flag inline style rules pertaining to background/background color with a missing color, even if they do not violate the color contrast rule. It will be clarified that this behavior is intentional and aligns with the desired outcome of the linting process.

Jdlrobson lowered the priority of this task from High to Medium.