Repository navigation
[PM-39833] Migrate POLICIES_NEW back to POLICIES - #24407
Conversation
Clients kept two parallel policy states: POLICIES (confirmed only) and POLICIES_NEW (accepted and confirmed). Consolidate on a single POLICIES state holding the accepted and confirmed data. - Add state migration 87 to copy policiesNew over policies when present - Read and write POLICIES only in DefaultPolicyService - Remove InternalNewPolicyService and DefaultNewPolicyService - Sync policiesNew (falling back to policies) into POLICIES POLICIES_NEW is deprecated but kept for removal in PM-45288.
…olicies-new-state
| ) => | ||
| new DefaultPolicyService( | ||
| stateProvider, | ||
| organizationService, | ||
| accountService, | ||
| newPolicyService, | ||
| () => injector.get(SdkService), | ||
| new DefaultPolicyService(stateProvider, organizationService, accountService, () => | ||
| injector.get(SdkService), | ||
| ), |
This comment was marked as low quality.
This comment was marked as low quality.
Sorry, something went wrong.
| const policies: { [id: string]: PolicyData } = {}; | ||
| source.forEach((p) => { | ||
| source?.forEach((p) => { |
There was a problem hiding this comment.
When both response and fallback are absent, this builds an empty map that replaces stored policies, erasing existing data. Preserve the existing state when the sync response contains no policy data.
Show fix
| const policies: { [id: string]: PolicyData } = {}; | |
| source.forEach((p) => { | |
| source?.forEach((p) => { | |
| if (source == null) { | |
| return; | |
| } | |
| const policies: { [id: string]: PolicyData } = {}; | |
| source.forEach((p) => { |
Details
✨ AI Reasoning
Previously, when both policiesNew and policies were absent, the sync method returned without changing stored policies. The new optional iteration still calls replace with an empty map in that case, erasing existing policy state on a response that provides no policy data.
Reply on this comment to give feedback or ignore the issue.
More info
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR merges the |
Changes in this PR impact the Autofill experience of the browser clientBIT has tested the core experience with these changes and the feature flag configuration used by ✅ Fortunately, these BIT tests have passed! 🎉 |
Changes in this PR impact the Autofill experience of the browser clientBIT has tested the core experience with these changes and all feature flags disabled. ✅ Fortunately, these BIT tests have passed! 🎉 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24407 +/- ##
=======================================
Coverage 61.73% 61.74%
=======================================
Files 4900 4899 -1
Lines 158167 158148 -19
Branches 25350 25348 -2
=======================================
- Hits 97652 97642 -10
+ Misses 53784 53777 -7
+ Partials 6731 6729 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-39833
https://bitwarden.atlassian.net/browse/PM-45288
📔 Objective
Current state:
POLICIEScontains policies for confirmed organizations only, and is no longer used.POLICIES_NEWcontains policies for accepted and confirmed organizations, and is used by policyService.This PR copies
POLICIES_NEWback toPOLICIES; updates consumers to read fromPOLICIES; and dropsPOLICIES_NEW. This closes the loop so that we have a single state definition without theNEWsuffix.📸 Screenshots