Page MenuHomePhabricator

Gadget support: The editor should be capable of targeting editors of code via a message box
Closed, ResolvedPublic3 Estimated Story Points

Description

  • Scope of this ticket **

This ticket is done when it's possible to locally edit a MediaWiki interface page to display a message box. Using the box is not in scope for this ticket.

  • The message is disabled by default
  • When set a message appears above the editor when the user edits JS/CSS code.

QA steps

  • Get a developer to set [[MediaWiki::editpage-code-guidelines]] on a wiki
  • Edit a JavaScript or CSS page e.g. User:<username>/common.js

Expected: a message box with the text of the page https://en.wikipedia.beta.wmflabs.org/wiki/MediaWiki:Editpage-code-message shows at the top of the page.

QA in production

No change is expected

Background

Despite gadgets and user scripts (which will be referred from now on as wiki-based code) being a key component of MediaWiki projects, up until now frontend APIs (e.g. how wiki-based code should interact with source control provided code) have been ill-defined leading to misunderstandings between engineers and wiki-based code developers when wiki-based code breaks. This also leads to code rot, where developers do not feel empowered to make changes as it's unclear how their changes will impact wiki-based code developers.

On top of this, when wiki-based code breaks it's not clear who can and will fix them.

A gadget policy document was written in 2021 which later became a set of recommendations. This policy should be considered a living document that can evolve over time with discussion, like any other wiki page.

I would like us to surface this policy from the editor on pages which are of content type JavaScript or CSS like so:

Screen Shot 2022-07-01 at 4.13.56 PM.png (1×2 px, 863 KB)

Benefits (why should this be implemented?):

Given wiki-based code can impact users and site reliability (now that we log JavaScript errors) and is impacted by changes in the core platform, it's important that we have shared understanding of how we can work together best. This should lead to a better experience for both parties and will go a long way to restoring trust and good faith between the two parties.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Clarifying: specifically, you want it linked to when someone's editing JS (and CSS?) on-wiki?

@DLynch thanks for the clarifying question. Updated the description so hopefully this is clearer. This would of course only be restricted to pages that contain executable content.

Just noting we will likely need support from the developer advocacy team when pushing through this change.

@Jdlrobson: Hi, could you please elaborate which kind of support you're looking for? Thanks in advance!

@Aklapper still working this out with a few people. I'll reach out when I know exactly what's needed.

@Jdlrobson: Removing Developer-Advocacy for the time being; feel free to re-add once there's something actionable potentially in scope. Thanks.

Change 824560 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] EditPage: Refactor large showIntro method

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

Change 824561 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Make messages about editing site code more prominent

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

Change 824562 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Invite editors to contribute to the code policy/guidelines

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

Change 824560 merged by jenkins-bot:

[mediawiki/core@master] EditPage: Refactor large showIntro method

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

Talking to Olga/Alex in DM thread today about how this would help us have a common set of guidelines to work to.

Jdlrobson renamed this task from The editor should link to the user gadget policy to The editor should link to a reecommendations page for best practices and guidelines for building gadgets.Jan 12 2023, 5:55 PM
Jdlrobson updated the task description. (Show Details)
DLynch renamed this task from The editor should link to a reecommendations page for best practices and guidelines for building gadgets to The editor should link to a recommendations page for best practices and guidelines for building gadgets.Jan 12 2023, 5:57 PM
Jdlrobson renamed this task from The editor should link to a recommendations page for best practices and guidelines for building gadgets to Gadget support: The editor should link to a recommendations page for best practices and guidelines for building gadgets.Jan 31 2023, 12:48 AM
Jdlrobson triaged this task as Medium priority.Feb 6 2023, 11:46 PM
Jdlrobson raised the priority of this task from Medium to High.Mar 1 2023, 9:50 PM
LGoto set the point value for this task to 3.Mar 2 2023, 6:14 PM

I did some reviews here, seems like there is already a number of reviewers also on it I gave the patches 1 with some nitpicks, generally only waiting for other reviewers

Jdlrobson changed the subtype of this task from "Feature Request" to "Task".Mar 15 2023, 11:50 PM
Jdlrobson updated Other Assignee, added: Jdlrobson.

Change 824561 merged by jenkins-bot:

[mediawiki/core@master] Make messages about editing site code more prominent

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

Change 900467 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@wmf/1.40.0-wmf.27] Make messages about editing site code more prominent

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

Change 900701 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] EditPage: Support blanking of messages

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

Change 900701 merged by jenkins-bot:

[mediawiki/core@master] EditPage: Support blanking of messages

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

Change 900467 abandoned by Jdlrobson:

[mediawiki/core@wmf/1.40.0-wmf.27] Make messages about editing site code more prominent

Reason:

This is going to go out with the train given the follow ups.

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

Is this upcoming change now (or not yet, but eventually?) going to add links to this page? https://www.mediawiki.org/wiki/Recommendations_for_gadget_developers_on_Wikimedia_wikis
I ask because: If/when it is linked from the default UI, it ought to (already be) marked for translation.

It would also be good to clarify the official status of the document and refer to it consistently by that term. (I.e.the task Description and mockup above use the word "policy" but the page says and is titled "recommendations" (plus one self-reference as a "policy")).
Thanks!

@Quiddity no change is expected for end users at this point. The current wording seems to be causing a lot of confusion, so I'm going to edit the ticket to make the scope of this ticket clearer.

Jdlrobson renamed this task from Gadget support: The editor should link to a recommendations page for best practices and guidelines for building gadgets to Gadget support: The editor should be capable of targeting editors of code via a message box.Mar 20 2023, 6:41 PM
Jdlrobson updated the task description. (Show Details)

Change 902176 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] EditPage: Only limit styling of edit interfaces when div element is present

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

Change 902176 merged by jenkins-bot:

[mediawiki/core@master] EditPage: Only limit styling of edit interfaces when div present

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

Change 824562 merged by jenkins-bot:

[mediawiki/core@master] EditPage: Add capability of targeting editors of code in editor

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

Edtadros subscribed.

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

Edit a JavaScript or CSS page e.g. User:<username>/common.js
❓ AC1: Expected: a message box with the text of the page https://en.wikipedia.beta.wmflabs.org/wiki/MediaWiki:editpage-code-guidelines shows at the top of the page.

@Jdlrobson, a text box does appear, but I can't compare it to the text of the page referenced in the steps because that page doesn't come up.

Screenshot 2023-03-24 at 4.37.17 PM.png (861×1 px, 195 KB)

Screenshot 2023-03-24 at 4.37.46 PM.png (969×1 px, 280 KB)

The message we are looking for is "hello developer!" so this is a pass!

Change 907554 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] editpage: Fix duplicate Parser invocations by doesMessageContainDiv()

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

Change 907525 had a related patch set uploaded (by Krinkle; author: Jdlrobson):

[mediawiki/core@master] EditPage: Remove doesMessageContainDiv method

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

Change 907554 abandoned by Krinkle:

[mediawiki/core@master] editpage: Fix duplicate Parser invocations by doesMessageContainDiv()

Reason:

Superseded by https://gerrit.wikimedia.org/r/907525

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

Change 907525 merged by jenkins-bot:

[mediawiki/core@master] EditPage: Remove doesMessageContainDiv method

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