Repository navigation
refactor: digest rule facts and read declared columns natively - #1122
Merged
Merged
Conversation
Recompute and digest recorded custom-rule facts from the native compiled project in Rust instead of rebuilding Python fact views and encoding them with orjson. Rule hosts digest live filesystem reads through the same native encoder, project-tree file reads are native, and the custom-rule cache runtime version is bumped so entries keyed on the old digests miss.
Read model names, project paths and materializations for custom-rule cache rows, rule selection, run summaries and the native rules request through the compiled model views directly instead of per-model attribute lookups.
Answer declared column rows, custom-rule SQL facts and semantic-check audit metadata of compiled model views from the native facts and schema records the compile already holds, instead of rebuilding schema entries and reading each column back through Python attributes.
… in schema readers Build each model's declared column facts (name, type, nullability, description, migration source, audit definitions and location) from the parsed header and the named schema while the column specs are built, instead of reading every merged and enum-resolved column back through Python attributes. Audit attachment, declared relation types and nullability, relation keys and semantic-check audit metadata read these facts and touch a column's Python spec only for its audits. Model input records keep the model name, so readers no longer derive it from the file path.
Project assembly now starts, runs and finishes the native model analysis session through Rust calls on typed request and result structs, instead of building a NativeModelAnalysisRequest record and calling analyze_native_model_sql and start_model_analysis_session through the extension module. The request and result record classes and both module functions are removed. The analysis session tests now assemble real projects with a cold, a warm and no analysis cache and compare those assemblies; their goldens are unchanged. Tests that could only reach unreachable internal invariants through the removed module seam are dropped; the duplicate-name invariant stays covered by the native session tests.
…ront Early SQL lint and SQL rules keep references to the compile's shared authored and expanded SQL texts instead of copying every model's expansion into owned strings before linting. A file's expansion is converted only when that file is linted and dropped afterwards.
…lean Model analysis converts its session request before running the session, so the per-model request rows are freed instead of living through the run. Declared column facts keep only what readers use: whether a column is described, and the location of columns declared outside the model file. Attached schemas no longer copy every column fact; the declared-relation reader asks for them on its own.
…rors and model path lookups
kvlonge
enabled auto-merge (squash)
October 16, 2026 19:19
…ever hidden by cached bytecode
…de finder after built-in importers
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.
Why
Custom-rule facts, declared columns, model analysis and early SQL lint still crossed into Python objects on every compile, and early lint copied every model's SQL.
Changes
Verification