Repository navigation
refactor: consolidate parser write internals (#380 part 3a) - #390
Merged
Merged
Conversation
This was referenced Sep 24, 2026
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.
Part 3a of #380: consolidates duplicated internals of
crates/jet3/src. There is no behavior change and no public API change. Onlycrates/jet3/src/**is touched; docs, oracle, CLI and testkit are unchanged.What was consolidated
write/driver.rs).insert_row,delete_row,update_rowandupdate_fieldeach repeated the same sequence: open, check sort order, load the writable table, apply the column rule policy, prepare cascades, plan, publish.driver::applyruns that sequence once and dispatches onrelationship::mutation::Change. Each public function (and its*_with_hooktest entry) is now a two-line wrapper with the same signature.cascade::preparereturnsNonefor inserts before doing any work, so the order of checks and budget charges is unchanged.driver::row_layoutreplaces three copies of the layout-and-contiguity loop.insert_page::minimum_rowreplaces four copies of the all-null row encoding.row/data_page.rs).insert_page,update_pageanddelete_pageeach had their own directory validation, slot classification, free-space check and directory rewriting, plus a wrapper trio for every operation (append/append_physical/append_inner, and the same for replace and remove). There were also separateincrement_count/check_count/decrement_counthelpers.DataPageEditor::open(page, owner, source, budget)owns the shared primitives:live_rows, the packed free-space check,write_slotandwrite_free. The operations are short methods,append/replace/remove, that take aphysicalargument.check_table_rowsandcount_table_rowreplace the three count helpers.catalog/system_rows.rs).ObjectRow,AceRowandRelationshipRowexpose their values as named columns in stored order. Database creation encodes them against its fixed layouts. Schema edits insert them by column name.AceRow::table_grantsandAceRow::relationship_grants.CatalogSeed/AceSeedtypes and the duplicatedMSysRelationshipslayout are gone.properties::values::StoredPropertiesclassifies anLvPropvalue (null, inline or external) for both the stored-properties reader and the schema-edit loader. I also added crate-privateraw_bytes()methods onInlineLongValueandLongValueChunkValue, replacing 7 identical match arms inproperties,schema,create/apiandvalidate.global_locator()replaces the global-map locator that was hard-coded in six places.mutation_map::owned_pagereplaces the page tag, marker and owner check that was repeated in the index load, the released-page search and the long-value load.format::resource::growis now the single growth routine. Bothreservehelpers call it: the resource one charges 1 work unit per existing item, the page-edits one chargessize_of::<T>(). Each keeps its own error mapping.Deliberately left for part 3b
buffer()checks the decoded-value limit, whilereserve()is page-edit growth. Merging them further would change errors.RowDirectoryvsDataPageDirectory. These are different layers.DataPageDirectoryis the format decoder, which catalog pages also use with their own errors.RowDirectoryadds the owner, slot-width and overflow-pointer checks and the locators, and maps failures to the publicRowDirectoryError. Merging them would push table-row semantics intoformat/.MapPatchesvsPendingMap. These are two stages, not two ways to do one thing.MapPatcheschecks the membership of one page across the global, owned and available maps. It then stages intoPageEdits'PendingMapthroughmap_bit.pushhelpers. Their semantics differ:catalog_pagesreserves exactly one slot without doubling or work units,mutationpushes only when a value is present,storageremoves duplicates, and the index and blob helpers are domain methods. The only plain reserve-plus-push is inrelationship_graph_plan.validate/.create/api.rsandgraph_schema_check.rscompare the written image against the request (catalog rows, columns, indexes and initial rows) and returnImageCheckError::Mismatchdetails.validate/checks structural consistency without the request. These are different checks with different errors, so routing one through the other would change behavior.Verification
scripts/golden-check.sh 430a6cb(same tree as the rewordedfda34e7) ran after every step. Every run reported 1923 files: 1923 identical, 0 differ, 0 only-base, 0 only-head.cargo test -p jet3: 823 passed + 6 ignored (lib), 17 integration, 2 doc. The counts are unchanged; tests that called the removed page helpers now callDataPageEditordirectly.cargo check -p jet3 --all-targets --target x86_64-pc-windows-gnu: clean.just ready: passes.crates/jet3/src(excluding*_tests.rs,tests.rsandtestkit.rs): 41,914 → 41,849.🤖 Generated with Claude Code