[PM-37884] fix: Show the scan card button when editing a card - #3015
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed a targeted bug fix that keeps the card scanner's UI-only state ( Code Review DetailsNo findings. |
There was a problem hiding this comment.
🟢 Approval recommended
The fix is localized, aligns with the stated root cause, and includes targeted regression tests covering both the state update and streaming update path.
Pull request overview
Fixes a regression in the Add/Edit Card flow where the “Scan card” button (and ongoing scanner sheet) would disappear during edit due to cipher detail streaming rebuilding CipherItemState from CipherView and dropping scanner-related UI/feature-flag state.
Changes:
- Preserve card scanner UI/feature-flag state when rebuilding
CipherItemStatefrom an updatedCipherView. - Add unit coverage to ensure
CipherItemState.update(from:)and the.streamCipherDetailsflow retain scanner state across cipher updates.
File summaries
| File | Description |
|---|---|
| BitwardenShared/UI/Vault/VaultItem/CipherItemState.swift | Preserves scanner state when re-deriving cardItemState from CipherView. |
| BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditCardItem/CardItemState.swift | Adds helper to carry scanner-related fields across state rebuilds. |
| BitwardenShared/UI/Vault/VaultItem/CipherItemStateTests.swift | Adds test verifying update(from:) keeps scanner state while still updating card fields. |
| BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditItemProcessorTests.swift | Adds test verifying streaming cipher updates don’t clear scanner state during edit. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3015 +/- ##
==========================================
+ Coverage 79.60% 81.88% +2.27%
==========================================
Files 1169 1046 -123
Lines 75195 67904 -7291
==========================================
- Hits 59862 55603 -4259
+ Misses 15333 12301 -3032 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@andrebispo5 @matt-livefront |
@speedy1804 Yes, this feature is still behind a feature flag which is currently off. I'm not sure if we're waiting on anything else other than this fix to enable it, but I will check. |
|
@matt-livefront Thank you so much for your reply and the clarity! |
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-37884
📔 Objective
The "Scan card" button never showed up when editing an existing card, only when adding a new one.
cardScannerEnabled, which the feature flag had just set, so the button disappeared before anyone could see itCipherItemStateandAddEditItemProcessorthat fail without the fix📸 Screenshots