Repository navigation
fix(ffi-wasi): accept Document.tags/links via RPC input (closes #1213) - #1216
Merged
Merged
Conversation
The output wire shape of `Document.tags` and `Document.links` was fixed for both bindings in #1212, but the FFI-WASI input side was still missing the fields entirely. `InputEntry::Document` had no `tags` / `links` slots, and the converter at line 542 hardcoded `Vec::new()` -- so callers using `entry.create` / `entry.createBatch` to construct Document directives could never attach tags or links, even though the core type and the output wire shape both support them. Mirror the `InputEntry::Transaction` shape: - Add `tags: Vec<String>` and `links: Vec<String>` with `#[serde(default)]` to `InputEntry::Document`. The default-empty serde behavior keeps the wire backward-compatible -- a payload without the new fields still deserializes cleanly. - Update the converter to populate the core `Document.tags` and `Document.links` via the same `.iter().map(|t| t.clone().into())` pattern Transaction already uses. Add two regression tests: - `document_tags_and_links_round_trip_1213` -- a Document payload with tags + links round-trips through the bridge and arrives on the core `Document` with both fields populated. - `document_tags_and_links_default_to_empty_1213` -- a legacy payload without `tags`/`links` fields still converts cleanly, producing empty vectors. Backward-compat guard for pre-#1213 clients in the wild. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the rustledger-ffi-wasi JSON-RPC input plumbing for Document directives by allowing callers to provide tags and links (matching the core Document type and aligning with InputEntry::Transaction’s shape).
Changes:
- Added
tags: Vec<String>andlinks: Vec<String>(both#[serde(default)]) toInputEntry::Documentfor backward-compatible deserialization. - Updated the
InputEntry→ coreDirective::Documentconversion to populateDocument.tags/Document.linksfrom RPC input. - Added regression tests covering (1) tags/links round-trip via RPC input and (2) legacy payloads defaulting to empty vectors.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs main branch (2026-05-28)
What do these numbers mean?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
This was referenced May 28, 2026
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
The output wire shape of
Document.tags/Document.linkswas fixed for both bindings in #1212, but the FFI-WASI input side was still missing the fields entirely.InputEntry::Documenthad notags/linksslots and the converter hardcoded empty vectors — so callers usingentry.create/entry.createBatchcould never attach tags or links to Document directives via JSON-RPC.tags: Vec<String>andlinks: Vec<String>with#[serde(default)]toInputEntry::Document. Backward-compatible: legacy payloads without the fields continue to deserialize cleanly.Document.tags/Document.linksin the converter using the same.iter().map(|x| x.clone().into())pattern Transaction already uses.Mirrors
InputEntry::Transaction's shape exactly. Surfaced during the #1212 deep review; one of the two#1144-induced plumbing gaps (the other is #1214 on the plugin-wrapper side).Test plan
cargo test -p rustledger-ffi-wasi— 58/58 pass (was 56; +2 new tests)cargo clippy -p rustledger-ffi-wasi --all-targets -- -D warnings— cleancargo fmt --all -- --check— cleanCloses #1213.
🤖 Generated with Claude Code