Page MenuHomePhabricator

events log with _ok: true even with validation errors
Closed, ResolvedPublic

Description

mw.eventLog.logEvent( 'CommunityPortal', { } );
will log with _ok: true despite obvious schema violations and the console warning (if ?debug=1):

Missing "token" property

This happens because the $.each( properties, ...) iterator in validate() in modules/ext.eventLogging.core.js does not propagate a return false from a property test; it halts iteration but the validate() function continues on and returns true.

I'm puzzled that the qunit tests of validate in http://localhost/wiki/index.php/Special:JavaScriptTest/qunit?module=ext.EventLogging all pass. They, e.g. assert.throws(... /Missing/), and even though validate() doesn't throw errors any more, they all pass.

BTW, it would be nice if the mw.eventLog.schemas.<Name>.logged included the system fields such as _ok.


Version: unspecified
Severity: minor

Details

Reference
bz43550

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:15 AM
bzimport set Reference to bz43550.

Gerrit 41826 helps.

I think the self.warn() warnings in validate() must trigger an exception in qunit testing, so the tests pass even though in normal operation validate() doesn't cause an exception. Seems like a qunit misfeature.

[moving from MediaWiki extensions to Analytics product - see bug 61946]