Page MenuHomePhabricator

Forbid new modern code from not targeting mobile
Closed, DeclinedPublic

Description

The targets system was initially added to reassess code before loading on mobile. It has stayed much longer than expected.

As we embrace Vue and ES6 code I was surprised to see certain code is unintentionally (and intentionally) not being shipped to mobile clients.

We should stop this before it gets out of hand.

To avoid this I recommend:

  • we should change the targets behaviour so that it defaults to [ 'desktop', 'mobile' ] for any code that uses ES6
  • or packageFiles.
  • we will log a warning for any code that intentionally tries to avoid targeting mobile in these circumstances

Event Timeline

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

[mediawiki/core@master] Modern code should be forced to target mobile

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

@Krinkle I'd recommend this as it provides more momentum for eventually disabling the targets system (anyone migrating to ES6 or packageFiles is paying off the technical debt in T127268. There is no practical reason IMO why we should be using the targets system with ES6 / packageFiles code.

Jdlrobson renamed this task from Forbid new code from not targeting mobile to Forbid new modern code from not targeting mobile.Nov 22 2022, 8:11 PM

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

[mediawiki/core@master] All code using packageFiles runs on mobile and desktop targets

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

Change 859633 abandoned by Jdlrobson:

[mediawiki/core@master] resourceloader: Code using packageFiles runs on mobile targets by default

Reason:

Will come back to this later.

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

Change 859149 merged by jenkins-bot:

[mediawiki/core@master] resourceloader: Modern ES6 code should be forced to target mobile

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

Change 864907 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/core@master] Revert "resourceloader: Modern ES6 code should be forced to target mobile"

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

Change 864912 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/core@wmf/1.40.0-wmf.13] Revert "resourceloader: Modern ES6 code should be forced to target mobile"

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

Change 864907 merged by jenkins-bot:

[mediawiki/core@master] Revert "resourceloader: Modern ES6 code should be forced to target mobile"

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

Change 864912 merged by jenkins-bot:

[mediawiki/core@wmf/1.40.0-wmf.13] Revert "resourceloader: Modern ES6 code should be forced to target mobile"

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

Mentioned in SAL (#wikimedia-operations) [2022-12-06T12:52:32Z] <kharlan@deploy1002> Started scap: Backport for [[gerrit:864912|Revert "resourceloader: Modern ES6 code should be forced to target mobile" (T323542)]]

Mentioned in SAL (#wikimedia-operations) [2022-12-06T12:54:20Z] <kharlan@deploy1002> kharlan and kharlan: Backport for [[gerrit:864912|Revert "resourceloader: Modern ES6 code should be forced to target mobile" (T323542)]] synced to the testservers: mwdebug1001.eqiad.wmnet, mwdebug2002.codfw.wmnet, mwdebug1002.eqiad.wmnet, mwdebug2001.codfw.wmnet

Mentioned in SAL (#wikimedia-operations) [2022-12-06T13:00:29Z] <kharlan@deploy1002> Finished scap: Backport for [[gerrit:864912|Revert "resourceloader: Modern ES6 code should be forced to target mobile" (T323542)]] (duration: 07m 57s)

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

[mediawiki/core@master] resourceloader: Modern ES6 code should be forced to target mobile

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

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

[mediawiki/core@master] Allow jquery.tipsy on mobile

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

Change 865179 merged by jenkins-bot:

[mediawiki/core@master] Allow jquery.tipsy on mobile

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

Change 864923 abandoned by Jdlrobson:

[mediawiki/core@master] resourceloader: Modern ES6 code should be forced to target mobile

Reason:

I've underestimated the work involved here. Will leave an update on ticket with next steps.

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

Hey @Catrope I underestimated Wikidata here. Wikidata is heavily using the targets system, and I've exhausted my timebox trying to port over all the modules there. I think this would have been a good thing to do when we added es6 but I think its too late now.

I think the best strategy is still T235712 (making sure modules don't get added to the page, and then when that hits zero or near zero, ignoring targets on module definitions. I'm going to decline this one.

@Krinkle @Catrope My concern is people keep adding new modules which are making this a moving target and making it even harder to undo. Is there a way we might use CI going forward to prevent new modules setting targets to only mobile or only desktop going forward that you can think of? Thanks in advance for any ideas you might have here!