Skip to content

fix: show account-not-found message on 404 logout (WT-956)#1367

Merged
SERDUN merged 4 commits into
developfrom
fix/wt-956-account-not-found-message
Jun 9, 2026
Merged

fix: show account-not-found message on 404 logout (WT-956)#1367
SERDUN merged 4 commits into
developfrom
fix/wt-956-account-not-found-message

Conversation

@SERDUN

@SERDUN SERDUN commented Jun 9, 2026

Copy link
Copy Markdown
Member

Overview

Make terminal session-invalidation cases distinct and explained to the user instead of a generic "session expired" with no cause. Two cases get dedicated handling: a deactivated/removed account (404 UserNotFoundException) and a self-care password change/expiry (403 password_change_required).

Ticket: [WT-956]. The fatal-crash and parallel-logout parts were already fixed earlier on develop; this PR finishes the user-facing half.

Changes

Account not found (404)

  • RouterLogoutSessionGuard: performLogout / onPreLogout callbacks now receive the unauthorized Exception, so the wiring can branch on its type. The guard stays app-agnostic.
  • AppLogoutReason.userNotFound: new terminal reason, excluded from remote revoke (the user record is already gone, a revoke would just 404 again).
  • main_shell.dart: a UserNotFoundException logs out with userNotFound and shows AccountNotFoundNotification; every other unauthorized case keeps serverRejection + SessionExpiredNotification.
  • AccountNotFoundNotification + l10n notifications_errorSnackBar_accountNotFound (en/it/uk).

Password change required (403)

  • The signaling-session invalidation cause is resolved before logging out and carried via a new SignalingSessionInvalidationReason (the call layer stays free of app-level enums); no more transient snackbar for this case.
  • AppLogoutReason.passwordChangeRequired: new reason (local cleanup only; the signaling session is already gone).
  • Removed the now-unused SelfCarePasswordExpiredNotification.

Teardown screen

  • TeardownScreen shows a reason-specific message below "Signing out...": the account-not-found text for userNotFound, the self-care password-expired text for passwordChangeRequired. Reads AppState.logoutReason, which is still set while teardown renders.

When Core returns 404 (UserNotFoundException) for the current account it is
now distinguished from a generic session expiry: the user gets a dedicated
"account not found" notification and is logged out with a userNotFound reason
that skips the doomed remote session revoke.

- SessionGuard callbacks receive the unauthorized exception so the wiring can
  branch on its type
- add AppLogoutReason.userNotFound; excluded from remote revoke in cleanup
- add AccountNotFoundNotification + l10n keys (en/it/uk)

Copilot AI left a comment

Copy link
Copy Markdown

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 distinguishes the “account removed/deactivated” server response (404 UserNotFoundException) from generic unauthorized/session-expired cases by introducing a dedicated logout reason and user-facing notification, while avoiding redundant remote revocation attempts.

Changes:

  • Add AppLogoutReason.userNotFound and skip remote revoke during cleanup for this terminal case.
  • Extend RouterLogoutSessionGuard callbacks to receive the triggering exception and branch UI/logout behavior accordingly.
  • Introduce AccountNotFoundNotification and a new localization key (notifications_errorSnackBar_accountNotFound) with regenerated l10n outputs.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/l10n/arb/app_en.arb Adds new snackbar message key/value for “account not found” (EN).
lib/l10n/arb/app_it.arb Adds new snackbar message key/value for “account not found” (IT).
lib/l10n/arb/app_uk.arb Adds new snackbar message key/value for “account not found” (UK).
lib/l10n/app_localizations.g.dart Regenerates base localization interface with the new key.
lib/l10n/app_localizations_en.g.dart Regenerates EN localization implementation for the new key.
lib/l10n/app_localizations_it.g.dart Regenerates IT localization implementation for the new key.
lib/l10n/app_localizations_uk.g.dart Regenerates UK localization implementation for the new key.
lib/blocs/app/app_event.dart Adds AppLogoutReason.userNotFound to represent deleted/deactivated accounts.
lib/blocs/app/app_bloc.dart Skips remote revoke for userNotFound (local cleanup only).
lib/app/session/router_logout_session_guard.dart Passes the unauthorized exception into pre-logout/logout callbacks.
lib/app/router/main_shell.dart Branches logout reason + notification based on UserNotFoundException.
lib/app/notifications/models/notification.dart Adds AccountNotFoundNotification mapping to the new l10n key.

Comment thread lib/app/router/main_shell.dart Outdated
Comment thread lib/app/session/router_logout_session_guard.dart Outdated
SERDUN added 2 commits June 9, 2026 11:14
For an AppLogoutReason.userNotFound logout, render the account-not-found
message below the "Signing out..." label on TeardownScreen so the reason is
visible during the logout transition, not only in the snackbar.
When the signaling session drops and the cause is a self-care password
change/expiry (403 password_change_required), log out with a dedicated
reason and show the explanation on TeardownScreen instead of a transient
snackbar.

- resolve the signaling-session invalidation cause before logging out and
  carry it via SignalingSessionInvalidationReason (call layer stays free of
  app-level enums)
- add AppLogoutReason.passwordChangeRequired (local cleanup only)
- TeardownScreen renders the self-care password-expired message for it
- drop the now-unused SelfCarePasswordExpiredNotification (snackbar)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Comment thread lib/app/router/main_shell.dart Outdated
Comment thread lib/features/call/bloc/call_bloc.dart
Comment thread test/features/session_status/view/teardown_screen_test.dart
- avoid a second, conflicting AppLogoutRequested when the signaling probe hits
  an auth error the session guard already owns (return null -> skip
  onSessionInvalidated); guard them all with try/catch
- extract the session-guard callbacks to private methods (single-expression
  callbacks per AGENTS.md)
- fix stale "onBeforeLogout" log message -> "onPreLogout"
- reorder teardown_screen_test imports into the 6-group convention
@SERDUN SERDUN merged commit 1787a15 into develop Jun 9, 2026
2 checks passed
@SERDUN SERDUN deleted the fix/wt-956-account-not-found-message branch June 9, 2026 09:48
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.

2 participants