Skip to content

Preserve Persisted Error Classification#1429

Draft
chavic wants to merge 2 commits intopayjoin:masterfrom
chavic:chavic/persisted-replay-errors-1275
Draft

Preserve Persisted Error Classification#1429
chavic wants to merge 2 commits intopayjoin:masterfrom
chavic:chavic/persisted-replay-errors-1275

Conversation

@chavic
Copy link
Copy Markdown
Collaborator

@chavic chavic commented Mar 20, 2026

Closes #1275.

This PR preserves persisted and replay error semantics across the FFI boundary instead of flattening them into generic storage or API failures. Core already distinguished storage failures, transient API failures, fatal failures, fatal failures that carry a replyable state, and multiple replay failure modes, but that structure was being lost before it reached bindings. On the receiver side, some save paths were even re-boxing persisted failures as generic implementation errors.

The change adds stable persisted and replay classifications in core and maps those explicitly through the FFI. In particular, receiver-side FatalWithState remains distinct and carries the replyable state instead of collapsing into plain fatal failure, and replay failures preserve whether the problem was no events, invalid events, expiry, or persistence failure.

The net effect is that bindings can make correct recovery decisions without reverse-engineering behavior from display strings. This is the piece that restores the real state-machine semantics at the language boundary and makes later retry and lifecycle work build on explicit classification instead of lossy flattening.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Mar 20, 2026

Pull Request Test Coverage Report for Build 24011167381

Details

  • 91 of 95 (95.79%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 84.424%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin/src/core/persist.rs 47 51 92.16%
Totals Coverage Status
Change from base Build 24003181260: 0.08%
Covered Lines: 10889
Relevant Lines: 12898

💛 - Coveralls

chavic added 2 commits April 4, 2026 12:22
Expose persisted and replay error classification in core so the
FFI can preserve storage, transient, fatal, and fatal-with-state
semantics.

This keeps sender and receiver bindings from losing recovery
guidance at the persistence boundary, and it snapshots replay
failures with stable kind and detail accessors. The receiver save
helpers now retain replyable error state instead of flattening it
into implementation errors, which lets bindings continue the
protocol after fatal-with-state failures.
Upgrade uniffi-dart to the upstream revision that fixes Dart\nobject naming for Error-suffixed UniFFI types.\n\nThis branch exposes replay persistence failures that return\nImplementationError over FFI. The older generator revision emits\nbroken Dart type references for that shape, so the Dart jobs fail to\ncompile.\n\nUpdate the dependency and refresh both lockfiles so the branch uses\nthe fixed generator consistently in CI and local binding generation.
@chavic chavic force-pushed the chavic/persisted-replay-errors-1275 branch from 06a8e10 to f515caf Compare April 5, 2026 21:46
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.

Expose replay error classification and variant data in FFI

2 participants