Skip to content

refactor: drive compile from a native driver and move scopes and macro analysis to Rust - #1093

Merged
kvlonge merged 17 commits into
mainfrom
feat/native-compile-assembly
Oct 12, 2026
Merged

kvlonge merged 17 commits into
mainfrom
feat/native-compile-assembly

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Why

Phase 1 of the Rust-hosted migration (CHI-589): Rust should own the compile sequence and the static compiler logic, and Python should remain only for user code, adapters and the executor. This milestone moves compile orchestration and several analysis stages to Rust and deletes the Python they replace.

Changes

  • Native compile driver (crates/sqlbuild-python/src/bindings/_helpers/compile_driver/): runs sqb compile (analysis, manifest, DAG, artifact writing, reuse recording, output) and builds compiled projects and project graphs. The remaining Python stages are called by module path. Deletes _compile.py, the compile pipeline.py, status.py, collection.py, dag.py and the pipeline compiled_project.py, selected_graph.py and graph.py.
  • New sqlbuild-pysource crate (ruff parser) for static reading of project Python. Macro module analysis now runs there. CPython still parses each module first, so syntax errors are unchanged.
  • Declaration scopes: index building, cache rows, placement, lookup, visibility and reports now run natively.
  • Model and hook SQL syntax validation, declared relation shapes, and SQL test and scenario CTE validation now run natively.
  • AGENTS.md: native build discipline and escalation rules for implementation subagents.
  • Movable Python drops from 141,451 to 137,187 lines (python-boundary.toml).

Verification

  • Compiler differential: 371/371 projects, no golden changes.
  • sqb compile output is identical to main on a generated 1k-model project and on a private project (cold and one-model edit).
  • make test, make check-ci and the hygiene scan pass.
  • Focused CLI, compiler, scopes and compile e2e tests pass.

Move the static analysis of project macro modules (exports, project
imports, call graph, cycles and the fault-tolerant inventory) from
Python's ast to sqlbuild-pysource. CPython still parses each module
first and owns syntax errors; module loading stays in Python.
@kvlonge
kvlonge enabled auto-merge (squash) October 12, 2026 21:31
@kvlonge
kvlonge merged commit 6eff311 into main Oct 12, 2026
40 checks passed
@kvlonge
kvlonge deleted the feat/native-compile-assembly branch October 12, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant