fix(component): unwrap query-value cells to the JSON-RPC shape#178
Merged
Conversation
The generic marshaller renders BQL query cells as `{"type": <case>, ...}`,
but `RLCursor` / the API serializer expect rustledger's `value_to_json`
shape (text/bool/int as bare scalars, `number` as `{number}`, `amount` as
`{number, currency}`, `inventory` as `{positions: [...]}`, object/set via the
`json` escape hatch). The tagged form left account cells as dicts and
inventory cells empty.
Add `_unwrap_query_value` mirroring `value_to_json` and apply it to the rows
of `query`, `query_entries`, and `session.query`. Running the full suite via
the component drops the query snapshot failures (17 -> 12); the remainder are
narrow position-dict key-order / options-default / lineno divergences tracked
in #173.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Follow-up to #176 (part of #173). The generic marshaller renders BQL query cells as
{"type": <case>, ...}, butRLCursor/ the API serializer expect rustledger'svalue_to_jsonshape. So account cells came through as{"type":"text","value":...}dicts and inventory cells were empty{}.Fix
_unwrap_query_valuemirrors rustledger'svalue_to_json:{number}; amount →{number, currency}{positions: [...]}; position/interval/metadata → fields un-taggedApplied to the rows of
query,query_entries, andsession.query.Impact
Full suite via the component (
RUSTFAVA_RUSTLEDGER_BACKEND=component) drops query snapshot failures 17 → 12. The remaining 12 are narrow, root-caused divergences (position-dict key-order, a coupleledger-optionsdefaults, errorlineno0-vs-None, one tree inventory bug) — tracked in #173. Default JSON-RPC path unaffected.test_queryupdated to assert the unwrapped shape; ruff + mypy clean.