use working group instead of group for in/exclusions#3118
Open
bcb37 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates inclusion/exclusion matching so experiment and feature flag eligibility uses a user's workingGroup rather than all group memberships.
Changes:
- Replaces group membership expansion with working group mapping in
ExperimentAssignmentService. - Updates/adds unit tests for experiment-level exclusion behavior when
workingGroupdiffers fromgroup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/backend/src/api/services/ExperimentAssignmentService.ts |
Changes group matching input for inclusion/exclusion logic to workingGroup. |
packages/backend/test/unit/services/ExperimentAssignmentService.test.ts |
Updates exclusion test data and adds a negative working-group exclusion case. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2226
to
2230
| if (experimentUser.workingGroup) { | ||
| Object.keys(experimentUser.workingGroup).forEach((type) => { | ||
| userGroups.push({ type, groupId: experimentUser.workingGroup[type] }); | ||
| }); | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
It's true that we need to worry about groupsForSession, but experimentUser.group and experimentUser.workingGroup are not the same type.
Comment on lines
+571
to
+578
| it('[experimentLevelExclusionInclusion] should not return an exclusion reason if a user workingGroup is not on exclusion list', async () => { | ||
| const userDoc = { | ||
| id: 'user2', | ||
| group: { teacher: ['teacher1', 'teacher2'] }, | ||
| workingGroup: { teacher: 'teacher2' }, | ||
| }; | ||
| const exp = structuredClone(simpleIndividualAssignmentExperiment); | ||
| const [includedExperiment, exclusionReason] = await testedModule.experimentLevelExclusionInclusion([exp], userDoc); |
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.
For inclusion/exclusion logic, consider only a user's working group to determine whether to include or exclude them from experiments and feature flags.