Skip to content

[PM-32806] feat: Add Passport item type#6853

Draft
SaintPatrck wants to merge 19 commits into
new-item-types/PM-32808_drivers-licensefrom
new-item-types/PM-32806_passport
Draft

[PM-32806] feat: Add Passport item type#6853
SaintPatrck wants to merge 19 commits into
new-item-types/PM-32808_drivers-licensefrom
new-item-types/PM-32806_passport

Conversation

@SaintPatrck
Copy link
Copy Markdown
Contributor

@SaintPatrck SaintPatrck commented Apr 29, 2026

🎟️ Tracking

PM-32806 — third Android Story under epic PM-32009 (New Item Types).

Stacked on #6852 (PM-32808 Driver's License)#6851 (PM-32810 Bank Account). Review and merge order: PM-32810 → PM-32808 → PM-32806 → PM-34123 → PM-35396.

📔 Objective

Third vertical slice of the New Item Types epic for Android. Adds the Passport cipher type's Add/Edit form, View screen, vault listing entry, search support, and a single quick-copy overflow action ("Copy passport number") on top of the Driver's License slice.

The View screen treats the passport number (national identification number) as a hidden-by-default field with reveal toggle and copy action, mirroring the Card item type's number/CVV UX. AddEdit follows the same Card pattern. Visibility is tracked via rememberSaveable since the canonical Passport state model uses plain String?.

The vault list trailing action is a single quick-copy button gated on the SDK's CopyableCipherFields.PASSPORT_* flag (TODO(PM-32009) until the SDK exposes it). The vault list row subtitle is intentionally not formatted client-side — CipherListView.subtitle stays SDK-owned.

This Android slice consumes the canonical phase-01-04 Passport data model with split fields (surname/givenName, separate dobMonth/Day/Year, issueMonth/Day/Year, expirationMonth/Day/Year).

SDK dependency

The Bitwarden SDK does not yet expose CipherType.PASSPORT, CipherListViewType.Passport, PassportView on CipherView, or CopyableCipherFields.PASSPORT_*. Affected sites carry TODO(PM-32009) markers documenting the additions required:

  • SearchViewModel.kt:599 — passport number copy lookup
  • SearchTypeDataExtensions.kt:143 — search filter predicate
  • VaultItemListingViewModel.kt:1327 — listing copy lookup
  • VaultItemListingDataExtensions.kt:93 — listing filter predicate
  • CipherListViewExtensions.kt:104 — overflow emission
  • VaultViewModel.kt:867 — vault overview copy lookup
  • VaultDataExtensions.kt:158 — Passport count

The AddEdit form, View screen, ViewModel actions, search/listing wiring, and the overflow action data class are live today and exercised by tests against synthetic state.

📸 Screenshots

UI screenshots will be added before this PR is moved out of draft.

Register pm-32009-new-item-types feature flag and add foundational
support for Bank Account, Driver's License, and Passport cipher types
across the network model, SDK mapping, and UI layers.

Network: CipherTypeJson enum values (6-8), SyncResponseJson nested data
classes, CipherJsonRequest fields, LinkedIdTypeJson entries (600-812).
SDK: Defensive mapping that gracefully skips unsupported cipher types
during sync decryption (SDK types not yet available).
UI: VaultBankAccountType enum, VaultItemCipherType/CreateVaultItemType
extensions, ItemType state classes in VaultAddEditViewModel, string
resources, and exhaustive when-branch updates across ViewModels.
C1: Gate new item types behind pm-32009-new-item-types feature flag
in VaultViewModel and VaultItemListingViewModel excluded options.
I1: Add Timber.w logging when cipher conversion fails during sync.
I2: Add isSdkSupported property to ItemType and guard save path in
VaultAddEditViewModel to prevent crash on unsupported types.
Honor the established convention of fully-qualified type references in
the add/edit extensions, simplify the create-vault-item exclusion list
into a single non-null builder for clarity, and align the test fixtures
with the prevailing factory-default pattern. Also drop a stale TODO
branch that was rendered unreachable when BANK_ACCOUNT joined the null
group, and tag the placeholder render path so it is easy to find when
the dedicated UI screens land.
Bring the bank-account default in line with login/card/identity/etc. so
the SDK and network test fixtures stay consistent. Update the JSON
literal fixtures that round-trip these models to include the new field
so deserialization continues to match the expected mocks.
Bank account ciphers arrive from the server with all string fields
encrypted, including accountType, so coercing it into a typed enum at
the network boundary always degraded to OTHER and stripped meaning out
of the round trip. Match the convention already used by Card.brand and
Card.expMonth: keep the field as a plain String at the network and SDK
boundaries, and let CipherViewExtensions own the enum mapping over the
already-decrypted BankAccountView.
Vertically slice the Bank Account cipher type onto the new-item-types
infrastructure so users can author, view, search, and group their own
bank-account ciphers behind the pm-32009-new-item-types flag. The
phase-01-04 state classes already define the canonical Bank Account
data shape; this slice adds the UI, ViewModel actions, vault
integration, and tests that consume them. Driver's License and
Passport remain placeholders so each can be delivered as its own
follow-up Story slice.

Account-number and PIN visibility is held in the composable via
rememberSaveable because the canonical data classes carry plain
strings rather than visibility-wrapped values; the corresponding
ViewModel actions are still dispatched so future telemetry can hook
in without touching the UI layer.
Vertically slice the Driver's License cipher type onto the new-item-types
infrastructure so users can author and view their own driver's license
ciphers behind the pm-32009-new-item-types flag. The phase-01-04 state
classes already define the canonical Driver's License data shape with
split first/middle/last names and separate expiration month/day/year;
this slice adds the UI, ViewModel actions, dispatcher branches, and tests
that consume them. Bank Account remains untouched and Passport stays a
placeholder for the next Story slice.

The SDK at 2.0.0-6484-a19b6544 does not yet expose a CipherType,
CipherListViewType, or CopyableCipherFields entry for Driver's License.
The vault list filter, count, overflow emission, and copy lookup paths
are wired in Android with TODOs that document the missing SDK pieces, so
when the Rust SDK ships them only the tagged spots need to flip on. The
overflow action data class, ViewModel dispatch, and AddEdit/View screens
work end-to-end today against synthetic state, exercising the plumbing
before the SDK lands.
Vertically slice the Passport cipher type onto the new-item-types
infrastructure so users can author and view their own passport ciphers
behind the pm-32009-new-item-types flag. The phase-01-04 state classes
already define the canonical Passport data shape with split surname /
given name, three separate month/day/year date fields (date of birth,
issue date, expiration date), nationality, passport type, issuing
country / authority, and passport number; this slice adds the UI,
ViewModel actions, dispatcher branches, and tests that consume them.
Bank Account and Driver's License remain untouched, completing the
three-Story per-type rollout under PM-32009.

The passport number row is hidden by default with a reveal toggle and
copy action (mirroring the Card item type's number/CVV UX from the
Bitwarden web client) so the most sensitive field on the cipher is not
disclosed on screen by default. Visibility is tracked via
rememberSaveable in both the AddEdit and View composables since the
canonical state model exposes a plain String / String?.

The SDK at 2.0.0-6484-a19b6544 does not yet expose a CipherListViewType
or CopyableCipherFields entry for Passport. The vault list filter,
count, overflow emission, and copy lookup paths are wired in Android
with TODO(PM-32009) markers that document the missing SDK pieces, so
when the Rust SDK ships them only the tagged spots need to flip on. The
overflow action data class, ViewModel dispatch, and AddEdit/View screens
work end-to-end today against synthetic state, exercising the plumbing
before the SDK lands.
@SaintPatrck SaintPatrck added the ai-review-vnext Request a Claude code review using the vNext workflow label Apr 29, 2026
@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 Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the third vertical slice of the New Item Types epic, which adds the Passport cipher type's Add/Edit form, View screen, vault listing entry, and search support. The implementation faithfully follows the patterns established by the prior Driver's License and Bank Account slices: sealed-class when branches are exhaustively updated across navigation, listing, search, and overflow paths; SDK gaps are clearly documented with TODO(PM-32009) markers and intentional no-op handlers; and the passport number is treated as a hidden-by-default sensitive field via BitwardenPasswordField on both Add/Edit and View screens (mirroring Card number/CVV UX). Test coverage is thorough — every new ViewModel action has a corresponding unit test, and the "no-op until SDK ships" handlers are covered by negative tests in SearchViewModelTest and VaultItemListingViewModelTest.

Code Review Details

No findings. The implementation is consistent with the prior slices in this epic, the placeholder integration points (passportItemsCount = 0, false predicate, no-op overflow handlers, pre-emptively added ic_passport.xml drawable) are documented and aligned with the existing Driver's License approach, and the sensitive-field UX matches the established Card pattern.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 19.96928% with 521 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.91%. Comparing base (a563225) to head (937920a).

Files with missing lines Patch % Lines
.../ui/vault/feature/item/VaultItemPassportContent.kt 0.00% 268 Missing ⚠️
...vault/feature/addedit/VaultAddEditPassportItems.kt 0.00% 160 Missing ⚠️
...dedit/handlers/VaultAddEditPassportTypeHandlers.kt 41.46% 48 Missing ⚠️
...ure/itemlisting/model/ListingItemOverflowAction.kt 0.00% 6 Missing ⚠️
...warden/ui/vault/feature/item/VaultItemViewModel.kt 72.22% 0 Missing and 5 partials ⚠️
...i/vault/feature/addedit/VaultAddEditItemContent.kt 0.00% 4 Missing ⚠️
...temlisting/util/VaultItemListingStateExtensions.kt 0.00% 2 Missing and 2 partials ⚠️
...den/ui/platform/feature/search/SearchNavigation.kt 25.00% 3 Missing ⚠️
...rm/feature/search/util/SearchTypeDataExtensions.kt 0.00% 2 Missing and 1 partial ⚠️
...bitwarden/ui/vault/feature/item/VaultItemScreen.kt 40.00% 3 Missing ⚠️
... and 9 more
Additional details and impacted files
@@                             Coverage Diff                             @@
##           new-item-types/PM-32808_drivers-license    #6853      +/-   ##
===========================================================================
- Coverage                                    84.45%   83.91%   -0.54%     
===========================================================================
  Files                                          848      849       +1     
  Lines                                        60829    61396     +567     
  Branches                                      8856     8921      +65     
===========================================================================
+ Hits                                         51374    51522     +148     
- Misses                                        6424     6830     +406     
- Partials                                      3031     3044      +13     
Flag Coverage Δ
app-data 17.02% <0.00%> (-0.19%) ⬇️
app-ui-auth-tools 19.47% <0.00%> (-0.22%) ⬇️
app-ui-platform 15.37% <0.77%> (-0.16%) ⬇️
app-ui-vault 25.69% <19.40%> (-0.04%) ⬇️
authenticator 6.41% <0.00%> (-0.06%) ⬇️
lib-core-network-bridge 4.13% <0.00%> (-0.03%) ⬇️
lib-data-ui 0.99% <0.00%> (-0.02%) ⬇️

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.

@SaintPatrck SaintPatrck force-pushed the new-item-types/PM-32808_drivers-license branch 3 times, most recently from 7e3c779 to 1bc6a61 Compare May 11, 2026 21:30
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: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.

1 participant