Skip to content

Wip/share pooling add context to mark#3180

Draft
bcb37 wants to merge 8 commits into
devfrom
wip/share-pooling-add-context-to-mark
Draft

Wip/share pooling add context to mark#3180
bcb37 wants to merge 8 commits into
devfrom
wip/share-pooling-add-context-to-mark

Conversation

@bcb37

@bcb37 bcb37 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the backend “mark” path to make experiment resolution consistent with the “assign” path by introducing an explicit context parameter, switching mark-time experiment selection to use context-scoped cached experiments, and adding integration coverage for state filtering and cross-context isolation.

Changes:

  • Add context to mark request validation and thread it through controllers → ExperimentAssignmentService.markExperimentPoint.
  • Replace mark-specific decision-point caching with getCachedValidExperiments(context) and consolidate selection logic in resolveExperimentForMarkPoint.
  • Expand integration tests to validate cancelled-experiment exclusion and prevent cross-context experiment pool contamination; update JS/Java clients to send context in mark requests.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/backend/test/integration/utils/index.ts Updates test helper to pass context into markExperimentPoint.
packages/backend/test/integration/UserNotDefined/index.ts Adjusts mark call signature in the “user not defined” integration case.
packages/backend/test/integration/index.test.ts Registers new integration test cases for mark behavior.
packages/backend/test/integration/Experiment/withinSubject/MetricQueriesCheck.ts Threads context through within-subject metric query mark calls.
packages/backend/test/integration/Experiment/stratification/MetricQueriesCheck.ts Threads context through stratification metric query mark calls.
packages/backend/test/integration/Experiment/markExperimentPoint/NoExperiment.ts Passes explicit context when marking in the NoExperiment case.
packages/backend/test/integration/Experiment/markExperimentPoint/index.ts Exposes new markExperimentPoint integration test cases.
packages/backend/test/integration/Experiment/markExperimentPoint/ContextContamination.ts Adds integration test ensuring no cross-context contamination for shared site/target.
packages/backend/test/integration/Experiment/markExperimentPoint/CancelledExperimentStateFilter.ts Adds integration test ensuring cancelled experiments are excluded from mark resolution.
packages/backend/test/integration/Experiment/experimentContext/ExperimentContextAssignments.ts Updates experiment-context integration flow to pass mark context.
packages/backend/src/api/services/ExperimentService.ts Simplifies cache invalidation to remove mark-cache key deletion.
packages/backend/src/api/services/ExperimentAssignmentService.ts Adds context-aware experiment resolution for mark and consolidates selection logic.
packages/backend/src/api/controllers/validators/MarkExperimentValidator.v6.ts Makes context required for v6 mark requests.
packages/backend/src/api/controllers/validators/MarkExperimentValidator.v5.ts Adds optional context for v5 mark requests (backward compatibility).
packages/backend/src/api/controllers/ExperimentClientController.v6.ts Passes validated context through to mark service call.
packages/backend/src/api/controllers/ExperimentClientController.v5.ts Passes optional context (currently defaulting to empty string) to mark service call.
docs/mark-context-refactor-plan.md Documents the rationale and phased plan for the mark-path refactor.
clientlibs/js/src/UpGradeClient/generateUUID.spec.ts Minor test cleanup (trailing whitespace removal).
clientlibs/js/src/types/requests.ts Adds context to the JS mark request body type.
clientlibs/js/src/ApiService/ApiService.ts Includes configured context in JS mark request bodies.
clientlibs/js/src/ApiService/ApiService.spec.ts Adds JS client tests verifying context is included in mark requests.
clientlibs/java/src/main/java/org/upgradeplatform/requestbeans/MarkExperimentRequest.java Adds context to the Java mark request bean and constructors.
clientlibs/java/src/main/java/org/upgradeplatform/client/ExperimentClient.java Threads client context into Java mark request construction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/backend/src/api/services/ExperimentAssignmentService.ts
Comment on lines +159 to +165
return {
experiments: [],
experimentId,
isUserExcluded: false,
isGroupExcluded: false,
exclusionReason: [],
};
Comment on lines 481 to 485
experiment.status,
experiment.data.assignedCondition?.conditionCode ?? null,
request.logger,
experiment.context ?? '',
experiment.data.assignedCondition?.experimentId ?? null,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants