Bugfix FXIOS-31023 [Logins] Fix crash when multiple addLogin calls race across threads
:scroll: Tickets
:bulb: Description
Wraps storage/FFI calls in RustLogins with dispatch to the serial queue after getStoredKey to prevent race conditions. Adds a concurrent test to verify multiple logins can be added safely.
:pencil: Checklist
- [x] I filled in the ticket numbers and a description of my work
- [x] I updated the PR name to follow our PR naming guidelines
- [x] I ensured unit tests pass and wrote tests for new code
- [ ] If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
- [ ] If adding telemetry, I read the data stewardship requirements and will request a data review
- [ ] If adding or modifying strings, I read the guidelines and will request a string review from l10n
- [ ] If needed, I updated documentation and added comments to complex code
| Messages | |
|---|---|
| :book: | Project coverage: 37.66% |
๐ช Quality guardian
1 tests files modified. You're a champion of test coverage! ๐
๐งน Tidy commit
Just 2 file(s) touched. Thanks for keeping it clean and review-friendly!
โ Per-file coverage
All changed files meet the threshold of 35.0%.
libStorage.a: Coverage: 54.52
| File | Coverage | |
|---|---|---|
| RustLogins.swift | 37.48% | โ ๏ธ |
Generated by :no_entry_sign: Danger Swift against 5f2a5f7328949d8a776aec598b2a25f640598798
This pull request has conflicts when rebasing. Could you fix it @Aniket-pd? ๐
Nice work @Aniket-pd, thanks for taking this ticket on!
It makes more sense to jump back to the queue for the work in the completion blocks.
One issue I noticed. When I ran the full test suite (or even the full test class) locally, your test passed just fine. Now, as I was about to try running it repeatedly, I noticed it crashes when I run even just once individually. Are you able to see this crash as well? ๐ค
![]()
Yes, Iโm able to reproduce the crash locally as well when running the test individually Iโll investigate the cause
Hi @Aniket-pd , looks like we have some compiler errors building the unit test suite. Could something maybe have gotten changed after the merge conflicts were addressed?
โ /Users/[REDACTED]/git/firefox-ios/Storage/Rust/RustLogins.swift:227:20: type 'RustLogins' does not conform to protocol 'LoginsProtocol'
public final class RustLogins: LoginsProtocol, KeyManager, @unchecked Sendable {
^