Repository navigation
feat(ffi): add missing options and entry fields to FFI output - #311
Merged
Merged
Conversation
Add missing fields to the FFI layer that weren't being passed through from the core types: LedgerOptions (13 new fields): - render_commas: boolean for number formatting - inferred_tolerance_default: per-currency tolerance map - inferred_tolerance_multiplier: tolerance multiplier (default 0.5) - infer_tolerance_from_cost: boolean flag - account_rounding: optional rounding account - account_previous_balances: opening balances account - account_previous_earnings: previous earnings account - account_previous_conversions: previous conversions account - account_current_earnings: current earnings account - account_current_conversions: optional current conversions account - account_unrealized_gains: optional unrealized gains account - conversion_currency: optional conversion currency Entry fields: - Posting.flag: posting-level flag (e.g., "!" for pending) - Balance.tolerance: explicit tolerance (e.g., "~ 0.01") Fixes #308, #310 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds missing ledger option fields and entry-level fields to the WASI FFI JSON output so downstream consumers (e.g., Python/Fava) can access the same data as the Rust loader.
Changes:
- Extended FFI output types with posting-level
flagand balancetolerance. - Added 13 missing
LedgerOptionsfields to the FFI output and defaults. - Plumbed the new options from loader results and parsing helpers into the load-full command output.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rustledger-ffi-wasi/src/types/output.rs | Expands serialized FFI output types to include new posting/balance fields and ledger options. |
| crates/rustledger-ffi-wasi/src/helpers.rs | Parses additional option keys from source metadata into LedgerOptions. |
| crates/rustledger-ffi-wasi/src/convert.rs | Populates new JSON fields (Posting.flag, Balance.tolerance) during conversion. |
| crates/rustledger-ffi-wasi/src/commands/load.rs | Wires loader display_precision and new ledger option fields into the load-full output. |
| crates/rustledger-ffi-wasi/src/commands/clamp.rs | Initializes the new Posting.flag field when constructing postings. |
💡 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-02-07)
What do these numbers mean?
|
- Add skip_serializing_if for empty inferred_tolerance_default map - Make boolean parsing consistent (accept "1" for infer_tolerance_from_cost) - Trim whitespace when parsing inferred_tolerance_default values - Simplify display_precision cloning with .clone() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Contributor
🧪 CI InsightsHere's what we observed from your CI run for bc72b73. 🟢 All jobs passed!But CI Insights is watching 👀 |
The loader uses FxHashMap (with FxBuildHasher) but FFI output uses std::collections::HashMap (with RandomState). Direct .clone() fails on MSRV because the hasher types don't match. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
robcohen
enabled auto-merge
February 8, 2026 00:32
robcohen
added this pull request to the merge queue
Feb 8, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to Branch Protection failures
Feb 8, 2026
You're not authorized to push to this branch. Visit "About protected branches" for more information.
robcohen
added this pull request to the merge queue
Feb 8, 2026
This was referenced Feb 8, 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
Add missing fields to the FFI layer that weren't being passed through from the core types. This closes the gap between what the Rust loader knows and what Fava/Python consumers can access.
LedgerOptions (13 new fields)
render_commas: boolean for number formattinginferred_tolerance_default: per-currency tolerance map (e.g.,{"USD": "0.005", "*": "0.01"})inferred_tolerance_multiplier: tolerance multiplier (default 0.5)infer_tolerance_from_cost: boolean flagaccount_rounding: optional rounding accountaccount_previous_balances: opening balances accountaccount_previous_earnings: previous earnings accountaccount_previous_conversions: previous conversions accountaccount_current_earnings: current earnings accountaccount_current_conversions: optional current conversions accountaccount_unrealized_gains: optional unrealized gains accountconversion_currency: optional conversion currencyEntry fields
Posting.flag: posting-level flag (e.g.,"!"for pending)Balance.tolerance: explicit tolerance (e.g.,"~ 0.01")Test plan
cargo fmt --check- passescargo clippy- no warningscargo test --all- all tests passjust test-cov- coverage generatedRelated issues
Fixes #308
Fixes #310
🤖 Generated with Claude Code