-
Notifications
You must be signed in to change notification settings - Fork 86
[PM-27047] Segregate out a BiometricsStateService into BitwardenKit #2192
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
base: main
Are you sure you want to change the base?
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
|
Claude finished @KatherineInCode's task in 3m 3s —— View job Code Review Complete ✓Review completed and posted inline. |
| if let setBiometricAuthenticationEnabledError { | ||
| throw setBiometricAuthenticationEnabledError | ||
| } | ||
| biometricAuthenticationEnabledResult = .success(isEnabled ?? false) |
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.
📝 Observation: The mock implementation stores the result of setBiometricAuthenticationEnabled in biometricAuthenticationEnabledResult, which creates bidirectional coupling between the setter and getter.
While this works for simple test scenarios, it means that setting isEnabled = nil will be stored as false, which may not accurately reflect the behavior of the real implementation. Consider whether tests need to verify the actual value passed vs. the stored state separately.
This is fine for current test needs, but worth noting for future test scenarios.
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 do this elsewhere in our mocks, I believe, so I'm comfortable with this for now. In the PR where I bring the BiometricsRepository into BitwardenKit, I might do a re-look through all the tests and decide to change this then.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2192 +/- ##
==========================================
- Coverage 85.53% 84.22% -1.32%
==========================================
Files 1737 1979 +242
Lines 147232 162342 +15110
==========================================
+ Hits 125942 136734 +10792
- Misses 21290 25608 +4318 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // MARK: Biometrics | ||
|
|
||
| extension DefaultStateService { | ||
| extension DefaultStateService: BiometricsStateService { |
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.
🤔 Do we want to remove the getBiometricAuthenticationEnabled()/setBiometricAuthenticationEnabled() definitions from the StateService protocol now that these are covered by BiometricsStateService? Maybe we haven't done that elsewhere, but it seems like it would be better to?
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'm comfortable with that, especially as we have the pattern here of a separate extension for the segregated protocol. I'll make the change.
|
Overall Assessment: APPROVE Reviewed interface segregation refactoring moving BiometricsStateService into BitwardenKit across 6 files. |

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-27047
📔 Objective
Following the Interface Segregation Principle, this segregates out the Biometrics-relevant parts of
StateServiceinto aBiometricsStateService, which is then pulled intoBitwardenKit.The PM
BiometricsRepositoryhas been updated to use this; BWA has not, as in a future PR the PM one will also be pulled intoBitwardenKit, and used in BWA, which will result in some changed functionality. That is, theBiometricsRepositoryclasses in PM and BWA have diverged due to changes being made in PM but not BWA, and will eventually re-merge following the newer implementation. As updating BWA now would require building out functions inBiometricsStateServicethat will just be taken out at that time, it didn't seem the prudent thing to do.⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes