Skip to content

refactor: host planner assembly, freshness, cost and Phase 1 remainder in Rust - #1111

Merged
kvlonge merged 33 commits into
mainfrom
feat/native-group-12
Oct 15, 2026
Merged

kvlonge merged 33 commits into
mainfrom
feat/native-group-12

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Why

Finish hosting compiler, planner and CLI implementation in Rust while preserving plan output, persisted formats, adapter overrides, diagnostics and exit codes.

Changes

  • Native planner assembly: cursor windows and bounds, model plan entries, plan output, command and clone plans, execution plan orchestration, background SQL-test planning and display plans.
  • Native source freshness observation, planning and state IO; native Snowflake run-cost allocation with exact Decimal semantics, statement ledger and cost context.
  • Native Phase 1 remainder: analysis cache context, diagnostics collector, explicit-reference owners, pipeline plan result, connections, contract writes, setting help, phase timers and CLI styling.
  • First data-model slice: dead symbols removed, CLI constants, cost health and freshness/cost errors moved to Rust.
  • Connection error hooks fire only for ordinary exceptions, as before.
  • Movable Python decreases from 21,360 to 13,066 lines.

Verification

  • 11,384 unit/integration tests passed; make check-ci passed with all optional dependencies available.
  • Compiler differential: 371 projects, unchanged goldens. Planner differential: 11 projects matched the main baseline.
  • Cold and edited compile outputs and exit codes match the reference on synthetic and private compile-only projects.
  • Worker captures: plan outputs and adapter call logs, cursor sweeps, CLI commands, freshness state rows and cost allocations matched the deleted Python.
  • Independent review: one low-severity finding fixed and verified.

Port plan-entry cursor bound helpers, per-model plan entry construction, relation context assembly and the planner resolution facades to native code, deleting the Python plan_entry module and resolve/cursor-window wrappers.
Port PlanOutput assembly, SQL test selection and planning, function entries, static audit/test/seed/relation command plans and direct seed fingerprint reads to native code, deleting the Python plan_output, command_planning and main/commands modules.
Port clone planning, deferred-clone graph traversal and SQL test model chain grouping to native code, and route the remaining planner facade modules (scenarios, selection, SQL test artifacts, fixture helpers) directly to sqlbuild._native.
Port build_execution_plan and background SQL test planning to native code, deleting the Python execution entry point and BackgroundSqlTestPlanning class.
Port the display-only plan, pre-build work text, query diff colouring, KnownInputColumns and the fixture-null autofix entry point to native code, removing the Python planner main package.
Source freshness observation, planning comparison, downstream propagation,
latest-state reads, appends and state-table SQL now run in Rust. Adapter
queries and metadata lookups stay adapter callbacks, so custom adapter
overrides keep applying. The Python package keeps only its models, types,
constants and errors.
Run-cost allocation now uses an exact Rust implementation of Python's
default decimal context, and Snowflake query-history collection, query-tag
parsing, metadata-only statement classification, the statement ledger and
the cost context run in Rust. Connection queries, clocks and the telemetry
health tracker stay Python callbacks. The cost package keeps its models,
types, constants, errors and health tracker.
…glue natively

Build the contract and YAML entry class tables, native config error
exceptions, SQL-test CTE call locations, typed macro argument references,
the compiler cache directory, YAML entry lines and project-relative paths
in the native bindings. Delete the Python wrappers they replace, the dead
path-default selection, SQL-test CTE extractor and syntax check wrappers,
and the test-only analysis normalization entry.
Move the compile diagnostic collector, the process-wide template input read
registry, the SQL-test scan cache and the UTF-8 checked environment view into
the native bindings, and delete the Python classes they replace.
… natively

Compute the analysis cache context digests and record the analysis cache
metrics in the native compile driver, and collect the task, asset, check,
loader and hook functions the explicit-reference checks read in the native
report entry. Delete the Python helpers they replace.
Move the pipeline planning orchestration, hooked connection opening and
contract adoption repository writes into the native compile driver and
contract command, calling the planner, materialization loader and Python
node selection at their existing Python boundaries. Delete the Python
modules they replace.
…ackers natively

Render setting and snippet help in sqlbuild-config, read expected-error
codes, messages and help, scope the speculative lint stop signal, and track
build phase timings and process resource deltas in the native bindings.
Delete the Python helpers they replace and the help renderers only tests
used.
…rdinator natively

Expose the core CLI style, the shared transient line coordinator and the
terminal width read from the native bindings, delete the Python presentation
classes and helpers, the dead theme models and status constants, and the
lint rule that guarded the removed terminal capability module.
@kvlonge
kvlonge enabled auto-merge (squash) October 15, 2026 06:34
@kvlonge
kvlonge merged commit 4153b83 into main Oct 15, 2026
40 checks passed
@kvlonge
kvlonge deleted the feat/native-group-12 branch October 15, 2026 08:11
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