Skip to content

Conversation

@TigerInYourDream
Copy link
Contributor

@TigerInYourDream TigerInYourDream commented Mar 11, 2025

Closes #277. Replaces #293 and #494.


Based on PR #293, I found an error message during logout:
2024-12-24T07:58:55.514036Z ERROR matrix_sdk_ui::sync_service: Error while processing encryption in sync service: Something wrong happened in sliding sync: the server returned an error: [401 / M_UNKNOWN_TOKEN] Invalid access token passed.
Root cause:
The error is related to SYNC_SERVICE handling during logout process.

Changes:

  • Updated SYNC_SERVICE handling during logout
  • Tested the fix with Google SSO login/logout flow

Signed-off-by: Alvin <zyzzz0928@gmail.com>
@kevinaboos
Copy link
Member

Thanks Alvin. I'm a bit confused -- is this a replacement for #293, or something that should be merged in after #293 as an addition to it?

Also, is it ready for review or shall I wait for something else?

@TigerInYourDream
Copy link
Contributor Author

Thanks Alvin. I'm a bit confused -- is this a replacement for #293, or something that should be merged in after #293 as an addition to it?

Also, is it ready for review or shall I wait for something else?

Due to the age of PR #293 and substantial changes in the codebase, resolving merge conflicts became quite challenging. I've contacted the original author, Guocork, who also suggested creating a new PR. Therefore, I've created a fresh PR implementing the same functionality with updated code and comprehensive testing. Could you please review this new implementation?

TigerInYourDream and others added 2 commits March 12, 2025 12:34
Signed-off-by: Alvin <zyzzz0928@gmail.com>
Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alvin, great start on this feature!

I left some comments below. In general, make sure to name things carefully --- try to give variables and types very specific names that cannot be misinterpreted. (I know naming is hard, so it'll take some time to get that right. No worries.)

@kevinaboos kevinaboos added the waiting-on-author This issue is waiting on the original author for a response label Mar 12, 2025
@TigerInYourDream
Copy link
Contributor Author

Thanks Alvin, great start on this feature!

I left some comments below. In general, make sure to name things carefully --- try to give variables and types very specific names that cannot be misinterpreted. (I know naming is hard, so it'll take some time to get that right. No worries.)

Thank you for the review. I will try to improve the naming conventions and continue working on it.

@TigerInYourDream TigerInYourDream marked this pull request as draft March 13, 2025 04:50
TigerInYourDream and others added 4 commits March 15, 2025 01:28
Signed-off-by: Alvin <zyzzz0928@gmail.com>
Signed-off-by: Alvin <zyzzz0928@gmail.com>
Signed-off-by: Alvin <zyzzz0928@gmail.com>
@TigerInYourDream TigerInYourDream marked this pull request as ready for review March 18, 2025 07:24
@alanpoon
Copy link
Contributor

alanpoon commented Mar 18, 2025

  1. Suggest adding a modal for logout confirmation
  2. Perhaps delete the "latest_user_id.txt" in the app data directory
  3. After logout, restarting the app will see a prompt saying fail to "Could not restore previous user session"
    Screenshot 2025-03-18 at 3 51 49 PM

Signed-off-by: Alvin <zyzzz0928@gmail.com>
@TigerInYourDream
Copy link
Contributor Author

  1. Suggest adding a modal for logout confirmation
  2. Perhaps delete the "latest_user_id.txt" in the app data directory
  3. After logout, restarting the app will see a prompt saying fail to "Could not restore previous user session"
    Screenshot 2025-03-18 at 3 51 49 PM

Thanks for the review.

@TigerInYourDream TigerInYourDream changed the title fix pr #293 about logout logout feature Mar 21, 2025
Signed-off-by: Alvin <zyzzz0928@gmail.com>
Signed-off-by: Alvin <zyzzz0928@gmail.com>
kevinaboos added a commit to kevinaboos/robrix that referenced this pull request Aug 13, 2025
This makes it easier to clean up, which is needed for PR project-robius#432.
We now pass out `Handle`s instead of strong references to the runtime itself,
which is fine because we do want to be able to drop the runtime
and forcibly shutdown all background async tasks.
kevinaboos and others added 3 commits August 18, 2025 10:34
This makes it easier to clean up, which is needed for PR project-robius#432.
We now pass out `Handle`s instead of strong references to the runtime itself,
which is fine because we do want to be able to drop the runtime
and forcibly shutdown all background async tasks.
Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one more comment about the usage of the set_logout_*() functions.

kevinaboos
kevinaboos previously approved these changes Aug 22, 2025
Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alrighty, everything looks good to me! I haven't thoroughly tested this, but that's okay since it's a little-used feature that can always be worked around by restarting the app.

I assume you have tested it frequently during the development of this; if any problems show up in my usage, I'll file an issue.

Thanks so much for all of your hard work on this! I know it's tedious responding to all of my comments, but it's important for us to ensure high code quality for this repo as a "flagship" app showing off Makepad + Robius functionality.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive client logout functionality to resolve error handling during logout processes. The implementation adds a robust state machine-based logout system that properly manages sync service termination and resource cleanup.

Key Changes:

  • Implemented state machine-based logout flow with proper error handling
  • Added logout confirmation modal with progress feedback
  • Modified static global resources to use Mutex<Option<T>> for safe cleanup

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/sliding_sync.rs Core logout implementation with state machine integration and resource cleanup
src/logout/logout_state_machine.rs Complete logout state machine with progress tracking and error recovery
src/logout/logout_confirm_modal.rs UI modal for logout confirmation with progress updates
src/settings/account_settings.rs Integration of logout button with confirmation modal
src/app.rs App state cleanup and logout action handling
Various cache modules Added cache clearing functions for proper resource cleanup
Comments suppressed due to low confidence (1)

src/sliding_sync.rs:1

  • The variable rt shadows rt_handle and creates unnecessary confusion. Both variables hold the same handle value, but using different names for the same thing reduces code clarity.
use anyhow::{anyhow, bail, Result};

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@kevinaboos kevinaboos removed the waiting-on-author This issue is waiting on the original author for a response label Aug 22, 2025
@kevinaboos kevinaboos merged commit 0a7263e into project-robius:main Aug 22, 2025
11 checks passed
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.

Add logout button

7 participants