Page MenuHomePhabricator

Relax rules for identifiers in base product_metrics schemas
Open, LowPublic3 Estimated Story Points

Description

Currently:

  • performer.session_id
  • performer.active_browsing_session_token
  • performer.pageview_id

all have the same restrictions:

maxLength: 20
minLength: 20
pattern: '^[0-9a-z]{20}$'

Making it impossible to use the schemas for instrumentation outside of wikis where the Test Kitchen SDKs are not available.

For example, it would be great to record a session ID generated by randomUUID() but that generates a 36-character v4 UUID (e.g. "36b8f84d-df4e-4d49-b662-bcde71a8764f") which is incompatible with the current validation rule.

Furthermore, eventually we want to move current session ID generation in the SDKs to UUID (T266813), so this would help with that.

This change would require a major version bump for the schema. Therefore, first do some light research on what other changes we want to make that require major version bumps and group them together. (timebox this)

Acceptance criteria

  • All "major-version-bumping" tasks found above have been added as a subtask of this
  • web/base and app/base schemas updated with looser validation rules for those identifiers (just max character length of 64)
  • extension schemas (e.g. web/translation) also updated

Event Timeline

Turns out it's not such a simple change because even

- maxLength: 20
+ maxLength: 64
minLength: 20
- pattern: '^[0-9a-z]{20}$'

fails schema compatibility test and would warrant a major schema version update.

We could either:

  • backport the change all the materialized versions, making it look like the strict requirements were never there to begin with
  • go to 2.0.0

If we did go to 2.0.0, we could also remove deprecated experiments fragment from the base schemas. Are there any other major changes we would want to include?

@phuedx @Sfaci @cjming: What do you think?

JVanderhoop-WMF moved this task from Incoming to READY TO GROOM on the Test Kitchen board.
Milimetric updated the task description. (Show Details)
Milimetric updated the task description. (Show Details)
KReid-WMF lowered the priority of this task from High to Low.Dec 16 2025, 5:06 PM

Making it impossible to use the schemas for instrumentation outside of wikis where the Test Kitchen SDKs are not available.

Do we have any examples of where we would want to do this (i.e. Apps?) or where we haven't been able to solve a team's problems?

Wikipedia 25 microsite instrumentation had to copy MW's implementation for generating random IDs https://gitlab.wikimedia.org/repos/sre/miscweb/wikipedia25-years-of-wikipedia/-/blob/main/src/utils/generateRandomSessionId.ts?ref_type=heads

But yeah, probably most relevant to the apps where they would probably appreciate being able to rely on built-in, system SDK-provided UUID generating methods rather than having bespoke ID generator that adheres to this decade-old scheme.