Repository navigation
fix(login): wait for the pending account removal before logging in again - #6810
ToteMeiSter wants to merge 2 commits into
Conversation
After "Remove account" the app restarted as soon as AccountRemovalWorker was SUCCEEDED, but the worker only started the push proxy request (async) and returned. The user row was still scheduled for deletion, so logging in with the same account ended in ExistingAccount and an app restart to the server address screen, without any message. The worker now blocks on the proxy request, and also deletes the user when the Nextcloud unregistration answers with another status than 200/202. When a login finds an account still scheduled for deletion, LoginRepository starts the removal and waits for it (30 s), then sets the account up as a new one. If the removal does not finish in time, an error is shown instead of silently restarting. Assisted-by: Claude-Code:claude-opus-5-5 Signed-off-by: Krainov Gleb <krajnov.g@kontentplus.ru>
…nt removal The proxy answer has no body, so Retrofit emits null. A blocking subscriber queues the element and fails with a NullPointerException on it, which ended in onError for a successful request and skipped deleting the notification channel group. Wait for the request with ignoreElements() instead, which does not take the element, and delete the channel group when there is no error. Assisted-by: Claude-Code:claude-opus-5-5 Signed-off-by: Krainov Gleb <krajnov.g@kontentplus.ru>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (9)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe account-removal worker now handles unsuccessful push-unregistration outcomes and initiates user deletion. During login, the repository waits for scheduled account removal before checking for an existing account. If removal remains pending, the login flow displays a snackbar asking the user to retry shortly. Tests cover removal polling, repository outcomes, and push-proxy completion. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Login now waits for a pending account removal to finish, or shows a retry message if it takes too long. Nothing in the supplied evidence shows a concrete problem that would block merging. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The change improves removal ordering, but immediate re-login can still overlap another removal attempt, allowing delayed cleanup to affect the replacement account. Existing login verification remains in place; no account takeover is demonstrated. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 8 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @ToteMeiSter thank you for your contributions. |
|
This is a bug fix and all CodeRabbit review threads are resolved. Once it is approved and merged, would it be possible to backport it to Suggested command for a maintainer after merge: This comment was drafted with AI assistance (Claude Code). |
Symptom
Remove an account and log in again with the same account right away, without restarting the app. After the browser login, Talk returns to the server address screen. There is no error message. After an app restart, the login works.
Cause
AccountRemovalWorkersent the push proxy unregister request with.subscribe(...). The Retrofit adapter runs onSchedulers.io(), so the call is asynchronous.doWork()returnedResult.success()before the user row was deleted.SUCCEEDED. A new login with the same account then reachesLoginRepository.parseAndLogin. The user is stillscheduledForDeletion, so it returnsExistingAccount. The app restarts with no accounts and shows the server address screen.Change
AccountRemovalWorkerwaits for the push proxy request withignoreElements().blockingGet().blockingSubscribecannot be used: the response body ofObservable<Void>is null, and the blocking observer of RxJava 2 throws an NPE on it.parseAndLogin: for an account that is still pending removal, it starts the worker again and waits up to 30 s for the removal (LocalLoginDataSource.awaitUserRemoval). After the removal, the account is set up as new. On timeout, the newLoginResult.RemovalPendingshows a Snackbar (nc_account_removal_pending) instead of the silent return to the server address screen.How to test
Unit tests:
AccountRemovalWorkerTest(a successful request with a null body is success; a failed request returns its error),LocalLoginDataSourceTest,LoginRepositoryTest.Tested by the reporter on a Huawei DEL-LX9.
Related
Refs #3544, #3295, #6716. These reports show the same symptom (the account cannot be added again, or the server address screen comes back). Their exact cause is not confirmed, so this PR does not close them.
Note: the open PR #6770 migrates
AccountRemovalWorkerto Kotlin. Whichever lands second needs a rebase; I can rebase this one.🖼️ Screenshots
Not applicable.
🚧 TODO
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)
This change was prepared with Claude Code (claude-opus-5-5). The author reviewed the code and tested it on a device. The commits carry the
Assisted-by: Claude-Code:claude-opus-5-5trailer.