Page MenuHomePhabricator

page ID accessed from Lua by calling "mw.title.getCurrentTitle().id" ocassionally returns "0"
Closed, ResolvedPublic

Description

After T223792 got resolved, templates on Commons can access Structured Data on Commons using Lua. As mentioned in T237107, mw.wikibase.getEntity() without the item ID does not work yet, so the code is calling mw.wikibase.getEntity("M"..mw.title.getCurrentTitle().id) to access entity associated with the current page. Strangely, some tiny fraction of the files that execute that line end up in c:Category:Pages_with_script_errors with error message that "M0" is not correct entity ID. Purging files fixes the issue, but files flicker in and out of "Category:Pages_with_script_errors". I had to add this change to patch the issue. Please ensure mw.title.getCurrentTitle().id returns correct page ID.

Event Timeline

Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald Transcript

A sample for testing would be good.

It is not a reproducible problem (yes I hate those too), but before this edit c:Category:Pages_with_script_errors category was swamped with pages complaining about entity ID "M0", and every single page like that was "fixed" after purge or null edit.

Is it happening only when the page is first created? It's possible that we forgot to have Scribunto set the vary-page-id flag when the page ID is accessed in this way so MediaWiki knows to reparse the page after the page ID gets assigned.

Is it happening only when the page is first created? It's possible that we forgot to have Scribunto set the vary-page-id flag when the page ID is accessed in this way so MediaWiki knows to reparse the page after the page ID gets assigned.

I do not know, I only observed that there was a constant trickle of files into Category:Pages_with_script_errors complaining about entity ID "M0" and all of them would disappear from the category after null edit. I did another tweak to the code and now files with page_id = zero should end up in c:Category:Pages_with_page_ID_set_to_zero. At the moment category is still empty. I will observe it and report if there are any files there.

Jarekt claimed this task.

c:Category:Pages_with_page_ID_set_to_zero is still empty. I will close this as resolved, and revive if I observe this issue again. If I run into it again I will try to get more info about images.

Change 561688 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/extensions/Scribunto@master] Record vary-page-id when ID is accessed via mw.title

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

matej_suchanek reassigned this task from Jarekt to Anomie.
matej_suchanek unsubscribed.

Change 561688 merged by jenkins-bot:
[mediawiki/extensions/Scribunto@master] Record vary-page-id when ID is accessed via mw.title

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

Anomie closed this task as Resolved.EditedFeb 14 2020, 9:03 PM

The fix should be deployed with 1.35.0-wmf.20. If you empty the category after that version is deployed, and it starts filling up again, feel free to reopen with more information.