Skip to content

[PM-43847] Add a callout when item-type Sends' items are deleted - #24807

Open
mcamirault wants to merge 2 commits into
mainfrom
tools/pm-43847/callout-on-deleted-item-type-sends
Open

mcamirault wants to merge 2 commits into
mainfrom
tools/pm-43847/callout-on-deleted-item-type-sends

Conversation

@mcamirault

Copy link
Copy Markdown
Contributor

🎟️ Tracking

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

📔 Objective

This PR adds a callout that is only displayed when the item that an item-type Send is sharing has been deleted. Such Sends have their access locked immediately but aren't removed until the next time the automated cleanup job runs (the job runs every five minutes); this callout notifies the user of this state in case they look at the Send before it is deleted.

Should be tested and considered in conjunction with this server PR

📸 Screenshots

Screenshot 2026-11-17 at 08 32 59

@mcamirault
mcamirault requested a review from a team as a code owner November 17, 2026 13:50
@mcamirault mcamirault added needs-qa Marks a PR as requiring QA approval ai-review Request a Claude code review t:feature Change Type - Feature Development labels Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: REQUEST CHANGES

This PR adds an info callout to the Send form when an item-type Send's cipher is no longer in the user's decrypted vault. It also adds the matching i18n keys to the browser, desktop, and web locale files. The earlier sendView null-handling finding has been fixed with optional chaining. One remaining null-handling issue was found on the cipherViews$ side of the detection stream.

Code Review Details
  • ⚠️ : cipherViews$ emits null when the cipher cache is cleared (sync, cipher writes), so cipherViews.some(...) throws inside the async-piped stream
    • libs/tools/send/send-ui/src/send-form/components/send-form.component.ts:131

toObservable(this.sendFormService.originalSendView),
this.accountService.activeAccount$.pipe(
getUserId,
switchMap((userId) => this.cipherService.cipherViews$(userId)),

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.

⚠️ IMPORTANT: cipherViews$ emits null whenever the cipher cache is cleared, so cipherViews.some(...) on line 138 throws a TypeError.

Details and fix

cipherViews$ is built with perUserCache$(..., this.clearCipherViewsForUser$). CipherService.clearCache() pushes null through it (cipher.service.ts:274-277, "Force the cached cipherView$ observable(s) to emit a null value"). The implementation's documented type is Observable<CipherView[] | null>, where null means decryption is in progress. The abstract signature says CipherView[], and @ts-strict-ignore hides the mismatch here.

clearCache runs on sync and on cipher writes. A background sync while an item-type Send is open in edit mode is enough. Because the cache uses shareReplay({ refCount: false }), a subscriber can also get the replayed null as its first value if no decrypt has finished since the last clear. When map throws, the stream errors and AsyncPipe rethrows it as an uncaught exception. The callout then stays dead for the rest of the component's life.

Drop the in-progress null instead of mapping it to "not deleted". That also keeps the callout from flickering while the vault re-decrypts. CipherService.cipherView$ already does this:

Suggested change
switchMap((userId) => this.cipherService.cipherViews$(userId)),
switchMap((userId) => this.cipherService.cipherViews$(userId).pipe(filterOutNullish())),

filterOutNullish comes from @bitwarden/common/vault/utils/observable-utilities.

code-review

This branch has not been deployed

No deployments
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 needs-qa Marks a PR as requiring QA approval t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant