Page MenuHomePhabricator

[wmf.2] task preview data unavailable: ⧼growthexperiments-newcomertasks-invalid-tasktype⧽
Open, MediumPublicPRODUCTION ERROR

Description

Error
  • mwversion: wmf.2
  • reqId: `` DIg2OHwBfkHq3kAMdo5B
normalized_message
task preview data unavailable: ⧼growthexperiments-newcomertasks-invalid-tasktype⧽
file_url
https://sh.wikipedia.org/w/load.php?lang=en&modules=ext.centralNotice.geoIP%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.cx.eventlogging.campaigns%7Cext.dismissableSiteNotice%2CeventLogging%2CnavigationTiming%2Cpopups%2CwikimediaEvents%7Cext.echo.api%2Cinit%7Cext.growthExperiments.HelpPanel.init%7Cext.growthExperiments.Homepage.Impact%2CLogger%2CLogging%2CStartEditing%2CSuggestedEdits%7Cext.growthExperiments.SuggestedEditSession%7Cext.uls.interface%2Cpreferences%2Cwebfonts%7Cjquery%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Csite%7Cjquery.client%2Ccookie%2CtextSelection%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Crouter%2Cstorage%2Cuser%2Cutil%2CvisibleTimeout%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-content%7Cskins.vector.legacy.js%7Cuser.defaults&skin=vector&version=ixxtt
Impact
  • 28 errors in 24 hours
Notes

https://sh.wikipedia.org/wiki/Special:Homepage?title=Posebno:Po%C4%8Detna_stranica&source=personaltoolslink&namespace=4 will show Special:Homepage with No suggestions and no selected difficulty filters.

Screen Shot 2021-09-30 at 1.56.10 PM.png (1×2 px, 359 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Logstash link (about 20/day). I'll move to the current sprint for investigation.

Tgr triaged this task as Medium priority.Oct 2 2021, 3:15 AM
Tgr moved this task from Incoming to Ready for Development on the Growth-Team (Current Sprint) board.

I was able to reproduce this error locally w/these steps:

  1. Sign in using an account with link recommendation tasks enabled
  2. Selecting only add link task in the suggested edits filter
  3. Opt into image recommendation variant

I'm not sure how this could occur for users in production though. Would it be possible that the user's variant somehow changes?

From logstash, the wikis where this error occurs are those that don't have the links task type (ko, de, fi, sh). It looks like this error is coming from users in the control group and don't have growthexperiments-homepage-se-filters preference set. This is because the default task types, as defined in SuggestedEdits.php, are [ 'copyedit', 'links' ] but there's no links task type for the wiki. Once the user interacts with the filters, the error no longer occurs since the default task types are no longer used.

This shouldn't have any impact in terms of the UX in most cases (the user would still get the copyedit task types, or if there are no tasks, the error card in the suggested edits module should be shown), but perhaps the default task types should take into account the available task types so that this error is not recorded.

Steps to reproduce:

  1. Go to any of the wikis listed above
  2. Enable Growth features and set the user to control group

ge.utils.setUserVariant('control')

  1. Make sure there are no custom suggested edits filters set
new mw.Api().saveOptions({
    'growthexperiments-homepage-se-ores-topic-filters' : '',
    'growthexperiments-homepage-se-filters': ''
})
  1. Reload & go to Special:Homepage

@Tgr @kostajh Instead of SuggestedEdits::DEFAULT_TASK_TYPES would it make sense to make the default task types part of the configuration as well? Or should we check this list against Mediawiki:NewcomerTasks.json?

Default task types should either be retrieved via NewcomerTasksUserOptionsLookup::getDefaultTaskTypes() or passed through TaskTypesAbFilter.filterDefaultTaskTypes().

Also it seems like we forgot to add growthexperiments-newcomertasks-invalid-tasktype to the i18n files.

Hi @Tgr I think my question was unclear. My question was rather should SuggestedEdits::DEFAULT_TASK_TYPES be dynamic based on some configuration so we don't run into this situation where the hard coded task(s) might not be available in the wiki?

	/**
	 * Get default task types when the user has no stored preference.
	 * @param UserIdentity $user
	 * @return string[]
	 */
	private function getDefaultTaskTypes( UserIdentity $user ): array {
		if ( $this->areLinkRecommendationsEnabled( $user ) ) {
			return [ LinkRecommendationTaskTypeHandler::TASK_TYPE_ID ];
		} elseif ( $this->areImageRecommendationsEnabled( $user ) ) {
			return [ ImageRecommendationTaskTypeHandler::TASK_TYPE_ID ];
		} else {
			return SuggestedEdits::DEFAULT_TASK_TYPES;
		}
	}

NewcomerTasksUserOptionsLookup::getDefaultTaskTypes() and TaskTypesAbFilter.filterDefaultTaskTypes() are the mechanism to make default task types dynamic, we probably just forgot to call one of them somewhere.

Hi @Tgr I think my question was unclear. My question was rather should SuggestedEdits::DEFAULT_TASK_TYPES be dynamic based on some configuration so we don't run into this situation where the hard coded task(s) might not be available in the wiki?

	/**
	 * Get default task types when the user has no stored preference.
	 * @param UserIdentity $user
	 * @return string[]
	 */
	private function getDefaultTaskTypes( UserIdentity $user ): array {
		if ( $this->areLinkRecommendationsEnabled( $user ) ) {
			return [ LinkRecommendationTaskTypeHandler::TASK_TYPE_ID ];
		} elseif ( $this->areImageRecommendationsEnabled( $user ) ) {
			return [ ImageRecommendationTaskTypeHandler::TASK_TYPE_ID ];
		} else {
			return SuggestedEdits::DEFAULT_TASK_TYPES;
		}
	}

The problem is that we don't have access to user identity here, because it's called in a ResourceLoader context:

public static function getDefaultTaskTypesJson( ResourceLoaderContext $context ) {
	// HACK For the duration of the link recommendation A/B test (T278123), the default
	// task types should be [ 'link-recommendation' ] for users who have been opted into
	// link recommendations. We can't access user identity here though, so that will
	// have to be done on the client side.
	return SuggestedEdits::DEFAULT_TASK_TYPES;
}

That function is used in ResourceLoader as "DefaultTaskTypes.json", and as far as I can tell, all calls to it are wrapped with the TaskTypesAbFilter e.g. TaskTypesAbFilter.filterDefaultTaskTypes( require( './DefaultTaskTypes.json' ) ).

Yeah, we can't make ResourceLoader dynamic assets dependent on the user as that would be incompatible with RL's caching model. This is a server-side error though, growthexperiments-newcomertasks-invalid-tasktype is used in SearchTaskSuggester when the task type is not present in ConfiugrationLoader. ConfiugrationLoader does not care about user settings; maybe this is related to some task type missing from the task configuration JSON page, or being filtered out due to feature flags, but still being requested. Which I guess is what @mewoph was asking and I didn't understand - yeah, making NewcomerTasksUserOptionsLookup::getDefaultTaskTypes() take wiki configuration (that is, the return from ConfigurationLoader) into account, not just user preferences, would be one way to fix this. Probably the easiest way.

Change 730885 had a related patch set uploaded (by MewOphaswongse; author: MewOphaswongse):

[mediawiki/extensions/GrowthExperiments@master] Suggested Edits: Take into account the available task types in NewcomerTasksUserOptionsLookup::getDefaultTaskTypes

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

Change 730885 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Suggested Edits: Take into account the available task types in NewcomerTasksUserOptionsLookup::getDefaultTaskTypes

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

Last error was recorded on Oct 21, 2021 @ 13:00:39.886, wmf.5 seems free of such errors.

Sgs added a subscriber: Sgs.

Re-opening since logstash is logging errors with the same message. The events come from akwiki, taking a look at their NewcomerTasks.json config, I can only see link-recommendation task types. Is that expected or could be related to this failure?

Error
normalized_message
task preview data unavailable: Invalid task type(s):
exception.trace
at initSuggestedTasks  https://ak.wikipedia.org/w/load.php?lang=ak&modules=ext.growthExperiments.Homepage.SuggestedEdits%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=19rpw:2:873\nat https://ak.wikipedia.org/w/load.php?lang=ak&modules=ext.growthExperiments.Homepage.SuggestedEdits%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=19rpw:3:622\nat ext.growthExperiments.Homepage.SuggestedEdits/index.js  https://ak.wikipedia.org/w/load.php?lang=ak&modules=ext.growthExperiments.Homepage.SuggestedEdits%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=19rpw:3:918\nat runScript  https://ak.wikipedia.org/w/load.php?lang=ak&modules=startup&only=scripts&raw=1&skin=vector:12:277\nat Array.<anonymous>  https://ak.wikipedia.org/w/load.php?lang=ak&modules=startup&only=scripts&raw=1&skin=vector:12:957\nat flushCssBuffer  https://ak.wikipedia.org/w/load.php?lang=ak&modules=startup&only=scripts&raw=1&skin=vector:4:900
Impact

6 events in the last week just in Akan wiki.

Notes

Re-checked logstash - normalized_message: "task preview data unavailable: Invalid task type(s)'" error appears on two wiki - akwiki and abwiki; there are 21 errors per last month (the last one - Jul 6, 2022 @ 23:36:30.374).

  • akwiki doesn't have any types of task available (link-recommendation is not enabled)
  • abwiki has only link-recommendation

The reasons to fix the error:

  • the errors give a false alarm that might lead to additional checking
  • in the case of wikis where are no task types at all, it'd be nice to communicate the fact to users (or not to have SE module displayed at all).

The task is a low priority and given the low rate of errors and only two wikis seemingly triggering the error, probably it's ok to close it by now.

Resetting inactive assignee - please unassign tasks in a team in such cases. Thanks.

43 of these in the last 90 days, although the log message (task preview data unavailable: Invalid task type(s): ) now indicates that both $taskTypes and $invalidTaskTypes are empty.