Skip to content

sync main#3208

Merged
ca333 merged 7 commits intomainfrom
dev
Oct 22, 2025
Merged

sync main#3208
ca333 merged 7 commits intomainfrom
dev

Conversation

@ca333
Copy link
Copy Markdown
Contributor

@ca333 ca333 commented Oct 22, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Legacy wallet names are now automatically sanitized during migration, with special characters replaced by underscores. Naming conflicts are resolved by appending numeric suffixes to ensure all legacy wallets migrate successfully without losing data.
  • Chores

    • Version bumped to 0.9.3+1

CharlVS and others added 7 commits October 22, 2025 16:55
…ring migration\n\n- Keep WalletConfig.isLegacyWallet in copy() to ensure legacy flow\n- Sanitize legacy wallet names (non-alnum except _) and ensure uniqueness\n- Use sanitized, unique name in restore flow; delete legacy after success\n\nCloses: #none
…ign submodules and pubspec to latest workspace state\n- No app code changes
…ving uniqueness\n\nPrevents duplicate wallets by avoiding premature suffixing during legacy migration.
…ion-sanitize-unique

fix(auth,migration): sanitize legacy wallet name and preserve legacy flag during migration
@ca333 ca333 merged commit 08ac039 into main Oct 22, 2025
8 of 14 checks passed
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 22, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request implements legacy wallet migration with automatic name sanitization and collision resolution. Changes include preserving the isLegacyWallet flag during config copying, adding utility methods for name sanitization and uniqueness resolution, and refactoring the restoration flow to handle legacy wallets with potentially updated names before sign-in attempts.

Changes

Cohort / File(s) Summary
Legacy wallet name utilities
lib/blocs/wallets_repository.dart
Added three new public methods: sanitizeLegacyMigrationName() replaces non-alphanumeric Unicode characters with underscores; resolveUniqueWalletName() appends numeric suffixes to resolve collisions; sanitizeAndResolveLegacyWalletName() chains both operations.
Config flag preservation
lib/model/wallet.dart
Modified WalletConfig.copy() to preserve the isLegacyWallet flag during config duplication. Formatting compacted in Wallet.copyWith().
Legacy restoration flow
lib/bloc/auth_bloc/auth_bloc.dart
Refactored _onRestore() to handle legacy wallets: sanitize base name, attempt sign-in, resolve unique name on collision, use updated wallet name throughout restoration pipeline, and delete legacy entry post-migration.
Version bump
pubspec.yaml
Incremented build number from 0 to 1 (version 0.9.3+0 → 0.9.3+1).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AuthBloc
    participant WalletsRepo
    participant SignIn
    participant Wallet

    User->>AuthBloc: Restore event with legacy wallet
    AuthBloc->>WalletsRepo: sanitizeLegacyMigrationName(name)
    WalletsRepo-->>AuthBloc: sanitized_name
    AuthBloc->>SignIn: Attempt sign-in with sanitized_name
    
    alt Sign-in succeeds
        SignIn-->>AuthBloc: Success
        AuthBloc->>Wallet: Delete legacy entry
        AuthBloc-->>User: Restoration complete
    else Sign-in fails (collision)
        SignIn-->>AuthBloc: Failure
        AuthBloc->>WalletsRepo: resolveUniqueWalletName(sanitized_name)
        WalletsRepo-->>AuthBloc: unique_name (e.g., sanitized_name_1)
        
        rect rgb(200, 220, 240)
            note over AuthBloc: Resume with unique name
            AuthBloc->>AuthBloc: Update workingWallet name
        end
        
        AuthBloc->>SignIn: Sign-in with unique_name
        SignIn-->>AuthBloc: Success
        AuthBloc->>Wallet: Delete legacy entry
        AuthBloc-->>User: Restoration complete
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

The changes span multiple interconnected components with heterogeneous logic patterns: dense conditional flow in auth_bloc.dart for legacy restoration, new utility methods with edge-case handling in wallets_repository.dart, and subtle flag-preservation logic in wallet.dart. The restoration pipeline requires careful tracing through sign-in attempts, name resolution, and cleanup sequencing, along with verification that workingWallet consistently replaces the original wallet reference throughout.

Possibly related PRs

Suggested labels

bug, QA

Suggested reviewers

  • smk762
  • CharlVS
  • takenagain

Poem

🐰 Hops through legacy wallets with care,
Sanitizing names with underscores fair,
Collisions resolved with numeric flair,
Old wallets migrate—fresh start declared!

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da77aea and ee0b25b.

📒 Files selected for processing (5)
  • PR_BODY.md (1 hunks)
  • lib/bloc/auth_bloc/auth_bloc.dart (4 hunks)
  • lib/blocs/wallets_repository.dart (1 hunks)
  • lib/model/wallet.dart (2 hunks)
  • pubspec.yaml (1 hunks)

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit ee0b25b):

https://walletrc--pull-3208-merge-3fffbnbw.web.app

(expires Wed, 29 Oct 2025 15:55:47 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

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