Skip to content

fix(swift-sdk): remove EstablishedContact's clone-mutating setters#4140

Merged
QuantumExplorer merged 3 commits into
v4.1-devfrom
fix/deprecate-established-contact-clone-mutators
Jul 16, 2026
Merged

fix(swift-sdk): remove EstablishedContact's clone-mutating setters#4140
QuantumExplorer merged 3 commits into
v4.1-devfrom
fix/deprecate-established-contact-clone-mutators

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

managed_identity_get_established_contact inserts a .cloned() copy of the contact into the FFI handle table, so EstablishedContact.setAlias / clearAlias / setNote / clearNote / hide / unhide mutated a detached clone: the change never reached the wallet manager's contact state, was never persisted, and was silently lost when the handle was freed.

Found via dashwallet QA: the contact-settings sheet was wired to these setters and showed a "Saved" toast over a complete no-op (empty contactAlias/contactNote mirror columns, nothing published).

Since nothing has shipped, the setters are removed outright (Swift wrappers + the six FFI functions) rather than deprecated — no consumer exists: dashwallet is rewired to the correct API in dashwallet-ios#834 and SwiftExampleApp always used it.

The correct write path is untouched and already complete: ManagedPlatformWallet.setDashPayContactInfoplatform_wallet_set_dashpay_contact_info_with_signerset_contact_info_with_external_signer (local state first + persist + encrypted DIP-15 contactInfo document publish, with published / deferred / skipped outcome).

Getters (getAlias, getNote, isHidden, …) stay — reading the clone snapshot is fine.

Test plan

  • cargo check -p platform-wallet-ffi clean
  • dashwallet dashpay scheme builds against this branch (compiles swift-sdk from source; no remaining references)

🤖 Generated with Claude Code

managed_identity_get_established_contact hands out a .cloned() copy in
the FFI handle table, so setAlias/clearAlias/setNote/clearNote/hide/
unhide mutate a detached clone: the change never reaches the wallet
manager's contact state, is never persisted, and is silently lost when
the handle is freed. dashwallet wired its contact-settings UI to these
and shipped a "Saved" toast over a no-op.

The real write path already exists (ManagedPlatformWallet
.setDashPayContactInfo → platform_wallet_set_dashpay_contact_info_with_
signer → set_contact_info_with_external_signer: local state + persist +
encrypted contactInfo document publish), and the example app uses it.
Deprecate the Swift setters with a message pointing there, and document
the handle-local semantics on the FFI functions. Getters stay — reading
the clone is fine.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v4.1.0 milestone Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@QuantumExplorer, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 90d821a8-b014-4acb-8520-68868214848d

📥 Commits

Reviewing files that changed from the base of the PR and between c0239a3 and 2aaef1e.

📒 Files selected for processing (2)
  • packages/rs-platform-wallet-ffi/src/established_contact.rs
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/EstablishedContact.swift
📝 Walkthrough

Walkthrough

Changes

Established contact mutation guidance

Layer / File(s) Summary
FFI mutation documentation
packages/rs-platform-wallet-ffi/src/established_contact.rs
Documentation now states that alias, note, hide, and unhide mutations are handle-local and that persistence uses the wallet manager write API. The unhide note is duplicated.
Swift API deprecation
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/EstablishedContact.swift
setAlias, clearAlias, setNote, clearNote, hide, and unhide are marked deprecated with messages describing their detached, non-persistent state.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: llbartekll, zocolini

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and points to the main EstablishedContact setter change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/deprecate-established-contact-clone-mutators

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.

@thepastaclaw

thepastaclaw commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 2aaef1e)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/rs-platform-wallet-ffi/src/established_contact.rs`:
- Around line 280-287: Remove the duplicated Handle-local only documentation
block in the unhide documentation, retaining exactly one copy of the four-line
comment and leaving the surrounding documentation unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f494a76-0443-4b69-807e-bc4ae860bf80

📥 Commits

Reviewing files that changed from the base of the PR and between ecbdf97 and c0239a3.

📒 Files selected for processing (2)
  • packages/rs-platform-wallet-ffi/src/established_contact.rs
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/EstablishedContact.swift

Comment thread packages/rs-platform-wallet-ffi/src/established_contact.rs Outdated
QuantumExplorer and others added 2 commits July 17, 2026 04:33
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tright

Nothing has shipped, so no deprecation window is owed: delete the six
Swift setters (setAlias/clearAlias/setNote/clearNote/hide/unhide) and
their FFI functions instead of deprecating them. They mutated the
detached clone in the handle table — never wallet state, never disk,
never Platform. Getters stay (reading the clone snapshot is fine); the
real write path is ManagedPlatformWallet.setDashPayContactInfo, which
dashwallet now uses (dashwallet-ios #834) and the example app always
did.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@QuantumExplorer QuantumExplorer changed the title fix(swift-sdk): deprecate EstablishedContact's clone-mutating setters fix(swift-sdk): remove EstablishedContact's clone-mutating setters Jul 16, 2026
@QuantumExplorer
QuantumExplorer merged commit b889e05 into v4.1-dev Jul 16, 2026
18 checks passed
@QuantumExplorer
QuantumExplorer deleted the fix/deprecate-established-contact-clone-mutators branch July 16, 2026 22:13

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Final validation — Codex + Sonnet

This PR cleanly removes the six clone-mutating EstablishedContact setters/wrappers (setAlias/clearAlias/setNote/clearNote/hide/unhide) from both the Rust FFI and Swift layers in matched pairs, with no orphaned declarations or callers on either side of the boundary. Two checked-in API documents (Swift PlatformWallet README and rs-platform-wallet-ffi IMPLEMENTATION_SUMMARY.md) still advertise the removed methods/exports and should be updated to stay in sync with the actual surface.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (failed), gpt-5.6-sol — ffi-engineer (failed), gpt-5.6-sol — general (failed), gpt-5.6-sol — ffi-engineer (failed), gpt-5.6-sol — general (failed), gpt-5.6-sol — ffi-engineer (failed), gpt-5.6-sol — general (failed), gpt-5.6-sol — ffi-engineer (failed), gpt-5.6-sol — general (failed), gpt-5.6-sol — ffi-engineer (failed), gpt-5.6-sol — general (failed), gpt-5.6-sol — ffi-engineer (completed), gpt-5.6-sol — general (completed), gpt-5.6-sol — general (failed), gpt-5.6-sol — ffi-engineer (failed), gpt-5.6-sol — general (failed), gpt-5.6-sol — ffi-engineer (failed), gpt-5.6-sol — general (completed), gpt-5.6-sol — ffi-engineer (completed)
  • Verifier: claude-sonnet-5 — verifier
  • Sonnet reviewers: claude-sonnet-5 — general (failed), claude-sonnet-5 — ffi-engineer (failed), claude-sonnet-5 — general (failed), claude-sonnet-5 — ffi-engineer (completed), claude-sonnet-5 — general (completed)

🟡 1 suggestion(s) | 💬 1 nitpick(s)

2 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/README.md`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/README.md:334-335: Swift API documentation still advertises the removed contact mutators
  This PR deletes `setAlias`, `clearAlias`, `setNote`, `clearNote`, `hide`, and `unhide` from `EstablishedContact`, but this public API reference still declares them (lines 334-335, 356-357, 378, 382) and demonstrates them in runnable examples (lines 341, 349, 362, 364, 510-514). Verified directly: none of these six methods exist anywhere in the current `EstablishedContact.swift`. These examples no longer compile and continue steering consumers toward the detached-snapshot write model this PR removes. Update the doc to show only the remaining getters (`getAlias`, `getNote`, `isHidden`) and demonstrate persistent writes through `ManagedPlatformWallet.setDashPayContactInfo(identityId:contactId:alias:note:hidden:signer:)`.

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