Use gitlab_experiment schema 1-0-3 for experiment tracking

What does this MR do and why?

This MR bumps the Snowplow context schema used for gitlab_experiment tracking from 1-0-0 to 1-0-3 in five places:

  • config/initializers/gitlab_experiment.rb (backend tracking_behavior)
  • app/assets/javascripts/experimentation/constants.js (TRACKING_CONTEXT_SCHEMA, used by the frontend Tracking mixin and getAllExperimentContexts)
  • app/assets/javascripts/experimentation/utils.js (comment only)
  • spec/experiments/application_experiment_spec.rb, ee/spec/requests/api/experiments_spec.rb (assertions on the schema string)

All five changes are plain string edits. No logic changes.

Until August 2026, ApplicationExperiment overrode the gitlab-experiment gem's key_for method to hash context keys with MD5, producing 32-character keys. That override was removed (see #334590 (closed)), so gitlab-experiment 2.0.0 now generates 64-character SHA-256 keys instead.

Schema 1-0-0 has maxLength: 32 on key. Snowplow now rejects every event that carries the experiment context, with $.key: may only be 32 characters long. David Hamp-Gonsalves confirmed this in the staging bad-events table for the change_dap_land_default_credits experiment (https://gitlab.com/gitlab-org/gitlab/-/work_items/619294#note_3783299818): both click_purchase_credits_dap_land_sku and finish_purchase_credits_dap_land_sku are rejected, with zero good events landing. This affects every new experiment, not just this one.

Schema 1-0-3 has existed in the iglu registry since November 2021: https://gitlab.com/gitlab-org/iglu/-/blob/master/public/schemas/com.gitlab/gitlab_experiment/jsonschema/1-0-3. It sets maxLength: 64 and additionalProperties: true, so no iglu change is required here.

The existing whats_new_placement experiment still emits 32-character MD5 keys, which remain valid under the new 64-character limit, so this change is backward compatible. Downstream, the analytics dbt models match the schema by prefix (LIKE 'iglu:com.gitlab/gitlab_experiment/jsonschema/%'), so events on any 1-0-x version land in the same columns.

References

Resolves #361792, which has asked for this exact schema bump since 2022.

Related: https://gitlab.com/gitlab-org/gitlab/-/issues/619294 (staging bad-events evidence for change_dap_land_default_credits).

Removal of the MD5 override that made this necessary: #334590 (closed).

Schema 1-0-3 definition: https://gitlab.com/gitlab-org/iglu/-/blob/master/public/schemas/com.gitlab/gitlab_experiment/jsonschema/1-0-3.

Screenshots or screen recordings

Not applicable. This is a string constant change with no UI impact.

How to set up and validate locally

  1. Run the updated specs:

    • spec/experiments/application_experiment_spec.rb
    • ee/spec/requests/api/experiments_spec.rb
    • spec/frontend/experimentation
    • spec/frontend/tracking

    All pass locally with this change.

  2. Optionally, with this branch running, trigger any experiment tracking event and inspect the Snowplow context schema on the outgoing request (Snowplow Micro, or the browser network tab). It should read iglu:com.gitlab/gitlab_experiment/jsonschema/1-0-3.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

  • No changelog entry: this is internal analytics plumbing, not a user-facing change.
  • No feature flag: this is a string constant change, low risk, and fully backward compatible with existing 32-character keys.
  • No database or security review needed: no schema, query, or permission changes.
Edited by Roy Liu

Merge request reports

Loading
Loading