Draft
Conversation
Add an `index()` getter to `PsbtInputsError` and an `input_index()` method on the core `BuildSenderError` so the FFI layer can extract the zero-based position of the offending PSBT input. The FFI `BuildSenderError` now carries an `input_index` field (exposed via uniffi) that is populated from the core error during conversion. This lets Swift, Kotlin, Python, and other FFI consumers surface precise diagnostics about which input failed validation. Six new tests verify propagation at the core psbt, core send, and FFI layers. Closes payjoin#1276
Pull Request Test Coverage Report for Build 22572328646Details
💛 - Coveralls |
2aa6067 to
f687458
Compare
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
297a467 to
de5c122
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a PSBT input fails validation, FFI consumers currently get an error message but no way to programmatically identify which input caused the failure. Without the index, callers must parse error strings or guess, making robust error handling impossible in language bindings (Swift, Kotlin, Python).
Closes payjoin#1276
Approach
Add an
index()getter to the corePsbtInputsErrorand aninput_index()getter toBuildSenderError, then thread the index through the FFI layer asinput_index: Option<u64>onBuildSenderError, populated during theFrom<send::BuildSenderError>conversion. The receive-sidePsbtInputError(singular, not plural) already represents a single input and has no index to propagate, so it is left unchanged. Six tests verify index propagation at the core psbt, core send, and FFI layers.Open questions
None
Disclosure: co-authored by Claude