Skip to content

Any SwiftData persist failure is reported as a fatal changeset error #6135

Open

Description

@thepastaclaw

PastaClaw flagged this while reviewing #6124, where it was deferred to a follow-up instead of being fixed in that pull request. This issue tracks the follow-up.

Any SwiftData persist failure is reported as a fatal changeset error (suggestion)

Impact: Any SwiftData failure while persisting profiles or addresses returns 1 from the callback, which Rust maps to PersistenceErrorKind::Fatal, so a transient failure such as a locked store is treated as never-retryable.

Where: packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletPersistenceHandler.swift:10631-10636 at 2cca325ba3ef:

let success = handler.persistIdentities(
walletId: walletId,
upserts: upserts,
removed: removed
)
return success ? 0 : 1

Consequence: the wallet may stop retrying a round that would succeed later. Mechanism: persistIdentities returns Bool and the C shim returns success ? 0 : 1, while persist_rc_kind maps every code other than -2/-3 to Fatal, and the surrounding docs describe 1 as the generic non-zero. A save failure is at least sometimes transient or a constraint violation, not a poison changeset, and this PR adds new fallible work (address replace/remove) into that same Bool path. Fix: return PLATFORM_WALLET_PERSIST_RC_TRANSIENT (or CONSTRAINT where appropriate) from the failure path instead of 1, or map 1 to Transient on the Rust side for this callback; note the existing conservative-Fatal intent, so a transient mapping should bound retries rather than retry forever.

Origin

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions