Skip to content

Toxee remediation: lifecycle, login use case, bootstrap, coordinator,…#1

Merged
anonymoussoft merged 1 commit intomasterfrom
feature/toxee-remediation-plan
Mar 13, 2026
Merged

Toxee remediation: lifecycle, login use case, bootstrap, coordinator,…#1
anonymoussoft merged 1 commit intomasterfrom
feature/toxee-remediation-plan

Conversation

@anonymoussoft
Copy link
Copy Markdown
Owner

… lint & tests

PR-1 Lifecycle & resource leaks:

  • HomePage: _progressUpdatesSub, explicit dispose() with all subscriptions/timers, _disposed guard
  • ContactBuilderOverrideHandle (capture/restore), HomePage uses and restores in _bag
  • LoginPage: if (!mounted) return before setState in finally
  • DisposableBag: _disposed guard, add() throws when disposed, dispose() logs exceptions

PR-2 Login flow:

  • LoginUseCase (LoginParams, LoginSuccess, execute), LoginPage delegates and supports DI
  • Removed in-page SDK/prefs/init, use case handles TIM init and persistence

PR-3 Startup:

  • EchoUIKitApp: theme sync in initState/dispose, removed addPostFrameCallback from build
  • AppBootstrap + LoggingBootstrap, PrefsBootstrap, AppRuntimeBootstrap, DesktopShellBootstrap
  • main() slims to ensureInitialized + AppBootstrap.initialize() + switch runApp
  • _WindowStateListener moved to desktop_shell_bootstrap with logging on catch

PR-4 HomePage & runtime:

  • SessionRuntimeCoordinator (ensureInitialized, disposeRuntime), HomePage uses it
  • AccountService.teardownCurrentSession calls SessionRuntimeCoordinator.disposeRuntime()
  • HomePageController, HomePageScope, HomePageView added (structure for future migration)

PR-5 Lint & guard:

  • analysis_options: always_declare_return_types, avoid_print, cancel_subscriptions, etc.
  • tool/check_complexity.dart (warn-only), .github/workflows/analyze.yml
  • test/util/disposable_bag_test.dart, placeholder tests for use case/coordinator/contact

Made-with: Cursor

… lint & tests

PR-1 Lifecycle & resource leaks:
- HomePage: _progressUpdatesSub, explicit dispose() with all subscriptions/timers, _disposed guard
- ContactBuilderOverrideHandle (capture/restore), HomePage uses and restores in _bag
- LoginPage: if (!mounted) return before setState in finally
- DisposableBag: _disposed guard, add() throws when disposed, dispose() logs exceptions

PR-2 Login flow:
- LoginUseCase (LoginParams, LoginSuccess, execute), LoginPage delegates and supports DI
- Removed in-page SDK/prefs/init, use case handles TIM init and persistence

PR-3 Startup:
- EchoUIKitApp: theme sync in initState/dispose, removed addPostFrameCallback from build
- AppBootstrap + LoggingBootstrap, PrefsBootstrap, AppRuntimeBootstrap, DesktopShellBootstrap
- main() slims to ensureInitialized + AppBootstrap.initialize() + switch runApp
- _WindowStateListener moved to desktop_shell_bootstrap with logging on catch

PR-4 HomePage & runtime:
- SessionRuntimeCoordinator (ensureInitialized, disposeRuntime), HomePage uses it
- AccountService.teardownCurrentSession calls SessionRuntimeCoordinator.disposeRuntime()
- HomePageController, HomePageScope, HomePageView added (structure for future migration)

PR-5 Lint & guard:
- analysis_options: always_declare_return_types, avoid_print, cancel_subscriptions, etc.
- tool/check_complexity.dart (warn-only), .github/workflows/analyze.yml
- test/util/disposable_bag_test.dart, placeholder tests for use case/coordinator/contact

Made-with: Cursor
@anonymoussoft anonymoussoft merged commit b27581a into master Mar 13, 2026
1 check failed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b3c88b362

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +30 to +32
if (_state == SessionRuntimeState.disposed) {
AppLogger.warn('[SessionRuntimeCoordinator] ensureInitialized called after dispose, skipping');
return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Allow runtime coordinator to reinitialize after teardown

AccountService.teardownCurrentSession() now routes through SessionRuntimeCoordinator.disposeRuntime(), which sets _state to disposed; after that, ensureInitialized() immediately returns for every subsequent login/switch because of this guard, so the runtime (FakeUIKit/platform/call services) is never brought back up in the same app process. This breaks post-logout or account-switch flows that navigate back to HomePage and expect session runtime init to run again.

Useful? React with 👍 / 👎.

Comment on lines +476 to +480
if (isZip) {
accountData = await AccountExportService.importFullBackup(
filePath: filePath,
password: password,
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Check account collisions before importing ZIP backups

In the ZIP path, the UI calls importFullBackup() before checking whether the target account/profile already exists, but importFullBackup() performs writes (profile/history/avatars/scoped prefs) as part of import. That means duplicate-account detection (or user cancellation/error afterward) happens too late and can still leave partial or overwritten data on disk, which is a data-integrity regression specific to .zip imports.

Useful? React with 👍 / 👎.

@anonymoussoft anonymoussoft deleted the feature/toxee-remediation-plan branch March 13, 2026 04:12
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