feat(component): route queries through query-entries; wire get_engine#176
Merged
Conversation
Reroutes the rustfava query path to the component's typed `query-entries` (rustledger v0.16.4, beancount#1423) and wires the engine selector so the component backend is reachable end-to-end. JSON-RPC stays the default (`RUSTFAVA_RUSTLEDGER_BACKEND=component` opts in) — no behavior change on the default path; this fixes the component path. - engine: `RUSTLEDGER_VERSION` -> v0.16.4; `component_engine.query_entries` marshals a directive set in and calls `builder.query-entries`. - query_shell: `RLConnection.execute` queries the directive set directly via `query_entries` when the engine supports it, instead of re-rendering the filtered entries to beancount source (`_entries_to_source`) and re-parsing — the latter produced text the parser rejected (the query crashes). JSON-RPC keeps the source path (no `query-entries`), so `_entries_to_source` stays until that surface is dropped. - routing: `backend.get_engine` selector (JSON-RPC default); load/query/filter/ is_encrypted now go through it so the component backend is actually used. Running the full suite via the component drops the query-crash class entirely (remaining failures are snapshot diffs + a few inventory/tree shape issues, tracked in #173). Default JSON-RPC path is unchanged. Note: routing touches loader/query/filters, which carry pre-existing ruff debt (function-level imports, long comment lines); this change adds none. 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.
Reroutes the rustfava query path to the component's typed
query-entries(rustledger v0.16.4, beancount#1423) and wires the engine selector so the component backend is reachable end-to-end. JSON-RPC stays the default (RUSTFAVA_RUSTLEDGER_BACKEND=componentopts in) — no behavior change on the default path; this fixes the component path (part of #173).What
RUSTLEDGER_VERSION→ v0.16.4;component_engine.query_entriesmarshals a directive set in and callsbuilder.query-entries.RLConnection.executequeries the directive set directly viaquery_entrieswhen the engine supports it, instead of re-rendering the filtered entries to beancount source (_entries_to_source) and re-parsing — the latter produced text the parser rejected (the query crashes). JSON-RPC keeps the source path, so_entries_to_sourcestays until that surface is dropped.backend.get_engineselector (JSON-RPC default); load/query/filter/is_encrypted now go through it so the component backend is actually exercised.Why
Fava queries filtered entry subsets. A full-ledger session can't serve that; the right primitive is the typed entry-set
query-entries(symmetric withclamp/filter), so the subset crosses the WIT contract faithfully with no source re-render. See the #173 discussion.Impact
Running the full suite via the component (
RUSTFAVA_RUSTLEDGER_BACKEND=component) eliminates the query-crash class. Remaining failures are snapshot diffs + a few inventory/tree shape issues (tracked in #173 for the next pass). The default JSON-RPC path is unchanged.Tests / checks
New
query_entriesengine test (matches sourcequery); component tests green; mypy clean. The default path is unaffected so the JSON-RPC-backed CI passes.Note: the routing touches
loader.py/query.py/filters.py, which carry pre-existing ruff debt (function-level imports, long comment lines). This change adds none (loader/query/filters violation count unchanged vs main).