Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Enrollment change events (visible to the UDL) now include the feature IDs of the features involved when possible. ([#7391](https://github.com/mozilla/application-services/pull/7391/))
- Fixed a bug where enrollment change events were not emitted for rollouts that re-enrolled after previously unenrolling. ([#7391](https://github.com/mozilla/application-services/pull/7391/))
- Attempting to opt-out from an experiment that is not currently enrolled is now a no-op. ([#7399](https://github.com/mozilla/application-services/pull/7399))

[Full Changelog](In progress)

Expand Down
9 changes: 2 additions & 7 deletions components/nimbus/src/enrollment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,8 @@ impl ExperimentEnrollment {
out_enrollment_events.push(enrollment.get_change_event(experiment));
enrollment
}
EnrollmentStatus::NotEnrolled { .. } => Self {
slug: self.slug.to_string(),
status: EnrollmentStatus::NotEnrolled {
reason: NotEnrolledReason::OptOut, // Explicitly set the reason to OptOut.
},
},
EnrollmentStatus::Disqualified { .. }
EnrollmentStatus::NotEnrolled { .. }
| EnrollmentStatus::Disqualified { .. }
| EnrollmentStatus::WasEnrolled { .. }
| EnrollmentStatus::Error { .. } => {
// Nothing to do here.
Expand Down
16 changes: 4 additions & 12 deletions components/nimbus/src/tests/test_enrollment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3749,11 +3749,9 @@ fn test_enrollment_enrolled_explicit_opt_out() {
#[cfg(feature = "stateful")]
None,
);
if let EnrollmentStatus::Disqualified { branch, .. } = enrollment.status {
assert_eq!(branch, "control");
} else {
panic!("Wrong variant!");
}
assert!(
matches!(enrollment.status, EnrollmentStatus::Disqualified { branch, .. } if branch == "control")
);
assert_eq!(
&events,
&[EnrollmentChangeEvent {
Expand Down Expand Up @@ -3782,13 +3780,7 @@ fn test_enrollment_not_enrolled_explicit_opt_out() {
#[cfg(feature = "stateful")]
None,
);
assert!(matches!(
enrollment.status,
EnrollmentStatus::NotEnrolled {
reason: NotEnrolledReason::OptOut,
..
}
));
assert_eq!(enrollment, existing_enrollment);
assert_eq!(&events, &[]);
}

Expand Down