Repository navigation
perf(rules): reuse compile front-end work in lint and SQL rules - #884
Merged
Merged
Conversation
…racter loops Compute each file's project-relative role once instead of repeating pathlib containment checks per body, skip resolving paths when no dynamic-output proofs exist, and jump between header delimiters with a compiled pattern. Header spans, body ranges and findings are unchanged.
The background SQL lint still loads its own macro instances, but when their indexed metadata matches the compiler's it reuses the already validated scope index and relationship grants instead of rebuilding them. Any metadata difference falls back to a full private build.
When the early lint matches the selected SQL rules and project directory, the SQL rule pass reuses its full-project file read for rule identities and dynamic-output proofs instead of walking and re-reading every SQL file on the main thread.
…fore evaluation Native evaluation checked whether the rules cache existed only after building its payloads, while the concurrent SQL rule pass could already have created that directory. When that happened the request omitted the custom host, failed, and was repeated with it. The cache state is now captured before either phase starts.
Pin exact header spans for escaped and unterminated quotes, prove that a rebound declaration scope matches a fresh build while keeping private macro instances, check that cold compiles build the scope once and reuse the early file read, reproduce the custom-host request ordering deterministically, and compare compile-time SQL findings with a standalone rule run on CRLF and macro inputs.
kvlonge
enabled auto-merge (squash)
September 29, 2026 10:13
…nt-end-reuse # Conflicts: # tests/unit/src/sqlbuild/compiler/compile/_helpers/_test_types.py # tests/unit/src/sqlbuild/compiler/compile/_helpers/helpers.py
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
On the dense all-rules benchmark, the rules phase repeated front-end work the compile had already done: per-file path resolution and containment checks, character-by-character header scanning, rebuilding the declaration scope index, and a second walk and read of every project file. Once that work got faster, a latent race also made the native rules request start without the custom-rule host and retry in full.
Changes
resolve()when no dynamic-output proofs exist; header scanning jumps between delimiters with a compiled pattern.Verification
make test,make check-ci, dense 5k guard under 4 GiB; one independent review.