Page MenuHomePhabricator

Make sure there are no transclusion bugs due to global state access when transcluding Special:AllEvents
Closed, ResolvedPublic

Description

When transcluding a special page that accesses the global state directly, things could break in the most surprising way due to how special page transclusion works, by replacing the main context of the request. For details, see T290706: Parser code for special page transclusion replaces main context.

This task encompasses investigation and rectification of any issues with Special:AllEvents related to these problems. A partial list of things to fix can be found in T385729#10602473:

Aside from what the patch already does: no OOUI (and this is going to be a problem), the Pager constructor needs a context object, our UserLinker needs to be migrated from Linker to the new UserLinkRenderer.

Event Timeline

Daimona renamed this task from Make sure there are no transclusion bugs related to OOUI (See: T290706) to Make sure there are no transclusion bugs due to global state access (See: T290706).Mar 10 2025, 7:10 PM
Daimona updated the task description. (Show Details)

Change #1129282 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Add context constructor parameter to EventsListPager

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

Change #1129302 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Add context parameter to UserLinker method

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

Change #1129321 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Convert UserLinker to core's UserLinkRenderer

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

Change #1130133 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] EventsListPager: avoid using OOUI to generate simple HTML

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

Change #1129282 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Add context constructor parameter to EventsListPager

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

Change #1130133 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] EventsListPager: avoid using OOUI to generate simple HTML

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

I have reviewed this again by:

  • Applying r958540 to MW core (patch for T290706)
  • Applying r1129321 to CampaignEvents (tip of the work to remove global state access from Special:AllEvents)
  • Making AllEvents includable, excluding the wikiproject tab, and the filter form
  • Commenting out direct OOUI usage in TextWithIconWidget

The following error is logged for everyone:

  • The code to build the navigation bar, and also some direct Message::text() calls in the pager, reach the global state via low-level Message code (Message->text() -> ... -> MessageParser->getParserOptions()). The navigation bar can simply be omitted (we already said this, and it would redirect to the main special page anyway). For direct usage, nothing we can do.

And for logged-out and temp users only, we also have:

  • IndexPager::__construct calls UserOptionsManager->getOption to get the default result limit ('rclimit' preference); this is also done a second time from getLimitOffsetForUser. This eventually reaches the global state via UserOptionsManager->loadOriginalOptions() -> LanguageConverter->getDefaultVariant() -> LanguageConverter->getURLVariant() -> RequestContext::getMain(). Basically nothing we can do about it, and every other includable special page based on IndexPager has the same issue.
  • Header dates are in the user's preferred timezone, so we call UserOptionsManager->getOption() which again reaches the global state via getDefaultVariant. Like above, not much we can do about it.
  • Event times are formatted according to the user's preferred timezone and time format, which once again calls UserOptionsManager->getOption() etc.
  • Message::text() for unnamed users also reaches the global state via UserOptionsManager.
  • Session->__destruct() -> ... -> User->getName() -> User->getRequest(): nothing we can do.

Overall, this means that converting TextWithIconWidget is the last thing left to do for this task.

Daimona renamed this task from Make sure there are no transclusion bugs due to global state access (See: T290706) to Make sure there are no transclusion bugs due to global state access when transcluding Special:AllEvents.Mar 26 2025, 5:00 PM

Change #1129302 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Add context parameter to UserLinker method

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

Change #1129321 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Convert UserLinker to core's UserLinkRenderer

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

Note: this cannot be tested until we actually make the page transcludable (T388385).

MHorsey-WMF changed the status of subtask T388451: Convert TextWithIconWidget to Codex from In Progress to Stalled.
ifried changed the task status from Open to Stalled.Apr 14 2025, 4:40 PM
Daimona changed the task status from Stalled to Open.Apr 17 2025, 5:50 PM
vaughnwalters subscribed.

Any additional bugs found and remaining issues are being dealt with in T388385 (or tickets created and linked from there) so I am sending this to product sign off