Hotfix/cycle within subject conditions by experiment#3201
Merged
bcb37 merged 5 commits intoJun 30, 2026
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes within-subject experiment assignment so that all decision points in the same experiment share a single rotation counter (based on repeated enrollment count), ensuring consistent condition ordering across those decision points.
Changes:
- Update repeated-enrollment counting to be keyed by
experimentId(instead of decision point / partition), and adjust the query grouping accordingly. - Update within-subject assignment mapping to use the experiment-level repeated enrollment count for all partitions.
- Add a unit test verifying consistent rotation across multiple decision points within the same within-subject experiment.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/backend/test/unit/services/ExperimentAssignmentService.test.ts | Adds a unit test ensuring multiple decision points share a single rotation counter in within-subject experiments. |
| packages/backend/src/api/services/ExperimentAssignmentService.ts | Switches repeated-enrollment lookup from decision-point IDs to experiment IDs and applies the shared count across partitions. |
| packages/backend/src/api/repositories/RepeatedEnrollmentRepository.ts | Changes the repeated-enrollment count shape and query to return counts grouped by user + experiment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
danoswaltCL
approved these changes
Jun 30, 2026
bcb37
added a commit
that referenced
this pull request
Jul 1, 2026
* use the aggregated count for all repeated enrollments to determine round-robin cycle * get results for each experiment, rather than all * explicit type * fix query * add unit test for single rotation counter across DPs --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.