Repository navigation
fix(component): host-path mapping, typed-value shape, field defaults - #171
Merged
Merged
Conversation
Three fidelity fixes so the component engine matches the JSON-RPC engine's
output when exercised beyond the load/query/clamp happy path (found by running
Fava's full suite through the component for the first time):
- load_full: map WASI guest paths (the `/work` pre-open mount) in returned
`meta.filename` and includes back to real host paths. Fava opens these to
edit entries, so a `/work/...` path failed with FileNotFoundError.
- typed-value: `custom` directive args now marshal to the JSON-RPC
`{type, value}` shape (amount un-nested), which Fava's `RLCustomValue` reads;
the inverse `_unmarshal` handles them for the clamp/filter round-trip. The
generic record marshalling emitted `{value_type, value: {type: ...}}`, which
broke budgets / fava-options / extension parsing.
- _default_for: supply type-appropriate defaults ("" / 0 / False) for WIT
fields `directives_to_json` omits (e.g. the meta hash), matching the
JSON-RPC engine's serde defaults instead of passing None (which wasmtime
rejects).
These are correctness fixes for the opt-in component backend, independent of
making it the default (tracked separately). Adds regression tests for each.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
3 of 10 tasks
This was referenced Jun 17, 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.
Three correctness fixes for the opt-in component backend, found by running Fava's full test suite through it for the first time (
RUSTFAVA_RUSTLEDGER_BACKEND=component). They are independent of making the component the default (tracked separately) — each is a real bug in the component path today.Fixes
load_fullleaks WASI guest paths. The component sees files under the/workpre-open mount, so returned directives carriedmeta.filename = "/work/<file>.beancount". Fava opens that path to edit entries →FileNotFoundError. Now mapped back to real host paths (filenames + includes).customtyped values used the wrong shape. The generic marshaller emitted{value_type, value: {type: ...}}, but rustledger'sTypedValueserializes as{type, value}(amount un-nested as{number, currency}) — which Fava'sRLCustomValue.from_rawreads. This broke budget / fava-option / extension parsing. Fixed in both directions (_marshal+ the_unmarshalinverse for the clamp/filter round-trip).Omitted required fields became
None.directives_to_jsonomits fields the loader fills (e.g. the meta hash); the JSON-RPC engine relies on serde defaults._default_fornow supplies type-appropriate zeros (""/0/False) instead ofNone(which wasmtime rejects).Impact
Running the full suite through the component went from 114 failures → 21 (and 164 fixture-setup cascade errors → 0) with these three fixes plus the already-merged cost-number
kindfix (#170).Tests
Regression tests for each:
load_fullreturns host paths; custom typed values use the JSON-RPC shape; custom directives survive the clamp round-trip. ruff + mypy clean; component unit tests green.🤖 Generated with Claude Code