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

Jarekt created this task.Fri, Nov 8, 4:51 PM
Restricted Application added a project: Wikidata. · View Herald TranscriptFri, Nov 8, 4:51 PM
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.

Anomie added a subscriber: Anomie.Tue, Nov 12, 7:55 PM

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 closed this task as Resolved.Fri, Nov 15, 3:52 AM
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.