Page MenuHomePhabricator

[Bug] Bad tracking on edit abort
Closed, ResolvedPublic

Description

Steps to Reproduce

  1. Open the developer console
  2. Visit a user page on the mobile site with the MinervaNeue skin. E.g., https://en.m.wikipedia.beta.wmflabs.org/wiki/User:Teststephen?debug=true.
  3. Tap the edit pencil
  4. Tap the close cross

Note: schema.EditAttemptStep is deprecated.

Call stack
mf.schemaEditAttemptStep: Unrecognized action abort
computeDuration	@	schemaEditAttemptStep.js?026db:84
(anonymous)	@	schemaEditAttemptStep.js?026db:99
handler	@	mediawiki.base.js?80f9f:333
fire	@	jquery.js?6a07d:3268
fireWith	@	jquery.js?6a07d:3398
fire	@	jquery.js?6a07d:3406
mw.track	@	mediawiki.base.js?80f9f:309
log	@	EditorOverlayBase.js?5fee0:176
onExitClick	@	EditorOverlayBase.js?5fee0:341
dispatch	@	jquery.js?6a07d:5183
elemData.handle	@	jquery.js?6a07d:4991
schemaEditAttemptStep.js
...
		function computeDuration( action, event, timeStamp ) {
			// This is duplicated from the VisualEditor extension
			// (ve.init.mw.trackSubscriber.js). Changes to this should be kept in
			// sync with that file, so the data remains consistent.
			if ( event.timing !== undefined ) {
				return event.timing;
			}

			switch ( action ) {
				case 'ready':
					return timeStamp - timing.init;
				case 'loaded':
					return timeStamp - timing.init;
				case 'saveIntent':
					return timeStamp - timing.ready;
				case 'saveAttempt':
					return timeStamp - timing.saveIntent;
				case 'saveSuccess':
				case 'saveFailure':
					// HERE BE DRAGONS: the caller must compute these themselves
					// for sensible results. Deliberately sabotage any attempts to
					// use the default by returning -1
					mw.log.warn( 'mf.schemaEditAttemptStep: Do not rely on default timing value for saveSuccess/saveFailure' );
					return -1;
				case 'abort':
					switch ( event.type ) {
						case 'preinit':
							return timeStamp - timing.init;
						case 'nochange':
						case 'switchwith':
						case 'switchwithout':
						case 'switchnochange':
						case 'abandon':
							return timeStamp - timing.ready;
						case 'abandonMidsave':
							return timeStamp - timing.saveAttempt;
					}
			}
			mw.log.warn( 'mf.schemaEditAttemptStep: Unrecognized action', action );
			return -1;
		}
...
event
abort_mechanism: "cancel"
abort_type: "nochange"
action: "abort"
editing_session_id: "6acfc0f1bbffa8edceba"
editor_interface: "wikitext"

^-- no type!

Expected Results

  • A silent successful event is logged

Actual Results

  • The event appears to be missing an expected type property and logging seems to fail

Environments Observed

  • English beta cluster

Browser Version

  • Chrome v71.0.3578.57

OS Version

  • Chrome OS v71.0.3578.57

Device Model

  • Pixel Slate

Device Language

  • English

Event Timeline

Restricted Application changed the subtype of this task from "Deadline" to "Task". · View Herald TranscriptDec 10 2018, 3:37 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 478825 had a related patch set uploaded (by Niedzielski; owner: Catrope):
[mediawiki/extensions/MobileFrontend@master] schemaEditAttemptStep: Compute duration before deleting data.type

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

Jdlrobson added a subscriber: Jdlrobson.

Seems well defined and there's a patch for review...

After a closer look it looks like the editing team have this under control.

Change 478825 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] schemaEditAttemptStep: Compute duration before deleting data.type

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

This still seems to be an issue:

mf.schemaEditAttemptStep: Unrecognized abort type nochange
(anonymous) @ schemaEditAttemptStep.js:90
(anonymous) @ schemaEditAttemptStep.js:104
handler @ mediawiki.base.js?946c1:366
fire @ jquery.js?6a07d:3268
fireWith @ jquery.js?6a07d:3398
fire @ jquery.js?6a07d:3406
mw.track @ mediawiki.base.js?946c1:342
log @ EditorOverlayBase.js:179
onExitClick @ EditorOverlayBase.js:408
dispatch @ jquery.js?6a07d:5183
elemData.handle @ jquery.js?6a07d:4991

Change 489789 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/extensions/MobileFrontend@master] Define abort type and abort mechanism

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

Change 489789 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Define abort type and abort mechanism

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