Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-16220]: Account does not exist during CLI bw login race condition #12488

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mzieniukbw
Copy link
Contributor

๐ŸŽŸ๏ธ Tracking

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

๐Ÿ“” Objective

Fixes race condition during CLI bw login, which sometimes results in Account does not exist error.
This seems to be due to the accounts Observable not providing the just updated value, when being extracted via firstValueFrom rxjs operator.

The fix is to filter on the accounts observable, until the desired value becomes available, for maximum of 1 second, at which point we give up and will throw the Account does not exist error.

๐Ÿ“ธ Screenshots

โฐ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

๐Ÿฆฎ Reviewer guidelines

  • ๐Ÿ‘ (:+1:) or similar for great changes
  • ๐Ÿ“ (:memo:) or โ„น๏ธ (:information_source:) for notes or general info
  • โ“ (:question:) for questions
  • ๐Ÿค” (:thinking:) or ๐Ÿ’ญ (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • ๐ŸŽจ (:art:) for suggestions / improvements
  • โŒ (:x:) or โš ๏ธ (:warning:) for more significant problems or concerns needing attention
  • ๐ŸŒฑ (:seedling:) or โ™ป๏ธ (:recycle:) for future improvements or indications of technical debt
  • โ› (:pick:) for minor or nitpick changes

Wait for an account to become available from separate observable, instead of blindly accepting that the value is there using `firstValueFrom`, while it's sometimes not there immediately.
@mzieniukbw mzieniukbw requested a review from a team as a code owner December 19, 2024 20:36
@mzieniukbw mzieniukbw requested review from ike-kottlowski, justindbaur and a team December 19, 2024 20:36
Copy link
Contributor

Logo
Checkmarx One โ€“ Scan Summary & Details โ€“ 38f460de-b0fd-4453-96c9-2dc4db49ceae

Fixed Issues

Severity Issue Source File / Package
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/service-container/service-container.ts: 878

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 33.56%. Comparing base (51f6594) to head (9c7240d).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
libs/common/src/auth/services/account.service.ts 33.33% 2 Missing and 2 partials โš ๏ธ
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12488      +/-   ##
==========================================
+ Coverage   33.44%   33.56%   +0.12%     
==========================================
  Files        2918     2926       +8     
  Lines       91302    91529     +227     
  Branches    17362    17396      +34     
==========================================
+ Hits        30535    30724     +189     
- Misses      58367    58390      +23     
- Partials     2400     2415      +15     

โ˜” View full report in Codecov by Sentry.
๐Ÿ“ข Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant