Skip to content

Preserve Persisted Error Classification#1429

Draft
chavic wants to merge 1 commit intopayjoin:masterfrom
chavic:chavic/persisted-replay-errors-1275
Draft

Preserve Persisted Error Classification#1429
chavic wants to merge 1 commit 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.

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.
@coveralls
Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 23355435171

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.09%) to 84.212%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin/src/core/persist.rs 47 51 92.16%
Totals Coverage Status
Change from base Build 23300212261: 0.09%
Covered Lines: 10737
Relevant Lines: 12750

💛 - Coveralls

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