-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check subfeature state before reading rollout data #649
Conversation
68d9715
to
b11b744
Compare
let satisfiesMinVersion = satisfiesMinVersion(subfeatureData?.minSupportedVersion, versionProvider: versionProvider) | ||
|
||
switch subfeatureData?.state { | ||
case PrivacyConfigurationData.State.enabled: | ||
guard satisfiesMinVersion else { return .disabled(.appVersionNotSupported) } | ||
|
||
return .enabled | ||
case PrivacyConfigurationData.State.internal: | ||
guard internalUserDecider.isInternalUser else { return .disabled(.limitedToInternalUsers) } | ||
guard satisfiesMinVersion else { return .disabled(.appVersionNotSupported) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably could extract this from 202 and 205 lines to 208 to simplify logic flow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was considering this, but it means for internal user we would enable subfeature regardless of supported version and moving these two checks before state verification would result in reporting not supported version before disabled (not sure if this is a concern). I’d prefer to keep it as it is TBH.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Good job!
* main: add alternateHtmlLoad navigation type (HTML Error Page) (#644) Check subfeature state before reading rollout data (#649) Add NavigationPreferences CustomHeaderFields (#651) Update autofill to 10.1.0 (#643) Add Autoconsent onByDefault subfeature (#647) Add error codes to site breakage reports (#642) Run unit tests also on iOS Simulator (#641) Improve VPN auth token storage (#639) Bump content-scope-scripts to 4.59.2 (#638) Fix `site:` queries escaping with iOS 17 SDK (#640) Breakage improvement (#621) Don't report CancellationError from BookmarksFaviconsFetcher (#634) Add explicit mapping of SyncError to error code (#637)
Asana task(s): https://app.asana.com/0/414235014887631/1206494747562366/f
iOS PR: duckduckgo/iOS#2426
macOS PR: duckduckgo/macos-browser#2152
What kind of version bump will this require?: Patch
Description:
This fix comprises of two parts:
Fix subfeature state resolution logic
Rollout state is checked before the global subfeature state, resulting in reporting invalid reason for it being disabled. This rearranges the rollout check so it’s performed as the last one.
Fix (flaky) test
Because the test subject was given a real randomizer, it produced mixed results - in 85% of chances leaning towards an invalid value. Passing mocked randomizer makes it stable.
Steps to test this PR: