Skip to content

fix(restore): surface a retryable error instead of an endless spinner#681

Open
joshuakrueger-dfx wants to merge 1 commit into
RealUnitCH:developfrom
joshuakrueger-dfx:joshua/fix-657-p1b1-restore-error
Open

fix(restore): surface a retryable error instead of an endless spinner#681
joshuakrueger-dfx wants to merge 1 commit into
RealUnitCH:developfrom
joshuakrueger-dfx:joshua/fix-657-p1b1-restore-error

Conversation

@joshuakrueger-dfx
Copy link
Copy Markdown
Collaborator

Addresses Issue #657 — Part 1, finding B1 (HIGH).

Problem

restoreWallet() had no try/catch — a persist/crypto failure escaped as an unhandled async error and the cubit stayed isLoading. The button renders .loading whenever wallet == null, so the user was stranded on a permanent spinner with no retry.

Fix (beide Layer — Big-Brother-Design-Skeptic hatte einen Cubit-only-Fix als unvollständig geblockt)

  • Cubit: try/catch + isClosed guard → terminaler hasError-State + Log
  • State: neues hasError-Flag (in props)
  • Button: bei hasError ein tappbarer "Restore failed – tap to retry" (idle + Refresh-Icon; der error-State-Button ist nicht interaktiv), der restoreWallet mit dem eingegebenen Seed erneut aufruft
  • l10n: neuer restoreWalletFailed-String (EN/DE)

Tests (RED→GREEN, proven)

Cubit: Error-State statt Endlos-Loading + Retry-Recovery (failt am alten Code, verifiziert). Widget: Retry tappbar, kein Spinner. Suite 30/30 grün, analyze clean.

🤖 Big Brother fleet analysis (Design-Skeptic scope verdict) + operator hand-finish. Ref #657.

restoreWallet() had no try/catch: a persist/crypto failure escaped as an
unhandled async error, the cubit stayed in isLoading and — because the button
renders .loading whenever wallet==null — the user was stranded on a permanent
spinner with no way out.

End-to-end fix across both layers:
- cubit: try/catch + isClosed guard, emits a terminal RestoreWalletState
  (hasError: true) and logs the failure
- state: new hasError flag (in props)
- button: on hasError renders a tappable "Restore failed – tap to retry"
  (idle + refresh icon; the error-state button is non-interactive) that
  re-invokes restoreWallet with the entered seed
- l10n: new restoreWalletFailed string (EN/DE)

Regressions: restore_wallet_cubit_test.dart (error state + retry recovery),
restore_wallet_page_test.dart (tappable retry, no spinner).

Issue RealUnitCH#657 — Part 1, finding B1 (HIGH).
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