Skip to content

refactor(native): read planner models and project collections through native views - #1200

Merged
kvlonge merged 7 commits into
mainfrom
refactor/planner-native-records
Oct 22, 2026
Merged

kvlonge merged 7 commits into
mainfrom
refactor/planner-native-records

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Why

Before the planner can move into a plain-Rust crate, its reads of compiled models and of the project's resource collections must go through one native path, not attribute reads. That path also needs a check that native compiles never leave it. This changes no behaviour or output.

Changes

  • model_reads::native_model returns the native view behind a model object. Any other object, such as a Python-built record, is read by attribute as before and counted in a new compiled_view_fallbacks stage counter. Every model read helper goes through it.
  • New model helpers (schema entry, config, references, deps, dependency rows, relative path, inferred and enum columns) and a project_reads module for the project's models, sources, seeds, functions, audits and SQL tests, all with the same counted fallback.
  • 55 planner model-attribute reads and 84 project-iteration reads now use these helpers. The sites were found by tracing sqb plan and the planner differential, plus a static sweep. Reads that serve every resource kind keep the shared attribute dispatch.
  • Tests show native compile and plan never fall back, and that Python-built models are still read and counted.

Verification

  • make check-ci, clippy -D warnings, fensu with 0 faults; budgets unchanged.
  • Compiler differential 373/373 and planner differential 11/11 after every group; focused planner, cursor, strategy, warehouse, scenario, clone, seed, audit and test suites.
  • Dense compile, config build, import and sqb plan warm and cold are at instruction-count parity with the previous head, and plan output is byte-identical.
  • sqlbuild-python builds do 0.15–0.19% more work (instruction counts); the crate graph is unchanged.

@kvlonge
kvlonge enabled auto-merge (squash) October 21, 2026 14:42
@kvlonge
kvlonge force-pushed the refactor/planner-native-records branch from 8c18aec to 5098b3c Compare October 21, 2026 22:16
…essor

`model_reads::native_model` returns the native view behind a model
object and counts every other object, a Python-built record that is
read by attribute instead, in the `compiled_view_fallbacks` stage
counter. Every model read helper goes through it. An integration test
shows compile and plan of a native project never fall back, and a unit
test shows Python-built models are still read, and counted.
…views

Planner resolution, strategy, scope and change detection read a
model's schema entry, config, references, inferred columns, relative
path, name and dependency rows, and iterate the project's models,
sources, seeds, functions and audits, through the native view helpers
instead of attribute reads. Reads that serve every resource kind keep
the shared attribute dispatch.
…views

Planner warehouse and migration code read a model's name, destination,
key, schema entry, config, references and dependency keys, and iterate
the project's models, seeds, functions and sources, through the native
view helpers. Reads that serve every resource kind keep the shared
attribute dispatch.
…ns natively

Plan entries, phases, identity metadata, scenarios, selectors and the
audit, seed, test, display and clone command plans read a model's
name, destination, key, schema entry, config, references and enum
columns, and iterate the project's models, sources, seeds, functions,
audits and SQL tests, through the native view helpers. A named
collection lookup serves the callers that pick the collection by name.
@kvlonge
kvlonge force-pushed the refactor/planner-native-records branch from 5098b3c to 713ace3 Compare October 22, 2026 03:05
@kvlonge
kvlonge merged commit ec968d0 into main Oct 22, 2026
44 checks passed
@kvlonge
kvlonge deleted the refactor/planner-native-records branch October 22, 2026 07:29
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