Skip to content

build condition stack once per experiment#3238

Merged
bcb37 merged 5 commits into
release/6.5from
hotfix/optimize-ws-condition-stack
Jul 21, 2026
Merged

build condition stack once per experiment#3238
bcb37 merged 5 commits into
release/6.5from
hotfix/optimize-ws-condition-stack

Conversation

@bcb37

@bcb37 bcb37 commented Jul 20, 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 optimizes within-subject experiment assignment by precomputing the (potentially expensive) ordered condition/factor queue once per experiment+user and reusing it across all decision points, rather than rebuilding the queue per decision point.

Changes:

  • Adds a helper to precompute within-subject ordered conditions/factors once per experiment+user.
  • Adds a helper to apply decision-point-specific payloads from a prebuilt lookup map to the precomputed ordering.
  • Updates experiment assignment mapping to reuse the precomputed ordering and payload lookup across decision points.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
packages/backend/src/api/services/ExperimentAssignmentService.ts Precomputes within-subject condition ordering + payload lookup once, then reuses for each decision point.
packages/backend/src/api/Algorithms.ts Introduces new helper functions to precompute within-subject ordering and then apply decision-point payloads efficiently.

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

Comment thread packages/backend/src/api/services/ExperimentAssignmentService.ts Outdated
Comment thread packages/backend/src/api/services/ExperimentAssignmentService.ts Outdated
Comment thread packages/backend/src/api/Algorithms.ts Outdated
Comment on lines +239 to +243
/**
* Applies decision-point-specific payloads to a pre-computed within-subjects condition order
* and returns the final assignment for one decision point. Pair with
* buildWithinSubjectOrderedConditions + a conditionPayloadMap built once per experiment.
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i think this is right, i don't know if there's going to be a need for it?

danoswaltCL
danoswaltCL previously approved these changes Jul 21, 2026

@danoswaltCL danoswaltCL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this looks good to me, just piggybacking on the copilot comment that we don't really need to keep the old implementation method around if it's unused now?

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
bcb37 and others added 2 commits July 21, 2026 13:04
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@danoswaltCL
danoswaltCL self-requested a review July 21, 2026 17:06
danoswaltCL
danoswaltCL previously approved these changes Jul 21, 2026
@bcb37
bcb37 merged commit f77b912 into release/6.5 Jul 21, 2026
5 checks passed
@bcb37
bcb37 deleted the hotfix/optimize-ws-condition-stack branch July 21, 2026 18:16
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.

3 participants