Skip to content

[PM-40527] feat: Add SendControls policy data model and feature flags#7179

Open
andrebispo5 wants to merge 2 commits into
mainfrom
PM-40527-send-controls-policy-data-model
Open

[PM-40527] feat: Add SendControls policy data model and feature flags#7179
andrebispo5 wants to merge 2 commits into
mainfrom
PM-40527-send-controls-policy-data-model

Conversation

@andrebispo5

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-40527

📔 Objective

Introduces the client-side data-layer scaffolding for the new consolidated
SendControls organization policy (server policy type 21), which will
supersede the DisableSend and SendOptions policies. This ticket is data-model
only — no enforcement/UI behavior changes yet:

  • New PolicyInformation.SendControls model decoding disableSend,
    disableHideEmail, whoCanAccess, allowedDomains, deletionHours,
    allowedSendTypes
  • New SendWhoCanAccessTypeJson enum (network module)
  • Decode branch in SyncResponseJsonExtensions.kt and getPolicyType<T>()
    branch in PolicyManagerExtensions.kt
  • Two new feature flags: SendControls (pm-31885-send-controls) and
    SendControlsExistingSends (pm-31885-send-controls-existing-sends)
  • Debug-menu wiring for the two new flags

📸 Screenshots

No UI/behavior changes in this PR — data-layer scaffolding only.

…ture flags

Introduces the client-side scaffolding for the new consolidated SendControls
org policy (server policy type 21), which will supersede DisableSend and
SendOptions. This is data-layer only: PolicyInformation.SendControls model,
JSON decoding, the SendWhoCanAccessTypeJson enum, and the two feature flags
gating rollout. No enforcement behavior changes yet.
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:feature Change Type - Feature Development labels Jul 20, 2026
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.07%. Comparing base (5c13e26) to head (5fb5df5).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7179      +/-   ##
==========================================
+ Coverage   85.69%   86.07%   +0.37%     
==========================================
  Files         941      885      -56     
  Lines       67045    64655    -2390     
  Branches     9660     9629      -31     
==========================================
- Hits        57454    55649    -1805     
+ Misses       6137     5553     -584     
+ Partials     3454     3453       -1     
Flag Coverage Δ
app-data 17.72% <100.00%> (+0.43%) ⬆️
app-ui-auth-tools 18.76% <0.00%> (-0.06%) ⬇️
app-ui-platform 16.50% <0.00%> (-0.07%) ⬇️
app-ui-vault 27.42% <0.00%> (-0.68%) ⬇️
authenticator 6.11% <0.00%> (+0.05%) ⬆️
lib-core-network-bridge 4.01% <0.00%> (-0.98%) ⬇️
lib-data-ui 1.13% <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 Harness.
📢 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.

…lags

Covers SendControls JSON decoding, getPolicyType() mapping, and the two new
FlagKey entries, matching existing test conventions for sibling policy types.
@andrebispo5
andrebispo5 requested a review from Copilot July 20, 2026 16:07
@andrebispo5 andrebispo5 added the ai-review Request a Claude code review label Jul 20, 2026
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR adds client-side data-layer scaffolding for the consolidated SendControls organization policy (server policy type 21) and two feature flags. Reviewed the new PolicyInformation.SendControls model, the SendWhoCanAccessTypeJson enum and serializer, the decode/mapping branches, feature-flag registration, and debug-menu wiring. All additions follow established codebase patterns and the wiring is consistent across PolicyType, PolicyTypeJson, VaultSdkPolicyExtensions, SyncResponseJsonExtensions, and PolicyManagerExtensions. Test coverage accompanies each new mapping and flag.

Code Review Details

No blocking findings.

  • The new SendWhoCanAccessTypeJson serializer mirrors the existing SendTypeJson BaseEnumeratedIntSerializer + @Keep pattern.
  • Both feature flags default to false, are registered in the FlagKey companion list, and are wired into the debug menu with tests.
  • No new dependencies; no behavior/UI changes; zero-knowledge boundary unaffected.

An existing (resolved) thread notes the disableHideEmail property name diverges from SendOptions.shouldDisableHideEmail for the same server field. This is a defensible convention choice for the new consolidated model and does not require a change.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds client-side scaffolding for the consolidated SendControls organization policy (server policy type 21) and wires it through sync decoding, policy-type mapping, feature flags, and debug UI.

Changes:

  • Introduces PolicyInformation.SendControls and a new network enum SendWhoCanAccessTypeJson for policy data decoding.
  • Adds SEND_CONTROLS decoding support in SyncResponseJsonExtensions and type mapping in PolicyManagerExtensions (+ tests).
  • Adds two feature flags (SendControls, SendControlsExistingSends) and exposes them in the debug feature-flag menu.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ui/src/main/res/values/strings_non_localized.xml Adds debug-menu labels for the new feature flags.
ui/src/main/kotlin/com/bitwarden/ui/platform/components/debug/FeatureFlagListItems.kt Adds the two new flags to the debug feature flag list and label mapping.
network/src/main/kotlin/com/bitwarden/network/model/SendWhoCanAccessTypeJson.kt Adds enum + serializer for whoCanAccess values under SendControls.
core/src/test/kotlin/com/bitwarden/core/data/manager/model/FlagKeyTest.kt Tests new flag keys and confirms default values.
core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt Defines the two new feature flags and includes them in active PM flags.
app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/util/PolicyManagerExtensionsTest.kt Adds test for getPolicyType<SendControls>() mapping.
app/src/test/kotlin/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensionsTest.kt Adds test verifying SendControls policy data decodes to PolicyInformation.
app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/util/PolicyManagerExtensions.kt Maps PolicyInformation.SendControls to PolicyType.SEND_CONTROLS.
app/src/main/kotlin/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensions.kt Adds decode branch for PolicyType.SEND_CONTROLS.
app/src/main/kotlin/com/x8bit/bitwarden/data/auth/repository/model/PolicyInformation.kt Adds PolicyInformation.SendControls data model.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andrebispo5
andrebispo5 marked this pull request as ready for review July 20, 2026 16:14
@andrebispo5
andrebispo5 requested review from a team and david-livefront as code owners July 20, 2026 16:14
* Represents who is allowed to view a Send under the `SendControls` policy.
*/
@Serializable(SendWhoCanAccessTypeSerializer::class)
enum class SendWhoCanAccessTypeJson {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What do you think about just calling this SendAccessTypeJson?


PolicyType.SEND_CONTROLS -> {
JSON.decodeFromStringOrNull<PolicyInformation.SendControls>(it)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is any spot in the app using this yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review app:authenticator Bitwarden Authenticator app context 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.

3 participants