Skip to content

Rename FFI builder errors to match payjoin crate - #1733

Merged
DanGould merged 1 commit into
payjoin:masterfrom
xstoicunicornx:rename-ReceiverBuilderError
Sep 30, 2026
Merged

DanGould merged 1 commit into
payjoin:masterfrom
xstoicunicornx:rename-ReceiverBuilderError

Conversation

@xstoicunicornx

Copy link
Copy Markdown
Collaborator

Rename SenderBuilderError to BuildSenderError and
ReceiverBuilderError to BuildReceiverError in payjoin-ffi so the FFI error names mirror the core payjoin crate's naming convention (e.g. payjoin::send::BuildSenderError).

This is a follow up from suggestion made in #1724 (comment).

Claude Fable was used to make these code updates.

Pull Request Checklist

Please confirm the following before requesting review:

@coveralls

coveralls commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 29438188507

Coverage remained the same at 86.187%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15963
Covered Lines: 13758
Line Coverage: 86.19%
Coverage Strength: 345.24 hits per line

💛 - Coveralls

@xstoicunicornx
xstoicunicornx marked this pull request as draft July 13, 2026 16:22
Comment thread payjoin-ffi/src/send/error.rs Outdated
/// Sender Build error
#[error(transparent)]
Build(Arc<SenderBuilderError>),
Build(Arc<BuildSenderError>),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could make this Builder to prevent the collision?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was very helpful thanks! How did you know this was what was causing the collision? I didn't really know where to start troubleshooting.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just experience dealing with the dart binding generator. We dealt with the same collision in #1724 (comment) and knowing how dart uniffi smooshes names together.

I suspected that SenderError::Build() became BuildSenderException which collides with the struct BuildSenderError which also translates to BuildSenderException I double-checked by building the dart bindings on your branch and grepping to confirm in payjoin-ffi/dart/lib/payjoin.dart. This is especially confusing as the enum SenderError::Build(Arc<BuildSenderError>) wraps the offending Struct in an Arc.

Now it does not collide as we have BuildSenderException and BuildSenderSenderException. Can't say I love that but thats just how dart is

Rename SenderBuilderError to BuildSenderError and
ReceiverBuilderError to BuildReceiverError in payjoin-ffi so the
FFI error names mirror the core payjoin crate's naming convention
(e.g. payjoin::send::BuildSenderError).
@xstoicunicornx
xstoicunicornx force-pushed the rename-ReceiverBuilderError branch from 1f9f450 to 00a3f62 Compare July 15, 2026 17:51
@xstoicunicornx
xstoicunicornx marked this pull request as ready for review July 15, 2026 18:21
@benalleng benalleng added the ffi label Jul 16, 2026

@caarloshenriq caarloshenriq left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK 00a3f62

One thing to double check: SenderInputError also has a Build(Arc) variant (send/error.rs, untouched by this commit) that looks like the exact same pattern @benalleng flagged for SenderError::Build, variant name Build wrapping a struct that also resolves to BuildSenderException in dart. Was SenderInputError checked the same way (building dart bindings and grepping payjoin.dart), or did that one slip through since the earlier check was specific to SenderError?

@xstoicunicornx

Copy link
Copy Markdown
Collaborator Author

One thing to double check: SenderInputError also has a Build(Arc) variant (send/error.rs, untouched by this commit) that looks like the exact same pattern @benalleng flagged for SenderError::Build, variant name Build wrapping a struct that also resolves to BuildSenderException in dart. Was SenderInputError checked the same way (building dart bindings and grepping payjoin.dart), or did that one slip through since the earlier check was specific to SenderError?

Can you be a bit more specific on what should be double checked here? What Ben was referring to above was a duplicate compiled variable name that caused a collision specifically in Dart bindings. This was the enum that had compiled variable name that collided with my error renaming.

Build(Arc<SenderBuilderError>),

@DanGould I can't remember whether you said that FFI 1.0 had gone out already or not. If not this might be good to get in, if it has then we should probably close this.

@benalleng benalleng self-assigned this Sep 29, 2026
@benalleng
benalleng self-requested a review September 29, 2026 17:46
@benalleng

Copy link
Copy Markdown
Collaborator

So the payjoin 1.0 FFI releases have been pushed but I'm not sure if that means that this should be closed by default.

image

Do FFI bindings have the same semver expectations as the main rust code? Especially considering none of the bindings versions are post 1.0 I would lean towards no and that this can still be merged.

@benalleng benalleng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 00a3f62

Thinking more about my previous comment I think that the breaking change expectation is not as strict in the FFI layer as it is in the rust layer and that this is still appropriate to merge post payjoin-1.0. All the bindings are still relatively immature and their is a possibility that things like the new uniffi-dart versions or some existing language specific bug will need fixing and this should not limit us across the entire repo.

@DanGould looking for an ACK on this above sentiment to merge this PR

@DanGould

DanGould commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

payjoin-ffi is still pre 1.0 and breaking changes are welcome there. Payjoin-1.0 lets ffi commit to the event format underneath while ffi still moves. And I think with uniffi being pre 1.0 and much less stable than say, bitcoin-0.32, constantly changing minor versions, payjoin-ffi-1.0 is probably not on the near horizon.

@DanGould
DanGould merged commit cf847c9 into payjoin:master Sep 30, 2026
22 checks passed
@benalleng benalleng mentioned this pull request Sep 30, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants