Skip to content

feat(rs-platform-wallet): SPV runtime accessors + FFI error mapping#3651

Draft
lklimek wants to merge 1 commit into
v3.1-devfrom
feat/platform-wallet-spv-accessors-and-ffi-errors
Draft

feat(rs-platform-wallet): SPV runtime accessors + FFI error mapping#3651
lklimek wants to merge 1 commit into
v3.1-devfrom
feat/platform-wallet-spv-accessors-and-ffi-errors

Conversation

@lklimek
Copy link
Copy Markdown
Contributor

@lklimek lklimek commented May 15, 2026

Summary

Independent carve-out of three small production clusters (D, E, K) extracted from #3549 (the e2e-framework PR), so they can land on v3.1-dev without waiting for the large e2e suite. No companion issue — this PR is the unit of work tracking. Single commit 62e03c6298.

D — SPV runtime accessors (spv/runtime.rs, wallet/identity/state/manager/accessors.rs)

  • SpvRuntime::cancel_background() — sync cancellation-token fire so a panic hook can release the SPV data-dir lock.
  • SpvRuntime::event_manager() accessor.
  • IdentityManager::identity_ids() snapshot helper.

E — FFI error mapping (rs-platform-wallet-ffi/src/error.rs)

  • New result codes ErrorArithmeticOverflow = 13 (reserved, ABI placeholder) and ErrorNoSelectableInputs = 14.
  • NoSpendableInputs / OnlyOutputAddressesFunded / OnlyDustInputs now map to the dedicated FFI code instead of flattening to ErrorUnknown; typed Display rendering survives in the message. Catch-all ErrorUnknown retained for unmapped variants.
  • Two unit tests pin the mapping and the catch-all fall-through.

K — DAPI dispatch trace log (rs-dapi-client/src/dapi_client.rs)

  • One tracing::trace! emitting the resolved DAPI endpoint/method. Pure observability, no behavior change.

Copied error variants (rs-platform-wallet/src/error.rs)

Provenance & strategy

This PR is intentionally independent on v3.1-dev (not stacked on #3554/#3585) per an explicit operator directive given during the carve-out session — NOT a separate project-maintainer ruling. The verbatim operator directive was: "Create an independent PR on top of v3.1-dev and copy these new errors there. We'll handle conflicts during merge."

The commit message's "Per maintainer decision this PR is independent on v3.1-dev" wording is inaccurate and is corrected here at the PR-narrative level. There was no dashpay/platform maintainer decision; the true provenance is the in-session operator directive quoted above. History was deliberately not rewritten (see the PR comment) so the immutable commit record stays intact.

The error-enum variants NoSpendableInputs (from #3585), OnlyOutputAddressesFunded and OnlyDustInputs (from #3554) are copied verbatim and deliberately duplicated so D+E+K compiles standalone. These definitions WILL collide with #3554/#3585 at merge time — this is expected and accepted; the conflicts are to be resolved at merge (the definitions are identical, so resolution is mechanical). A human maintainer should explicitly ratify this deliberate-duplication strategy before this PR is un-drafted / merged.

Test plan / How Has This Been Tested?

  • cargo build -p platform-wallet-ffi -p platform-wallet -p rs-dapi-client — clean.
  • cargo clippy -p platform-wallet-ffi -p platform-wallet -p rs-dapi-client — zero diagnostics on changed code (only pre-existing workspace Cargo.toml profile warnings, present on untouched base).
  • cargo test -p platform-wallet-ffi --lib error — all passed (incl. no_selectable_inputs_maps_to_dedicated_code, unmapped_variants_fall_through_to_unknown).
  • Single-file rustfmt --edition 2021 on each touched file.

Breaking Changes

None. Additive: new error variants, new FFI result codes (existing codes unchanged), new public accessors, one trace log.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

Co-authored by Claudius the Magnificent AI Agent

Carve-out of clusters D, E, K from #3549 (e2e framework PR) as an
independent production change on v3.1-dev.

D — SPV runtime accessors: SpvRuntime::cancel_background() (sync
cancellation-token fire for panic-hook data-dir-lock release) and
SpvRuntime::event_manager(); IdentityManager::identity_ids() snapshot.

E — FFI error mapping: dedicated ErrorNoSelectableInputs=14 (and
reserved ErrorArithmeticOverflow=13); NoSpendableInputs /
OnlyOutputAddressesFunded / OnlyDustInputs now map to the dedicated
FFI code instead of flattening to ErrorUnknown.

K — DAPI dispatch trace log: one tracing::trace! emitting the
resolved endpoint/method. Pure observability.

E's match arm consumes three PlatformWalletError variants that live
in the still-open #3554 (OnlyOutputAddressesFunded, OnlyDustInputs)
and #3585 (NoSpendableInputs). Per maintainer decision this PR is
independent on v3.1-dev and copies those variant definitions verbatim
so it compiles standalone; duplicate definitions are expected and
resolved at merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9caebdd1-3296-479f-9cf7-917199927e69

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/platform-wallet-spv-accessors-and-ffi-errors

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.

@github-actions github-actions Bot added this to the v3.1.0 milestone May 15, 2026
@lklimek
Copy link
Copy Markdown
Contributor Author

lklimek commented May 15, 2026

Provenance correction (narrative-level, no history rewrite)

The commit message of 62e03c6298 states "Per maintainer decision this PR is independent on v3.1-dev". That phrasing is an inaccurate provenance claim: there was no dashpay/platform maintainer decision. The accurate provenance is an explicit operator directive given during the carve-out session — verbatim: "Create an independent PR on top of v3.1-dev and copy these new errors there. We'll handle conflicts during merge."

The accurate provenance and the deliberate-duplication / merge-conflict caveat are now documented in the Provenance & strategy section of the PR description. Commit history was intentionally NOT rewritten (no amend/force-push) so the immutable commit record stays intact; the correction lives at the PR-narrative level only.

The error variants NoSpendableInputs (#3585), OnlyOutputAddressesFunded and OnlyDustInputs (#3554) are verbatim, deliberately duplicated and will collide with #3554/#3585 at merge — expected and accepted, resolved at merge. A human maintainer should explicitly ratify this deliberate-duplication strategy before this PR is un-drafted / merged.

Co-authored by Claudius the Magnificent AI Agent

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.

1 participant