Skip to content

Keep each install in one Unleash experiment cohort across launches (STA-574) - #24991

Open
rjp-coder wants to merge 1 commit into
masterfrom
sta-574-cohort-hash
Open

rjp-coder wants to merge 1 commit into
masterfrom
sta-574-cohort-hash

Conversation

@rjp-coder

Copy link
Copy Markdown

Part of STA-574. Independent of #24969 and the login analytics PR, but needed before vortex-sta-574-login-prompt is switched on in production.

Important

Needs Trust & Safety sign-off before release.

Why

Unleash keeps a user in a percentage-rollout group by userId and, without one, falls back to sessionId, which changes every launch. So a logged-out install, exactly who the STA-574 modal is for, would land in a new cohort each time Vortex opened.

What

The main process now sends properties[experimentCohortHash] on every flag fetch, including the first. It's a salted SHA-256 of the install's instance ID, so it can't be matched to the raw instance ID in telemetry or deployment manifests. It's kept when the renderer updates the logged-in user's context.

What needs sign-off: it's still a stable pseudonymous identifier for the install, sent on every flag fetch regardless of analytics consent.

Unleash setup

  • Add experimentCohortHash as a context field.
  • Create vortex-sta-574-login-prompt as a gradual rollout (for example 50%) that groups users by experimentCohortHash.

Removing it

Delete unleash/experimentCohort.ts, its call in Application.ts, and the setter and property in unleash/client.ts. Rollouts then fall back to Unleash's default stickiness.

Testing

Unit tests cover:

  • the hash: stable per install, different across installs, and never containing the raw ID;
  • the Unleash client: sending it only once set, and keeping it when the renderer sets the context.

Typecheck and lint pass. E2E was not run. Not tested live, because the outgoing flag request isn't visible from the app.

🤖 Generated with Claude Code

…TA-574)

Unleash keeps a user in a percentage-rollout group by `userId`, falling back
to a `sessionId` that changes every launch, so a logged-out install would get
a new cohort each time it opened. The main process now sends
`properties[experimentCohortHash]` on every flag fetch: a salted SHA-256 of
the install's instance ID, which can't be matched to the raw ID. A rollout
can then use it for stickiness.

Needs Trust & Safety sign-off before release: it's a stable per-install ID,
sent regardless of analytics consent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant