Skip to content

fix(wallet): require only atomic tracked-lock writes for reconciliation - #5207

Draft
lklimek wants to merge 5 commits into
fix/pr-5126from
fix/sqlite-asset-lock-reconciliation
Draft

lklimek wants to merge 5 commits into
fix/pr-5126from
fix/sqlite-asset-lock-reconciliation

Conversation

@lklimek

@lklimek lklimek commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR

When a saved funding deposit is reported as already used, retain its recovery state and return the specific result instead of failing on an unrelated storage requirement.

User story

As a wallet user, I can understand why a saved deposit cannot fund another payment and check the earlier payment or choose another deposit.

Scenario

Choose Fund for a restored deposit that the network reports as already used. The recovery step updates the loaded deposit and saves that update atomically. It must not fail merely because the storage backend cannot restore unrelated wallet data.

Detailed discussion

Issue being fixed or feature implemented

Stacked on #5150 (fix/pr-5126). Integrated in dashpay/dash-evo-tool#1036. SQLite restores tracked asset locks but does not declare the broader WALLET_RESTORE capability. Asset-lock reconciliation previously required that capability despite operating on an already-loaded record.

What was done?

Compatibility

No callback layout, capability version, or Swift/iOS integration changes. Backends need atomic writes and tracked asset-lock persistence for this operation.

How Has This Been Tested?

  • 20 targeted Rust tests passed: 4 capability, 1 FFI callback admission, 3 SQLite reopen/manager hydration, and 12 typed-error/reconciliation tests.
  • Scoped formatting, Clippy with CI's --no-deps -D warnings, and diff checks passed.
  • No live user-wallet spending. Final net diff has no Swift changes.

Breaking Changes

None.

Checklist

  • Self-review performed
  • Relevant operation contract documented
  • Focused regression coverage
  • Validation limitations documented

🤖 Co-authored by Claudius the Magnificent AI Agent

Accept atomic tracked-asset-lock writes with either full wallet restore
or the narrower tracked-asset-lock restore capability. SQLite attests
only the latter, matching its public load and manager hydration paths.
Preserve the typed consumption report, nonterminal recovery marker,
proof, and persistence failure behavior.

Co-Authored-By: Codex GPT-6 <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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 Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

🕓 Review not started yet because this PR is a draft.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit f19cc0a. Normal review starts when eligible; priority review starts as soon as a slot is available.

Make the existing tracked-lock capability cover persistence and nonterminal
restart restore, and require only that contract plus atomic changesets for
reconciliation. Admit the FFI bit only with persistence and paired restore
callbacks. Fail Swift wallet restore if its tracked-lock fetch fails.

Co-Authored-By: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
@lklimek lklimek changed the title fix(wallet): allow scoped SQLite asset-lock reconciliation fix(wallet): require tracked asset locks to persist and restore Sep 29, 2026
@lklimek lklimek changed the title fix(wallet): require tracked asset locks to persist and restore fix(platform-wallet): allow scoped SQLite asset-lock reconciliation Sep 29, 2026
@lklimek lklimek changed the title fix(platform-wallet): allow scoped SQLite asset-lock reconciliation fix(wallet)!: require tracked asset locks to persist and restore Sep 29, 2026
Require only atomic tracked-lock persistence for reconciliation of an
already-loaded wallet. Preserve existing capability meanings and FFI host
admission behavior, with wallet restore work outside this change.

Keep regression coverage for SQLite reopen/hydration, typed consumption
errors, and persistence failure handling.

Co-Authored-By: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
@lklimek lklimek changed the title fix(wallet)!: require tracked asset locks to persist and restore fix(wallet): require only atomic tracked-lock writes for reconciliation Sep 29, 2026

This branch has not been deployed

No deployments
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