Repository navigation
fix(query): PRINT falls back to spanned_directives (was empty in CLI) - #1508
Merged
Merged
Conversation
execute_print iterated self.directives, which is empty when the executor is built via new_with_sources (the CLI path since #1506) — so PRINT returned 0 rows. Add the same spanned_directives fallback the system-table builders use. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a CLI regression where rledger query PRINT (and PRINT FROM …) returned zero rows because the CLI now constructs the query executor via Executor::new_with_sources, leaving self.directives empty and storing data in spanned_directives.
Changes:
- Update
execute_printto iterate whichever directive source is populated (directivesvsspanned_directives). - Add a CLI end-to-end integration test covering
PRINToutput so the regression can’t recur.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
crates/rustledger-query/src/executor/execution.rs |
Make PRINT use the same spanned_directives fallback behavior as other executor paths. |
crates/rustledger/tests/integration_test.rs |
Add an e2e regression test verifying rledger query PRINT emits directives. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
📊 Benchmark Results
vs main branch (2026-06-21)
What do these numbers mean?
|
Contributor
|
| Metric | Result |
|---|---|
| Check Compatibility | 100% |
| BQL Compatibility | 85% |
| Full AST Match | 100% |
| Total Files | 792 |
What's tested
- Check: Exit codes and error counts match
bean-check - BQL: Query results match
bean-query - Files: ~800 test files downloaded from 10+ beancount repositories
Full results available in workflow artifacts
Addresses Copilot on #1508 — avoids cross-run collisions on a fixed temp path; NamedTempFile auto-removes (drops the explicit cleanup). 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
PRINT(andPRINT FROM …) returned 0 rows fromrledger query— it emitted only adirectiveheader. bean-query prints all directives.Root cause (regression from #1506)
execute_printiteratesself.directives, but the CLI builds the executor viaExecutor::new_with_sources(added in #1506 for thefilename/linenocolumns), which stores directives inspanned_directivesand leavesself.directivesempty. The system-table builders and other shorthands already fall back tospanned_directives;execute_printwas the one path that didn't, so it saw an empty slice.How
Add the same
spanned_directivesfallback the sibling methods use, soexecute_printiterates whichever source is populated.Tests
test_query_print_outputs_directives(CLI e2e):PRINTemits the directives (was empty). Fullrustledger-querysuite passes; clippy + fmt clean.🤖 Generated with Claude Code