Page MenuHomePhabricator

An interface message key was updated, but an old revision was displayed in the ResourceLoader module for a QuickSurvey
Open, Needs TriagePublic

Description

When you visit https://en.wikipedia.beta.wmflabs.org/wiki/Book?quicksurvey=external-survey-reader-demographics-en-pilot you'll see an external survey like in the screenshot below. The privacy link is rendered as text rather than a link. And the "Visit survey" button is treating the link as a relative link: https://en.wikipedia.beta.wmflabs.org/wiki/[https://docs.google.com/forms/d/e/1FAIpQLSdEkmzsJphxoAJohZWoll80AT4Q-ExJvia_-lT9bKOL-uofOw/viewform?hl=en%5D&entry.1791119923=690c0d77a2aae7af299a

The previous survey which ran between 01/07 and 01/09/2019 didn't have these problems. A regression seems to have been introduced since then.

This is blocking our deployment of the survey, please make it a high priority.

Developer notes

QuickSurveys is using the ResourceLoaderGetConfigVars hook to ship a config variable that looks like this:

[{"name":"Reader-trust-survey-en-v1","question":"Reader-trust-1-message","description":"Reader-trust-1-description","module":"ext.quicksurveys.survey.Reader-trust-survey-en-v1","coverage":1,"platforms":{"desktop":["stable"],"mobile":["stable"]},"privacyPolicy":"Reader-trust-1-privacy","type":"external","link":"Reader-trust-1-link","instanceTokenParameterName":"token","isInsecure":false},{"name":"reader-demographics-en-pilot","question":"Reader-demographics-1-message","description":"Reader-demographics-1-description","module":"ext.quicksurveys.survey.reader-demographics-en-pilot","coverage":1,"platforms":{"desktop":["stable"],"mobile":["stable"]},"privacyPolicy":"Reader-demographics-1-privacy","type":"external","link":"Reader-demographics-1-link","instanceTokenParameterName":"entry.1791119923","isInsecure":false}]

The messages are shipped via a ResourceLoader module created via ResourceLoaderRegisterModules via a ResourceLoaderModule:

	/**
	 * ResourceLoaderRegisterModules hook handler
	 *
	 * Registers needed modules for enabled surveys
	 *
	 * @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderRegisterModules
	 *
	 * @param ResourceLoader &$resourceLoader The ResourceLoader object
	 * @return bool Always true
	 */
	public static function onResourceLoaderRegisterModules( ResourceLoader &$resourceLoader ) {
		$enabledSurveys = self::getEnabledSurveys();

		foreach ( $enabledSurveys as $survey ) {
			$moduleName = $survey->getResourceLoaderModuleName();
			$module = [
				$moduleName => [
					'messages' => $survey->getMessages(),
					'targets' => [ 'desktop', 'mobile' ],
				],
			];

			$resourceLoader->register( $module );
		}

		return true;
	}

In this particular case a module 'ext.quicksurveys.survey.Reader-trust-survey-en-v1' contained an outdated message that had since been updated.

After a few days/clearing localStorage the message updated.

I'm not sure if this indicates a problem in ResourceLoader, or is just something to watch out for when enabling new surveys.

Event Timeline

bmansurov updated the task description. (Show Details)Feb 27 2019, 8:13 PM

@Jdlrobson I'd appreciate your input. Are we doing something wrong?

bmansurov updated the task description. (Show Details)Feb 27 2019, 8:22 PM

No changes since 10th https://github.com/wikimedia/mediawiki-extensions-QuickSurveys/commits/master so it's likely config related.

I was a little confused at which survey you meant. I thought at first you were talking about https://en.wikipedia.beta.wmflabs.org/wiki/Spain?quicksurvey=external-survey-Reader-trust-survey-en-v1

$wgQuickSurveysConfig = [
	// T209882
	[
					'enabled' => true,
					'type' => 'external',
					'name' => 'Reader-trust-survey-en-v1',
					'description' => 'Reader-trust-1-description',
					'link' => 'Reader-trust-1-link',
					'instanceTokenParameterName' => 'token',
					'question' => 'Reader-trust-1-message',
					'privacyPolicy' => 'Reader-trust-1-privacy',
					'coverage' => 1,  // 1 out of 1
					'platforms' => [
									'desktop' => [ 'stable' ],
									'mobile' => [ 'stable' ],
					],
	],
]

but if i'm not mistaken you are referring to this one:
https://en.wikipedia.beta.wmflabs.org/wiki/Spain?quicksurvey=external-survey-reader-demographics-en-pilot

[
        'enabled' => true,
        'name' => 'reader-demographics-en-pilot',
        'type' => 'external',
        'description' => 'Reader-demographics-1-description',
        'link' => 'Reader-demographics-1-link',
        'question' => 'Reader-demographics-1-message',
        'privacyPolicy' => 'Reader-demographics-1-privacy',
        'coverage' => 1, // 1 out of 1
        'instanceTokenParameterName' => 'entry.1791119923',
        'platforms' => [
                'desktop' => [ 'stable' ],
                'mobile' => [ 'stable' ]
        ],
]

I am seeing a JavaScript error in the console:

VM170:90 mediawiki.jqueryMsg: Reader-demographics-1-link: Parse error at position 0 in input: [https://docs.google.com/forms/d/e/1FAIpQLSdEkmzsJphxoAJohZWoll80AT4Q-ExJvia_-lT9bKOL-uofOw/viewform?hl=en]

Work out what's going wrong there and you'll have your solution.
It looks like mw.msg('Reader-demographics-1-privacy') is being shipped with the wrong value to me.

That's correct, we're talking about the reader demographics survey. Strangely, I don't see the error in the console and mw.msg('Reader-demographics-1-privacy') is returning something that looks like this:

"Survey data handled by a third party. [https://foundation.wikimedia.org/wiki/Survey_Privacy_Statement_for_Schema_Revision_15266417]"

The former survey that you linked also has a similar privacy text, but it's showing up fine:

mw.msg('Reader-trust-1-privacy') 
"Survey data handled by a third party. [https://foundation.wikimedia.org/wiki/Wikipedia_Trust_QuickSurvey_Privacy_Statement Privacy]"

The only difference is the links.

So we updated the 'Reader-demographics-1-link' message to remove the brackets and purged the cache, but QS is still showing the old value. Do you know why?

Yep, and this is the wrong message, right? It's not the wikitext I see in https://en.wikipedia.beta.wmflabs.org/wiki/MediaWiki:Reader-demographics-1-privacy (note the invalid wikitext link)

"Survey data handled by a third party. [https://foundation.wikimedia.org/wiki/Survey_Privacy_Statement_for_Schema_Revision_15266417]"

It looks like there is a cache validation problem, and it's showing the edit before this one: https://en.wikipedia.beta.wmflabs.org/w/index.php?title=MediaWiki:Reader-demographics-1-privacy&type=revision&diff=389354&oldid=389251&diffmode=source

Jdlrobson renamed this task from External survey links are not being rendered correctly to Caching problem with QuickSurvey messages.Feb 27 2019, 10:32 PM

I guess this is some kind of caching problem with ResourceLoader/QuickSurveys.
Good news is that this won't happen in production provided the survey isn't rendered/enabled before the message is.

Yes, the message was wrong initially and we fixed it later. Thanks for helping debug the issue, Jon!

Jdlrobson renamed this task from Caching problem with QuickSurvey messages to QuickSurvey messages get cached without ability to update.Feb 28 2019, 10:33 PM
Jdlrobson renamed this task from QuickSurvey messages get cached without ability to update to An interface message key was updated, but an old revision was displayed in the ResourceLoader module for a QuickSurvey.
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)
Restricted Application added a project: Performance-Team. · View Herald TranscriptFeb 28 2019, 10:35 PM
Jdlrobson updated the task description. (Show Details)Feb 28 2019, 10:35 PM
Jdlrobson added a subscriber: Krinkle.

This looks fixed to me now Baha.

@Krinkle (when you have a moment - not too urgent): I'm not seeing any obvious problems in QuickSurveys. Is there any known problems with interface message edits propagating to ResourceLoader?

Good news is that this won't happen in production provided the survey isn't rendered/enabled before the message is.

This suggests a race condition with the message not being specified as a module resource, in which case the failure would be <my message key>. But that doesn't seem to be what happened here. What is the production/beta variance factor in this case?

Is there any known problems with interface message edits propagating to ResourceLoader?

No, not that I know of. Message caching is a pretty stable part of ResourceLoader and continually exercised by each branch deployment. There are no known bugs with it currently.

Having said that, nightly localisation update has been disabled in production for several months now which among other things means that message changes don't propagate except through the train (more or less) and through manual purges.

kchapman moved this task from Inbox to Radar on the Performance-Team board.Mar 4 2019, 9:08 PM
kchapman edited projects, added Performance-Team (Radar); removed Performance-Team.
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMar 19 2019, 3:08 PM
leila edited projects, added Research-Backlog; removed Research.Jul 11 2019, 3:57 PM