Repository navigation
fix(platform-errors): user-friendly message for duplicate DPNS name - #915
Conversation
StateError::DuplicateUniqueIndexError previously fell through to the
generic PlatformRejected catch-all ("check your input and try again"),
so registering an already-taken DPNS username surfaced a raw
technical message instead of actionable guidance.
Add a typed mapper arm that detects the DPNS domain unique-index
(normalizedParentDomainName + normalizedLabel) and reports "This
username is already taken"; any other duplicate-unique-index case
gets a generic "conflicts with an existing entry" message instead of
regressing to the old vague fallback.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ 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 |
…call site The shared From<SdkError> boundary was contract-blind and could mislabel non-DPNS duplicate-index conflicts as "username already taken". The DPNS-specific message now applies only where the code knows it is registering a DPNS domain. Co-Authored-By: OpenAI Codex <[email protected]>
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
🕓 Ready for review — 48 ahead in queue (commit 36ecc38) |
Brings in: shutdown fix (dashpay#905), duplicate-DPNS-name error message (dashpay#915), startup banner clearing (dashpay#916), nav pointer cursor + tooltips and wallet-less masternode indication (dashpay#917), onboarding disconnected- banner suppression (dashpay#907), masternode dialog/nav/passphrase fixes (dashpay#913), DAPI auto-refresh during pre-1.0 migration (dashpay#908), "Add Receiving Address" wiring + its test hardening (dashpay#914, dashpay#920), and a CI timeout bump (dashpay#912). dashpay#906 (shielded re-enable) was already pulled in individually last session, so its squashed commit merged as a no-op. Conflicts (6 files) were rebrand-naming overlaps (dash_evo_tool:: vs orchardpay:: imports) plus one real merge in left_panel.rs, where OrchardPay's green-icon tint had to combine with upstream's new nav tooltip. Also fixed 5 files upstream's auto-merged (non-conflicting) additions left un-rebranded: a stray DASH_EVO_DATA_DIR_LOCK/env-var name in a new app.rs test, and dash_evo_tool:: references in three kittest test files. Added tooltip strings for OrchardPay's own nav entries (OrchardPay, DashPay) so the new every_nav_entry_has_a_tooltip test covers them — upstream's version only knows its own nav items. Fixed the new nav_label_hover_shows_pointer_cursor kittest test: OrchardPay's nav rail carries two more always-visible entries than upstream's, pushing "Settings" below the scrollable list's default-size visible viewport; scroll it into view first, matching what a real user would do. Verified: cargo check (both feature modes), cargo clippy --all-features --all-targets -- -D warnings, cargo fmt --all, cargo test --all-features --workspace (2066 lib + 257 kittest + doc tests, 0 failed), all clean. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Why this PR exists
Debug-formatted internal error instead of an actionable message.StateError::DuplicateUniqueIndexErrorconsensus error (code 40105), butTaskError's classifier has no arm for that variant, so it falls through to the genericPlatformRejectedcatch-all: "The platform rejected this request. Please check your input and try again." — no indication the name is taken, no path to self-resolve. In the field this has surfaced as the literal Rust struct dump reaching the banner (PlatformRejected { source_error: StateTransitionBroadcastError { code: 40105, ... DuplicateUniqueIndexError { ... duplicating_properties: ["normalizedParentDomainName", "normalizedLabel"] } ... } }).What was done
Added a typed classification arm for
ConsensusError::StateError(StateError::DuplicateUniqueIndexError(e))inTaskError::from<SdkError>'s mapper (src/backend_task/error.rs):TaskError::DpnsUsernameAlreadyTaken— message: "This username is already taken. Please choose a different username and try again."TaskError::PlatformEntryConflict— generic fallback for any other duplicate-unique-index case, so those no longer regress to the old vague message either; message: "This request conflicts with an existing entry. Please use different values and try again."Both preserve the original
Box<SdkError>as a typed#[source], matching the convention used by sibling variants. Detection matches only on the typedduplicating_properties()accessor — no string parsing of error text, per this repo's error-handling conventions.Post-review follow-up: the shared
From<SdkError>boundary is reached by anyDuplicateUniqueIndexError, not just DPNS registration —src/backend_task/document.rsfunnels the same generic document/document-action task path (wired to the Contracts & Documents UI, over arbitrary caller-supplied contracts) through this exact conversion. Deciding the DPNS-specific message purely from property-name content at that shared boundary meant a non-DPNS contract that happens to define a unique index over identically-named fields would incorrectly get the DPNS-branded message. Fixed by making the shared classifier always return the genericPlatformEntryConflict, and relocating the DPNS-specific rebrand to the one call site that actually knows it's registering a DPNS domain (src/backend_task/identity/register_dpns_name.rs) — applied only to the domain-document put, not the preorder put.Testing
from_sdk_error_duplicate_unique_index_dpns_named_fields_is_generic/..._other_document_is_actionable/..._boundary_property_counts_are_generic(src/backend_task/error.rs) — the shared classifier stays generic for everyDuplicateUniqueIndexError, including 0/1-property boundary cases.rebrand_dpns_domain_conflict_maps_platform_entry_conflict/..._passes_through_other_errors(src/backend_task/identity/register_dpns_name.rs) — the relocated rebrand function correctly upgrades a DPNS domain conflict and passes every other error through unchanged.cargo test --all-features from_sdk_error_duplicate_unique_indexandrebrand_dpns_domain_conflict— all 5 tests pass by name.cargo clippy --all-features --bin dash-evo-tool -- -D warnings— clean.cargo fmt --all— applied.Breaking changes
None.
Checklist
cargo fmt --allcargo clippycleanAttribution
🤖 Co-authored by Claudius the Magnificent AI Agent