Repository navigation
refactor(query): route all directive walks through resolved_directives - #1535
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs main branch (2026-06-22)
What do these numbers mean?
|
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors rustledger-query’s Executor to ensure all directive iteration paths consistently use Executor::resolved_directives(), preventing regressions under new_with_sources where directives is intentionally empty and data lives in spanned_directives.
Changes:
- Updated
resolved_directives()to return an iterator of&'a Directive, enabling callers tocollect()references without tying them to the&selfborrow. - Routed remaining directive-walking sites (system-table builders, transaction collectors, and
#entrieswalk) throughresolved_directives()to eliminate duplicated fallback logic. - Added a regression test intended to guard system-table/directive-walk behavior under
new_with_sources.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
The executor had ~10 copy-pasted spanned/unspanned dispatch blocks — the pattern that caused the JOURNAL regression (a walk forgetting the spanned_directives fallback returns empty under new_with_sources). #1531 fixed 3; collapse the rest (5 system-table builders, #accounts, 2 transaction collectors, #entries) onto resolved_directives, which now yields &\x27a Directive so callers can collect. Add a source-mapped system-table test. Architecture-roadmap item [M/BR5]. Co-Authored-By: Claude Opus 4.8 <[email protected]>
robcohen
force-pushed
the
refactor/executor-source-selection
branch
from
June 23, 2026 02:37
cc36625 to
307be8d
Compare
Copilot on #1535: BALANCES is a statement on a different path; query #entries (a system-table builder collapsed onto resolved_directives in this PR) so the test actually guards the refactored builders under new_with_sources. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
What
Architecture-roadmap item [M/BR5]. The executor walked directives via ~10 copy-pasted
if let Some(spanned) = self.spanned_directives { … } else { self.directives … }blocks — the exact pattern that produced the JOURNAL regression (#1531): a directive-walking site forgetting thespanned_directivesfallback returns empty undernew_with_sources(CLI/LSP). #1531 fixed JOURNAL/SELECT/PRINT with theresolved_directives()accessor; this PR collapses the remaining copies onto it.How
Routed the 9 remaining sites through
Executor::resolved_directives():#balances,#commodities,#events,#notes,#documents)#accountsbuilder, the two transaction collectors, and the#entriesrow walkThe
#entrieswalk previously passedget_source_location(idx)on the spanned branch andNoneon the unspanned branch —get_source_locationalready returnsNonewhen there's no source map, so the single loop is behavior-identical.resolved_directives()now returnsimpl Iterator<Item = &'a Directive>(the directive slices are themselves&'aandCopy, so the iterator carries the data lifetime and can becollect()ed intoVec<&'a …>, not just iterated).Tests
Behavior-preserving — the full
rustledger-querysuite passes unchanged. Addedtest_system_table_via_source_mapped_executor: runsBALANCESover anew_with_sourcesexecutor and asserts it isn't empty, directly guarding the collapsed builders against the JOURNAL bug class.Verification: query suite green;
clippy --all-features --all-targets -D warnings+ fmt clean.🤖 Generated with Claude Code