Skip to content

refactor: read planner inputs natively and build the plan output once - #1119

Merged
kvlonge merged 7 commits into
mainfrom
feat/chi599-batch-3
Oct 16, 2026
Merged

kvlonge merged 7 commits into
mainfrom
feat/chi599-batch-3

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Why

The planner still read compiled models, fixture metadata and plan context through Python attributes and module lookups, and rebuilt the plan output several times per plan.

Changes

  • Planner readers use typed native accessors for compiled models' lineage, analysis, names (stored natively), keys, destinations and SQL.
  • Per-model plan checks, SQL resolution and all plan phases are called directly, passing SQL between steps as Rust strings.
  • The fixture planning context is native: relation columns, authoritative names and expected types are Rust data, and per-model lineage and type projections are derived once per context.
  • The plan output is built once from gathered storage policies, warnings and metadata.
  • Case-variant duplicate fixture columns keep the last declared type, as before.

Verification

  • make test and make check-ci passed with all optional dependencies available.
  • Compiler differential: 371 projects, unchanged goldens. Planner differential: 11 projects matched the main baseline.
  • Compile outputs and exit codes match the reference on synthetic and private compile-only projects.
  • Windows cross-check of the whole workspace passed.
  • Independent review: one medium finding (duplicate column type precedence) fixed with a regression test.

…y in planner readers

Fixture metadata, fixture reads, expected fixture types, schema findings
and migration column readers use the typed analysis accessors instead of
building Python projections: inferred rows, star flags, lineage facts with
transform and confidence values, and proven dynamic-pivot inputs. Lane B's
accessors are merged in; lineage facts and proven inputs are added.
…gh typed accessors

Native compiled models keep their name in the compiled record instead of
deriving it from the model file's path on every read. Planner, migration,
scenario, SQL-test and janitor readers take a model's name, key,
destination and query SQL through the typed model reads, which answer
native views directly and fall back to attributes for hand-built records.
…lan context once

Per-model planning validates cursor inputs and capped watermark inputs,
resolves the materialization, describes and checks full rebuilds and
builds cursor input relations through direct native calls instead of
looking each one up on the native module. The model plan context's fields
are read once per plan instead of once or more per model.
…ect native calls

Reference resolution passes the SQL between the source, ref, dbt ref, UDF
and table-function resolvers as Rust strings and reads the plan context's
relations once per resolution. Cursor bounds, cursor input roles, cursor
intrinsics, the unresolved-marker check, schema actions, model warnings
and the cursor type check are called directly instead of through the
native module, and function SQL resolution no longer builds a plan
context record to read it back.
The execution plan calls scope resolution, cursor override typing, change
detection, warehouse state, identities, buildability, model actions,
source freshness, pruning, reconciliation, entry building and plan output
assembly directly, and warehouse state calls model, column and old-name
migration planning and the relations context directly, instead of looking
each phase up on the native module. The SQL-test planning exit test now
fails the plan with a missing source table instead of replacing a phase.
…ld the plan output once

The fixture planning context is a native class holding relation columns,
authoritative names and expected types as Rust maps, with each model's
lineage reads and type projections derived once per context instead of
once per SQL test. Fixture completion, selection, empty-fixture rendering,
typed-null completion and expected-output checks read it directly, and the
completion's expected types are the chain's propagated types over the
context's instead of a ChainMap. The Python FixtureColumnMetadata and
FixtureRelationMetadata records and the per-step fixture pyfunctions are
gone; SQL-test planning and scenario fixtures call the context, chain
resolution, test planning and completion directly. A native counter
reports context builds and chain resolutions for tests.

The plan output is built once: base fields, storage policies, warnings
and direct-mode metadata are gathered as fields and the PlanOutput is
constructed at the end instead of being rebuilt by each phase.
@kvlonge
kvlonge enabled auto-merge (squash) October 16, 2026 13:15
@kvlonge
kvlonge merged commit 1de59d8 into main Oct 16, 2026
40 checks passed
@kvlonge
kvlonge deleted the feat/chi599-batch-3 branch October 16, 2026 13:56
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