Repository navigation
fix(validate): report held account errors only for refused transactions; forecast copies keep the template's location - #2706
Merged
Conversation
…ns; forecast copies keep the template's location The native forecast plugin cleared the file and line of every copy of a `#` template, so errors on a copy printed as `<unknown>:`. Beancount's forecast keeps the template's meta; the copies now keep its location (#2687). The early phase's held posting-account errors were reported at finalize for every transaction late never saw: those booking refused (deliberate) but also those a plugin deleted or replaced. Booking now hands the validator the refused transactions (`note_refused_by_booking`, called by the loader and the LSP), and finalize reports only theirs (#2686). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
Contributor
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Member
Author
|
Deep-review rounds (lane V6)
Converged after round 2. Follow-up: |
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 changed
#2687,
forecastcopies keep the template's location. The nativeforecastplugin setfilename/linenotoNoneon every copy of a#template, so an error on a copy printed as<unknown>:. Beancount 2.3.6'sforecastmakes each copy withentry._replace(date=...), which keeps the template's meta. The copies now keep its location as well.I checked every other native plugin that creates directives against its beancount (or
beancount_reds_plugins) source:implicit_prices,check_drained(at the close),effective_date,generate_base_ccy_prices,box_accrual,capital_gains_classifier,valuation,currency_accounts.<plugin>name, as their reference does: theauto_accounts,zerosum,effective_date,long_shortandsplit_expensesopens.check_closinguses<check_closing>:0.close_treeuses<beancount.plugins.close_tree>:0.#2686, held account errors are reported only for transactions booking refused.
finalizeused to report the early phase's held errors for every transaction the late phase never saw. Now booking hands the validator the transactions it refused, through the newValidationSession::<EarlyDone>::note_refused_by_booking, andfinalizereports held errors only for those.FailedBookingsintolate_validate. The LSP records itsfailedset the same way.rledger checkmatchesbean-check2.3.6 on the issue's ledger: two E1001s, both at the template's line.No CACHE_VERSION bump: the cache holds parse output, and both changes happen after parsing.
How tested
bean-check(beancount 2.3.6, via uv) on the issue's ledger givesfc.beancount:3: Invalid reference to unknown account 'Expenses:Rent'twice. The new loader test pins the same result: 2 E1001s, at line 3.forecast::tests::test_forecast_copies_keep_the_template_locationloader_test::test_forecast_copies_report_at_the_templatevalidate::tests::held_errors_are_reported_only_for_transactions_booking_refused: deleted means no E1001, refused means one at the transaction, seen-by-late means one.lsp::diagnostics::tests::a_refused_transaction_keeps_its_account_errorpython_plugin_wasi::a_transaction_a_plugin_deletes_is_not_validated(Python-gated): a filter plugin deletes a transaction that uses an unopened account, and there is no E1001 for it, while a refused transaction keeps its E1001.test_refused_transaction_keeps_its_account_errorsalso fails if the loader stops recording refusals.-D warnings,cargo clippy --workspace --all-features --all-targets -D warningsandcargo fmtall pass. The test suites were for-p rustledger-validate -p rustledger-loader -p rustledger-plugin -p rustledger-lsp --all-features: 1321 passed.Closes #2687
Closes #2686
🤖 Generated with Claude Code
https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr