Repository navigation
feat(native): discover models natively behind the compiler engine switch - #995
Merged
Merged
Conversation
…ngine switch Add the sqlbuild-discovery crate with a parallel directory walk that keeps Python's glob and sort semantics, and native reading and parsing of SQL model files with Python's exact discovery messages, locations and ordering. With SQLBUILD_COMPILER_ENGINE=native the discovery stage takes its model files from the native walk; every other collection still runs in Python. Native discovery skips the Python discovery fact cache.
…ctly Run the Python path when the running Python's Unicode database differs from the native character table or the project root is not UTF-8, and share the native models walk with the pass's directory snapshot.
kvlonge
enabled auto-merge (squash)
October 7, 2026 05:04
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
Milestone M2 moves project discovery to Rust behind the compiler engine switch. This first increment makes the directory walk and SQL model files native, the largest discovery cost, while keeping output byte-identical to the Python engine. The default engine stays
python.Changes
sqlbuild-discoverycrate (betweensqlbuild-configandsqlbuild-analysis): a parallel directory snapshot with Python's glob, symlink and part-by-part sort semantics,read_text-compatible reading (strict UTF-8, universal newlines, BOM kept), and native model files: header match and parse, header and output column locations, query, and D002 failures with Python's messages, lines anddifflibsuggestions.sqlbuild-core: Python-compatibleisalnum/\w/isspace/stripfrom a table generated byscripts/generate_python_char_table.py(Unicode 15.0, the CI Python), and adifflib.get_close_matchesport.compile_frontieraccepts anative_stage. WithSQLBUILD_COMPILER_ENGINE=native, discovery takes model files from Rust and every other collection still runs in Python. The native walk seeds the pass's directory snapshot, so later globs see the same tree.Verification
make compiler-differentialwith native on Python 3.12: 106 projects identical; dense 3k (with and without custom rules) identical.isalnumand close-match oracles.cargo test --workspace --all-features, clippy/fmt 1.98.0,make check-native-layering,make check-ci,make test.