Page MenuHomePhabricator

Upcoming TOC changes break WikidataPageBanner, used on WIkivoyage
Closed, ResolvedPublic3 Estimated Story Points

Description

See T93106: GSoC proposal for Wikivoyage PageBanner extension for background on WikidataPageBanner.
In 439656e01974e3cbc57902fb4ef33e71c1a386d5 (T293513) we moved TOC generation to ParserOutput::getText().

The WikidataPageBanner extension relies on being able to get the TOC HTML "by the back door" in the OutputPageParserOutput hook code here, modifying it to remove the class and id attributes, inserting it into the output of its parser function code here and then suppressing the "actual" TOC by setting injectTOC to false code here.

Now that the TOC HTML is being generated in ParserOutput::getText(), there is nothing for WikidataPageBanner to insert.

QA steps

Go to https://en.wikivoyage.beta.wmflabs.org/wiki/Bannerda and check there is a table of contents at the bottom of the banner

Check banner is on https://en.wikivoyage.beta.wmflabs.org/wiki/Salzburg

QA Results - Beta

ACStatusDetails
1T328087#8586893
2T328087#8586893

QA Results - Prod

ACStatusDetails
1T328087#8586900
2T328087#8586900

Event Timeline

T105520 (with patch) would provide the ability to customize the class and id of the TOC, which is one part of what WikidataPageBanner is doing.

One solution here would be to explictly pass in the TOC in wikitext as toc=__TOC__ which will insert a <meta> tag at the appropriate spot in the page banner, and also serve to suppress the "other" TOC. When ParserOutput::getText() generates the TOC on the fly (using the customized class and title from T105520) it will then "magically" be in the right spot in the page banner.

I need to verify how the page banner actually ends up on the page, though -- there's some code which is messing around with page properties (which shouldn't really be used, as they end up in the database index!) and if the page banner isn't being inserted in the article body HTML (ie, the stuff returned by ParserOutput::getText()) then the code to dynamically generate the TOC in ::getText() isn't going to find the TOC marker it's looking for.

Jdlrobson added subscribers: ovasileva, Jdlrobson.

@ovasileva : upcoming interrupt work. Since parser team has helped us with a bunch of things, it's time for us to repay the favor!

Change 884128 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/WikidataPageBanner@master] WIP: First attempt to fix WikidataPageBanner after TOC generation changes

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

Change 884102 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] Provide ability to customize the TOC title, id, and class

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

@ovasileva This is a bit of a context switch and I don't think there's much urgency right now so I suggest sprint 2 or 3 for this one.

I *believe* the impact would be that the "horizontal table of contents" would disappear from the page banner on wikivoyage, and of course they are suppressing the 'normal' ToC so effectively no ToC on wikivoyage until this is fixed. I don't know how that translates into priority levels. We could probably do a quick workaround which just restored the "normal" TOC on those pages so functionality wasn't lost while we work on restoring the horizontal ToC (probably a one-liner that commented out the place where injectTOC is set to false). We could also probably hold back the ToC changes for a week if that would help coordination. cc @ssastry.

(I could use help verifying the impact -- is all the page banner stuff set up in beta somewhere so I can see what breaks?)

Chatted to @cscott and apparently there is some urgency here as we should treat this as a regression. Will talk to him tomorrow about options for fixing this before next train roll out.

... We could also probably hold back the ToC changes for a week if that would help coordination. cc @ssastry.

I have no problem reverting my patch before the train. But, your lang variant TOC patches that the web team needed are all behind my patch. So, it is also @ovasileva's call since it will push back the deploy of those fixes. But, if it is not too hard to get it done before Monday EOD, we should try to get it done.

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

[mediawiki/extensions/WikidataPageBanner@master] Fixes the table of contents in banners

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

Change 884128 abandoned by C. Scott Ananian:

[mediawiki/extensions/WikidataPageBanner@master] WIP: First attempt to fix WikidataPageBanner after TOC generation changes

Reason:

Abandoned in favor of Ie0fb1f6d356d37bde9bcb17fce2998fd1f071fb7

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

Change 884383 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/WikidataPageBanner@master] Fixes lang/dir attributes for banner table of contents

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

Change 884371 merged by jenkins-bot:

[mediawiki/extensions/WikidataPageBanner@master] Fixes the table of contents in banners

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

Jdlrobson lowered the priority of this task from High to Medium.Jan 30 2023, 6:34 PM
Jdlrobson set the point value for this task to 3.

Change 884383 merged by jenkins-bot:

[mediawiki/extensions/WikidataPageBanner@master] Fixes lang/dir attributes for banner table of contents

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

Deployed today to group2, and looks correct to me on enwikivoyage. Verified that the lang and dir tags appear to be correct if you're using a non-default user language as well.

Thanks for your help on this, @Jdlrobson!

Test Result - Beta

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

Test Artifact(s):

QA Steps

✅ AC1: Go to https://en.wikivoyage.beta.wmflabs.org/wiki/Bannerda and check there is a table of contents at the bottom of the banner

Screenshot 2023-02-03 at 6.30.32 PM.png (973×1 px, 324 KB)

✅ AC2: Check banner is on https://en.wikivoyage.beta.wmflabs.org/wiki/Salzburg
Screenshot 2023-02-03 at 6.30.56 PM.png (973×1 px, 422 KB)

Edtadros subscribed.

Test Result - Prod

Status: ✅ PASS
Environment: enwikivoyage, zhwikivoyage, hewikivoyage
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

✅ AC1: Go to a page and check there is a table of contents at the bottom of the banner
✅ AC2: Check banner appears

Screenshot 2023-02-03 at 6.35.51 PM.png (973×1 px, 598 KB)

Screenshot 2023-02-03 at 6.40.07 PM.png (973×1 px, 433 KB)

Screenshot 2023-02-03 at 6.35.23 PM.png (973×1 px, 755 KB)

Screenshot 2023-02-03 at 6.43.03 PM.png (973×1 px, 508 KB)