-
Notifications
You must be signed in to change notification settings - Fork 902
PM-27756: Create common ExitManager #6117
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
Conversation
|
Claude finished @david-livefront's task —— View job PR Review: PM-27756 - Create common ExitManagerThis PR successfully refactors SummaryOverall Assessment: ✅ Approved - This is a well-executed refactoring that improves code organization and maintainability. Key Strengths:
Changes:
Code Quality & ArchitectureArchitectural Compliance: ✅
Code Style: ✅
Testing: ✅
Specific FindingsTest Coverage Note: Implementation Improvement: RecommendationsNo blocking issues found. The PR is ready to merge. Optional Future Enhancement: |
| activity.finishAndRemoveTask() | ||
| } | ||
| } | ||
| } |
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.
👍 Great addition! This test provides coverage for the ExitManagerImpl that was previously annotated with @OmitFromCoverage. The test correctly verifies that exitApplication() calls activity.finishAndRemoveTask().
| /** | ||
| * Provides access to the exit manager throughout the app. | ||
| */ | ||
| val LocalExitManager: ProvidableCompositionLocal<ExitManager> = compositionLocalOf { |
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.
👍 Good location for the common LocalExitManager provider. This follows the established pattern of other shared CompositionLocals like LocalIntentManager and LocalQrCodeAnalyzer, making it easily accessible to both the Password Manager and Authenticator apps.
| * The default implementation of the [ExitManager] for managing the various ways to exit the app. | ||
| */ | ||
| @OmitFromCoverage | ||
| class ExitManagerImpl( |
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.
👍 Excellent improvement! The @OmitFromCoverage annotation was removed from the original app module implementation, and proper unit tests were added in ExitManagerTest.kt. This increases code coverage and confidence in the implementation.
| import com.bitwarden.cxf.ui.composition.LocalCredentialExchangeRequestValidator | ||
| import com.bitwarden.cxf.validator.CredentialExchangeRequestValidator | ||
| import com.bitwarden.cxf.validator.dsl.credentialExchangeRequestValidator | ||
| import com.bitwarden.ui.platform.composition.LocalExitManager |
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.
👍 Clean refactoring. The imports have been correctly updated to use the common ExitManager from the :ui module instead of the app-specific implementation.
| import com.bitwarden.authenticator.ui.platform.manager.permissions.PermissionsManager | ||
| import com.bitwarden.authenticator.ui.platform.manager.permissions.PermissionsManagerImpl | ||
| import com.bitwarden.core.data.manager.BuildInfoManager | ||
| import com.bitwarden.ui.platform.composition.LocalExitManager |
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.
👍 Excellent consolidation! The Authenticator app now properly imports the common LocalExitManager from the :ui module, eliminating code duplication between the two apps.
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6117 +/- ##
=======================================
Coverage 84.89% 84.90%
=======================================
Files 724 724
Lines 52778 52780 +2
Branches 7672 7672
=======================================
+ Hits 44807 44811 +4
+ Misses 5279 5277 -2
Partials 2692 2692 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b56cb8d to
3f07b6e
Compare
| * Provides access to the exit manager throughout the app. | ||
| */ | ||
| val LocalExitManager: ProvidableCompositionLocal<ExitManager> = compositionLocalOf { | ||
| error("CompositionLocal ExitManager not present") |
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.
📝 The missing test coverage reported by Codecov (line 13, the error() call) is expected and acceptable. This error block is only executed when LocalExitManager is accessed without being provided via CompositionLocalProvider, which represents a programming error that would be caught during development, not a runtime scenario that needs test coverage.
| activity.finishAndRemoveTask() | ||
| } | ||
| } | ||
| } |
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.
👍 Excellent test implementation! This test properly verifies that exitApplication() calls activity.finishAndRemoveTask(), providing coverage for the previously untested ExitManagerImpl. The use of MockK with proper verification ensures the correct Android lifecycle method is invoked.
| import com.bitwarden.cxf.ui.composition.LocalCredentialExchangeRequestValidator | ||
| import com.bitwarden.cxf.validator.CredentialExchangeRequestValidator | ||
| import com.bitwarden.cxf.validator.dsl.credentialExchangeRequestValidator | ||
| import com.bitwarden.ui.platform.composition.LocalExitManager |
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.
👍 Perfect consolidation! The imports have been correctly updated to reference the common LocalExitManager from the :ui module, eliminating code duplication. This follows the established pattern of other shared CompositionLocals like LocalIntentManager and LocalQrCodeAnalyzer.
| import com.bitwarden.authenticator.ui.platform.manager.permissions.PermissionsManager | ||
| import com.bitwarden.authenticator.ui.platform.manager.permissions.PermissionsManagerImpl | ||
| import com.bitwarden.core.data.manager.BuildInfoManager | ||
| import com.bitwarden.ui.platform.composition.LocalExitManager |
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.
👍 Great code reuse! The Authenticator app now properly imports the common LocalExitManager from the :ui module instead of maintaining its own duplicate implementation. This eliminates the duplicate ExitManager.kt and ExitManagerImpl.kt files that were previously in the authenticator module, reducing maintenance burden and ensuring consistent behavior across both apps.
Problem: PR #6117 review produced ~800 tokens of excessive praise and unnecessary sections when no issues were found. Expected output should have been ~30 tokens: "APPROVE - Clean refactoring". Changes: - SKILL.md: Add "Clean PRs" section with explicit 2-3 line format - SKILL.md: Make "minimal reviews" first core principle - review-psychology.md: Elevate brevity guidance to first directive - review-outputs.md: Add Example 7 showing PR #6117 as anti-pattern - refactoring.md: Replace verbose example with clean vs issues examples - Add IMPLEMENTATION_PLAN.md documenting rationale and approach Expected Impact: - 70-90% token reduction for clean PRs (800 → 30-100 tokens) - Maintains comprehensive reviews for PRs with actual issues - Reduces noise in PR conversations - Faster approvals for good work 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Problem: PR #6117 review produced ~800 tokens of excessive praise and unnecessary sections when no issues were found. Expected output should have been ~30 tokens: "APPROVE - Clean refactoring". Changes: - SKILL.md: Add "Clean PRs" section with explicit 2-3 line format - SKILL.md: Make "minimal reviews" first core principle - review-psychology.md: Elevate brevity guidance to first directive - review-outputs.md: Add Example 7 showing PR #6117 as anti-pattern - refactoring.md: Replace verbose example with clean vs issues examples - Add IMPLEMENTATION_PLAN.md documenting rationale and approach Expected Impact: - 70-90% token reduction for clean PRs (800 → 30-100 tokens) - Maintains comprehensive reviews for PRs with actual issues - Reduces noise in PR conversations - Faster approvals for good work 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Implements suggestions from PR #6121 review: 1. SKILL.md: Consolidate overlapping brevity principles - Merged 4 principles about brevity into 2 clearer ones - Reduced redundancy while preserving all guidance - Added forward reference to Special Case section 2. review-outputs.md: Add context note to Example 7 - Explains why example was added (PR #6117 verbosity) - Provides historical context for readers - References anti-pattern section below Changes reduce repetition and improve documentation clarity. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Thanks @SaintPatrck |

🎟️ Tracking
PM-27756
📔 Objective
This PR moves the
ExitManagerto the UI module, making it common code.⏰ 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