Repository navigation
Compute Beancount table data on first access - #297
Closed
ryanduguid wants to merge 1 commit into
Closed
ryanduguid wants to merge 1 commit into
ryanduguid wants to merge 1 commit into
Conversation
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.
Summary
Compute the price map, account open/close map, commodity map and account types on first access, then cache each result on its table. Attaching a Beancount source and running a query over postings currently builds all four even when none is used. Closes #244.
The existing builders and query consumers use the same attributes, backed by the standard library:
Evidence
price_mapassignment are covered.query_render.pyandshell.py. Parser and render coverage gates pass at 100%; overall coverage is 91%, with all four new getter return paths covered.Merge danger
Door: two-way. Blast radius: query sources.
The first calculation uses the entries, options and decimal context present at first access. Mutating inputs before that access affects the derived value; later mutation does not invalidate the cache. Reattaching creates new tables.
On Python 3.12 and later, concurrent first access can repeat a calculation because
cached_propertydoes not serialise it. Concurrent price-map builds can use different thread decimal contexts for inverse prices; the latest run sets the cached value, following Python's cached_property contract.Unverified
Remaining CI runtime/dependency combinations, docs build, upstream CI, timing benchmarks, concurrent first access and input mutation outside the tested contracts.