Repository navigation
Move a page's data bindings and data writes into records.page_data - #7207
Merged
Merged
Conversation
`source/data.py` held the publication file and its readers, and also `leaf data set` and `leaf data clear`, which write under the page transaction in `records`. `source/data_contracts.py` held one document's bindings and contracts, and also the bindings across a page's history, which read each message's markup as it now reads through `log.thread_context`. Both pointed up from `source`, and `.config/importlinter.ini` allowed the two imports by name. The new `records/page_data.py` takes the writes (`cmd_data_set`, `cmd_data_clear` and `_write_source`) and the history (`page_data_document_readings`, `initial_data_document_readings`, `working_data_bindings` and `page_data_binding_inventory`). It sits beside the transaction and above the log. `data.py` keeps the publication file and its readers, and `data_contracts.py` keeps one document's bindings, contracts, inventory and lag. `_authored_readings` stays there for `data_binding_errors` and becomes `authored_readings`, which `working_data_bindings` now imports. The allowances go from 13 to 11. Every caller moves: `commands/cli.py`, `commands/agent_state.py`, `records/authored_checks/source.py`, `records/sample_content.py`, `dev/leaf_dev/commands/bench.py` and `dev/leaf_dev/page_fixtures.py`. A regex rewrote the tests' 325 calls of `data_model.cmd_data_set` and `cmd_data_clear` across 47 files to `page_data_model`, imported as `from leaf.records import page_data as page_data_model`. It also sent the tests' reach-throughs to each name's own module: `data_model.DataError` to `data_contracts_model`, and `data_contracts_model.read_revision` to `revision_artifact`. No behaviour changes.
leaf-agent
approved these changes
Nov 26, 2026
Collaborator
|
|
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.
source/data.pyandsource/data_contracts.pyeach held a second concern that needs code abovesource. Theleaf data setandleaf data clearwrites take the page transaction inrecords. The bindings read across a page's history read each message's markup as it now reads, throughlog.thread_context. This PR moves both into a newrecords/page_data.py, beside the transaction and above the log.data.pykeeps the publication file and its readers, anddata_contracts.pykeeps one document's bindings, contracts, inventory and lag._authored_readingsstays indata_contracts.pyfordata_binding_errors, and becomes public so thatworking_data_bindingscan import it. No behaviour changes.mainhas two import-linter allowances fewer.Every caller moves in the same change. A regex rewrote the tests' 325 calls of
data_model.cmd_data_setandcmd_data_clear, across 47 files, topage_data_model. The tests also reachedDataErrorthroughdataandread_revisionthroughdata_contracts, which re-imported them, so those now go to each name's own module. For review, weigh the two module headers:page_data.py's says what it holds and why it sits inrecords, anddata_contracts.py's now describes one document.