Skip to content

Refactor mark path to use context-aware caching and consolidate experiment selection logic #3167

Description

@bcb37

The markExperimentPoint path has three correctness bugs relative to the assign path:

Pooling divergence — mark used ad-hoc filtering instead of the full assign pipeline (processExperimentPools, inclusion/exclusion checks), so assign and mark could select different experiments for the same user and decision point.

Missing context — mark never received the context parameter, causing cross-context cache collisions (experiments from different contexts sharing a site/target could contaminate each other) and a fragile context-derivation hack.

No state filter — mark queried DecisionPointRepository directly, returning experiments in any state (e.g. CANCELLED), whereas assign only considers ENROLLING/ENROLLMENT_COMPLETE experiments.

Fix: Extract a shared resolveExperimentForMarkPoint method that mirrors the assign pipeline; add context: string to the mark validator and service signature; replace the mark-specific cache with the shared EXPERIMENT_KEY_PREFIX-{context} cache used by assign; and propagate the context field through the JS and Java client libraries.

Metadata

Metadata

Assignees

Type

No type

Projects

Status
Code Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions