Skip to content

PM-37985: Feat: Use PolicyView in the app#6966

Merged
david-livefront merged 1 commit into
mainfrom
PM-37985-policy-view
May 26, 2026
Merged

PM-37985: Feat: Use PolicyView in the app#6966
david-livefront merged 1 commit into
mainfrom
PM-37985-policy-view

Conversation

@david-livefront
Copy link
Copy Markdown
Collaborator

@david-livefront david-livefront commented May 22, 2026

🎟️ Tracking

PM-37985

📔 Objective

This PR updates the PolicyManager to use PolicyView as the primary policy model. All downstream users of PolicyManager have been updated as well.

@david-livefront david-livefront requested a review from a team as a code owner May 22, 2026 20:31
@github-actions github-actions Bot added the app:password-manager Bitwarden Password Manager app context label May 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 95.55556% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.07%. Comparing base (b53d3fb) to head (982e42d).

Files with missing lines Patch % Lines
...n/ui/tools/feature/generator/GeneratorViewModel.kt 0.00% 2 Missing ⚠️
...twarden/data/platform/manager/PolicyManagerImpl.kt 90.90% 0 Missing and 1 partial ⚠️
...a/platform/manager/util/PolicyManagerExtensions.kt 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6966      +/-   ##
==========================================
- Coverage   86.21%   86.07%   -0.14%     
==========================================
  Files        1007      917      -90     
  Lines       66068    65366     -702     
  Branches     9267     9244      -23     
==========================================
- Hits        56962    56267     -695     
- Misses       5912     5928      +16     
+ Partials     3194     3171      -23     
Flag Coverage Δ
app-data 16.78% <65.55%> (-0.48%) ⬇️
app-ui-auth-tools 19.06% <7.95%> (-0.34%) ⬇️
app-ui-platform 16.81% <12.50%> (-0.24%) ⬇️
app-ui-vault 28.42% <19.31%> (-0.02%) ⬇️
authenticator 6.25% <0.00%> (+0.02%) ⬆️
lib-core-network-bridge 4.10% <0.00%> (+<0.01%) ⬆️
lib-data-ui 1.15% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@david-livefront david-livefront changed the title PM-37985: Use PolicyView in the app PM-37985: Feat: Use PolicyView in the app May 22, 2026
@david-livefront david-livefront added the ai-review-vnext Request a Claude code review using the vNext workflow label May 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR is a mechanical refactor that migrates PolicyManager and 25+ call sites from SyncResponseJson.Policy/PolicyTypeJson to the SDK's PolicyView/PolicyType. The new VaultSdkPolicyExtensions utility converts network policies into SDK views with exhaustive coverage of all 22 PolicyTypeJson values, and JSON data is serialized to a string for the SDK shape. The four type renames (ONLY_ORGSINGLE_ORG, PERSONAL_OWNERSHIPORGANIZATION_DATA_OWNERSHIP, FREE_FAMILIES_SPONSORSHIP_POLICYFREE_FAMILIES_SPONSORSHIP, RESTRICT_ITEM_TYPESRESTRICTED_ITEM_TYPES) are deliberate alignments to SDK naming. Tests are updated comprehensively, with a dedicated VaultSdkPolicyExtensionsTest covering conversion, JSON-string serialization, and the full type-mapping table.

Code Review Details

No actionable findings. The refactor is correctly typed, the policy-type mapping is exhaustive, the read-side policyInformation extension correctly switches from JsonObject.toString() to direct String? decoding, mock factories (createMockPolicyView / createMockPolicy) share aligned default values, and patch coverage is 95.55%.

@david-livefront david-livefront added the t:feature Change Type - Feature Development label May 22, 2026
@david-livefront david-livefront enabled auto-merge May 26, 2026 15:49
val hasPersonalOwnershipRestrictedOrg = getUserPolicies(
userId,
PolicyTypeJson.PERSONAL_OWNERSHIP,
PolicyType.ORGANIZATION_DATA_OWNERSHIP,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Just want to sanity check; this is the SDK equivalent of PERSONAL_OWNERSHIP?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the SDK looks like this:

    ORGANIZATION_DATA_OWNERSHIP(5u),

And ours looks like this:

    @SerialName("5")
    PERSONAL_OWNERSHIP,

@david-livefront david-livefront added this pull request to the merge queue May 26, 2026
@david-livefront
Copy link
Copy Markdown
Collaborator Author

Thanks @SaintPatrck

Merged via the queue into main with commit 3732672 May 26, 2026
37 checks passed
@david-livefront david-livefront deleted the PM-37985-policy-view branch May 26, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review-vnext Request a Claude code review using the vNext workflow app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants