Skip to content

fix: include identity name in auth key missing error messages#745

Closed
thepastaclaw wants to merge 2 commits into
dashpay:v1.0-devfrom
thepastaclaw:fix-743-auth-key-banner-identity
Closed

fix: include identity name in auth key missing error messages#745
thepastaclaw wants to merge 2 commits into
dashpay:v1.0-devfrom
thepastaclaw:fix-743-auth-key-banner-identity

Conversation

@thepastaclaw
Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw commented Mar 13, 2026

Summary

When an identity lacks an authentication key for signing document transitions,
the error message now includes the identity name (or base58 ID if no alias is
set). This helps users with multiple identities identify which one has the
problem.

Closes #743

Changes

  • src/ui/identities/mod.rs — include qualified_identity.display_string()
    in the error from get_selected_wallet
  • src/backend_task/identity/register_dpns_name.rs — same fix in the DPNS
    name registration path

Validation

  • cargo clippy — no warnings
  • cargo fmt --all -- --check — clean
  • cargo check — compiles successfully

Summary by CodeRabbit

  • Bug Fixes
    • Improved error messaging when authentication keys are missing during identity registration and document processing operations. Error messages now include specific identity identifiers, providing users with clearer context to identify affected identities and resolve authentication-related issues more efficiently.

When an identity lacks an authentication key for signing document
transitions, the error message now includes the identity name or
base58 ID so users with multiple identities can identify which one
has the problem.

Closes dashpay#743
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 123f505a-7a6f-44c5-8482-8cf558f7aa47

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Two files are updated to enhance error messaging when an identity lacks an authentication key for signing document transitions. Error messages now include the identity identifier, enabling users to pinpoint which identity is affected.

Changes

Cohort / File(s) Summary
Authentication Key Error Messages
src/backend_task/identity/register_dpns_name.rs, src/ui/identities/mod.rs
Modified error handling to include the identity's display string in the authentication key absence message, replacing generic static strings with identity-specific information.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A little rabbit hops with glee,
Each identity now has its ID!
No more guessing, no more "Which one's wrong?"
Error messages now sing a clearer song. 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: including identity name in error messages for missing authentication keys.
Linked Issues check ✅ Passed The code changes successfully implement the requirement from issue #743 by adding qualified_identity.display_string() to error messages in both affected files, enabling users to identify which identity lacks the authentication key.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the stated objectives: updating error messages in src/backend_task/identity/register_dpns_name.rs and src/ui/identities/mod.rs to include identity identification.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@thepastaclaw
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/backend_task/identity/register_dpns_name.rs (1)

128-131: Make this error construction lazy with ok_or_else.

ok_or(format!(...)) builds the message on every call, including success cases. ok_or_else(|| format!(...)) avoids unnecessary allocation and display_string() work.

Proposed diff
-        let public_key = qualified_identity
-            .document_signing_key(&preorder_document_type)
-            .ok_or(format!(
-                "Identity {} doesn't have an authentication key for signing document transitions",
-                qualified_identity.display_string()
-            ))?;
+        let public_key = qualified_identity
+            .document_signing_key(&preorder_document_type)
+            .ok_or_else(|| {
+                format!(
+                    "Identity {} doesn't have an authentication key for signing document transitions",
+                    qualified_identity.display_string()
+                )
+            })?;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/backend_task/identity/register_dpns_name.rs` around lines 128 - 131,
Replace the eager error construction using ok_or(...) with a lazy closure
ok_or_else(|| ...) so the formatted message (including
qualified_identity.display_string()) is only built on the error path; locate the
call that currently uses .ok_or(format!("Identity {} doesn't have an
authentication key for signing document transitions",
qualified_identity.display_string())) and change it to use .ok_or_else(||
format!(...)) to avoid unnecessary allocation and work on success.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/backend_task/identity/register_dpns_name.rs`:
- Around line 128-131: Replace the eager error construction using ok_or(...)
with a lazy closure ok_or_else(|| ...) so the formatted message (including
qualified_identity.display_string()) is only built on the error path; locate the
call that currently uses .ok_or(format!("Identity {} doesn't have an
authentication key for signing document transitions",
qualified_identity.display_string())) and change it to use .ok_or_else(||
format!(...)) to avoid unnecessary allocation and work on success.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4d3f6e63-d83c-4197-900f-9a0abd7bd270

📥 Commits

Reviewing files that changed from the base of the PR and between d928288 and 1ae508d.

📒 Files selected for processing (2)
  • src/backend_task/identity/register_dpns_name.rs
  • src/ui/identities/mod.rs

@thepastaclaw
Copy link
Copy Markdown
Collaborator Author

Superseded by #750 which includes this fix plus suppresses the error on startup auto-select.

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.

Identity doesn't have an authentication key for signing document transitions

1 participant