fix: preserve existing identity data when loading by wallet#811
Draft
lklimek wants to merge 4 commits into
Draft
fix: preserve existing identity data when loading by wallet#811lklimek wants to merge 4 commits into
lklimek wants to merge 4 commits into
Conversation
Two bugs caused identity data (especially alias) to be lost when reloading an identity via Load Identity > By Wallet: 1. load_identity_from_wallet.rs hardcoded alias: None instead of deriving it from DPNS names (like load_identity.rs does). Now uses the first DPNS name as alias fallback. 2. insert_local_qualified_identity() used INSERT OR REPLACE which destroyed existing row data. Changed to INSERT ... ON CONFLICT with COALESCE to preserve existing non-null values (alias, wallet, wallet_index) when the incoming value is NULL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…ment Remove the if/else branch — one INSERT ... ON CONFLICT with COALESCE handles both cases. When wallet_and_identity_id_info is None, wallet and wallet_index are passed as NULL; COALESCE preserves any existing non-null values in the row. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When BackendTestContext::init() panics (e.g. framework wallet unfunded), tokio::sync::OnceCell retries on the next test. But the orphaned SPV tasks from the panicked init keep running on the shared tokio runtime, holding the data directory lock file. The retry then fails with "Data directory locked". Fix: stash the TaskManager's cancellation token in a static, and install a global panic hook that cancels it. On retry, init() also checks for and cancels any leftover token. This ensures SPV tasks are stopped and the lock file is released before a fresh init. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-overwrite # Conflicts: # tests/backend-e2e/framework/harness.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Imagine you're a user who registered a DPNS name for your identity. You go to Load Identity > By Wallet to reload it (maybe after switching networks or reinstalling). Previously, the reload would silently delete your alias — the identity entry was completely overwritten with fresh-but-incomplete data. Now the app merges new data with existing records, preserving your alias and wallet associations.
Key changes
load_identity_from_wallet.rsnow derives the alias from the first DPNS name (same logic asload_identity.rs), instead of hardcodingalias: Noneinsert_local_qualified_identity()changed fromINSERT OR REPLACE(destructive overwrite) toINSERT ... ON CONFLICT DO UPDATEwithCOALESCE— preserves existing non-nullalias,wallet, andwallet_indexwhen the incoming value is NULLWhat gets preserved vs updated
data(identity blob)aliaswallet/wallet_indexidentity_typestatusnetworkTest plan
cargo clippy --all-features --all-targets -- -D warningspassescargo test --all-features --workspacepasses (511 tests)🤖 Co-authored by Claudius the Magnificent AI Agent