Page MenuHomePhabricator

Improve session tick instrument's handling of lack of localStorage
Closed, ResolvedPublic5 Estimated Story Points

Description

sessionTick.js currently has a bug where, if the client does not support localStorage:

The instrument would be fetched, executed, and start ticking. Every tick it would try to read the tick count and last tick from localStorage, which would silently fail, and so would emit a single tick: 1 event. Interestingly, it would idle due to inactivity as usual but when it became active again it would try to read the tick count and last tick from localStorage, which would silently fail, not reset the session and would also emit a single tick: 1

In short, the number of events wouldn't change but they would all be tick: 1 rather than tick: [1,2,3,4,…,n)

Acceptance criteria

  • Session tick instrument checks if localStorage is supported
    • If localStorage is supported, proceed as before
    • If localStorage is not supported:
      • Log an event (see below)
      • Do NOT proceed (do not send a tick)
  • If localStorage is not supported, log an event:
{
  "action": "feature_not_available",
  "action_context": "localStorage"
}
NOTE: L3SC request required before instrument can be turned on, per https://foundation.wikimedia.org/wiki/Legal:Data_Collection_Guidelines
  • The "Session tick feature availability" (session-tick-feature-availability) instrument should produce events to product_metrics.web_base_with_ip stream. It should be configured to have the following contextual attributes:
    • agent_ua_string
    • performer_active_browsing_session_token
    • performer_session_id
    • performer_is_logged_in
  • L3SC request submitted & approved for this HIGH risk data collection activity

Bonus criteria

  • Instead of silently failing in detectPassiveEventListenerSupport(), log an event:
{
  "action": "feature_not_available",
  "action_context": "passiveEventListener"
}

Event Timeline

JVanderhoop-WMF moved this task from Incoming to READY TO GROOM on the Test Kitchen board.
KReid-WMF set the point value for this task to 5.
KReid-WMF moved this task from READY TO GROOM to Backlog on the Test Kitchen board.

Change #1307166 had a related patch set uploaded (by Santiago Faci; author: Santiago Faci):

[mediawiki/extensions/WikimediaEvents@master] sessionTick: Handling whether localStorage is available

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

Change #1307166 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] sessionTick: Handling whether localStorage is available

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

mpopov added a subscriber: Sfaci.

Change #1315936 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/WikimediaEvents@master] sessionTick: Use Test Kitchen to send action=feature_not_available events

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

Change #1315936 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] sessionTick: Use Test Kitchen to send action=feature_not_available events

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

Change #1317814 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/WikimediaEvents@wmf/1.47.0-wmf.12] sessionTick: Use Test Kitchen to send action=feature_not_available events

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

Change #1317814 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@wmf/1.47.0-wmf.12] sessionTick: Use Test Kitchen to send action=feature_not_available events

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

Mentioned in SAL (#wikimedia-operations) [2026-07-27T07:04:43Z] <phuedx@deploy1003> Started scap sync-world: Backport for [[gerrit:1317814|sessionTick: Use Test Kitchen to send action=feature_not_available events (T413296)]]

Mentioned in SAL (#wikimedia-operations) [2026-07-27T07:20:42Z] <phuedx@deploy1003> phuedx: Backport for [[gerrit:1317814|sessionTick: Use Test Kitchen to send action=feature_not_available events (T413296)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-07-27T07:37:16Z] <phuedx@deploy1003> Finished scap sync-world: Backport for [[gerrit:1317814|sessionTick: Use Test Kitchen to send action=feature_not_available events (T413296)]] (duration: 32m 33s)

We decided to launch this instrument (https://test-kitchen.wikimedia.org/instrument/session-tick-feature-availability) as a low risk data collector, so it is configured to send events to web_base stream and use web/base schema – no IP address colleciton.

It is collecting User-Agent strings, but that's the only piece of identifiable information so it's still low risk.

If the bot detection folks want to use this instrument for bot detection work, they'll need to own the escalation of risk level (to high risk) and the steps for that (L3SC request). Reconfiguring will be trivial in TK UI once it's approved.