Repository navigation
refactor: move discovery, compile inputs, assembly and the compile pipeline into the native driver - #1094
Merged
Conversation
Build the static DAG JSON in sqlbuild-analysis from plain inputs the binding reads off the compiled project views and the discovered Python node graph, reproducing dataclasses.asdict, the None and empty-field pruning and json.dumps(indent=2) byte for byte. The compile driver and sqb dag call it directly; the Python artifact builder is removed.
Parse the dedented function source with the ruff parser under CPython's tree shape and ast.walk order, and delete the Python ast scan. Python keeps inspect.getsourcelines and textwrap.dedent.
Resource diagnostics find the @udf decorator's line and UTF-8 byte column in Rust instead of calling back into a Python ast locator, which is deleted.
sqb rename and sqb mv read project Python string constants with the ruff parser in CPython's ast.walk order and positions, and match them with Python re IGNORECASE semantics in Rust. The Python ast and regex scan is deleted; Python keeps reading the files.
The dbt-style manifest is built in Rust and returned as a NativeManifest whose contents() are the exact bytes json.dumps(manifest, indent=2) + "\n" produced; encoding errors still raise from the writer. Python passes only hook identities, the plan output and the generation timestamp. The Python manifest builders are removed.
Native discovery builds the Python discovery model objects directly, and the compile driver calls the native discoverers. The Python payload conversion layer (discovery/_helpers/native), the pure file-walk wrappers in filesystem/core.py, the YAML path and scenario helpers, and the payload-returning bindings are removed. Discoverers that import or run user code stay in Python.
…rence resolution The planner's reference resolution scans with a native SqlCodeScanner at Python string offsets, mirroring the generic and dialect rules of the deleted Python sql_analysis scanning helpers and their main wrappers.
Schema validation without a shared catalog now returns diagnostic rows from one native call that validates, maps and positions them, replacing the Python JSON response parsing and the validate_sql_with_schemas_json binding.
resolve_binding_column and is_polyglot_available have no callers.
The planner's attached-audit gate edges and hook-read edges come from the native explicit-reference graph logic, which now keeps each edge's audit and target as Python did. The Python fixed-point and hook-edge implementations are deleted; Python only collects the project facts.
build_native_project_graph only returned project.lineage_graph; its callers now read the attribute.
kvlonge
enabled auto-merge (squash)
October 13, 2026 00:33
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
Phase 1 of the Rust-hosted migration (CHI-589): Rust owns the compile sequence and the static compiler logic; Python stays only for user code, adapters and the executor. This milestone moves the remaining compile orchestration into the native driver and ports several compiler packages, deleting the Python they replace.
Changes
handled_native_errorsentries for existing try/except blocks that now wrap native entry points; no Python fallback runs in any of them.Verification
sqb compileoutput identical tomainon a generated 1k-model project and a private project, cold and one-model edit.make test(one timing-flaky launcher comparison fixed to ignore phase durations),make check-ci, hygiene scan, independent review with no findings.