Skip to content

refactor: hold planner contexts natively and call native helpers directly - #1121

Merged
kvlonge merged 4 commits into
mainfrom
feat/chi599-batch-5
Oct 16, 2026
Merged

kvlonge merged 4 commits into
mainfrom
feat/chi599-batch-5

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Why

The planner and the freshness, janitor, check and diff commands still held their contexts as generic Python records and reached native helpers through module lookups and keyword dictionaries.

Changes

  • Planner scope, identity, relation, model and entry contexts are native classes with typed fields.
  • Model migrations are planned over Rust request and result structs with direct calls; unused bindings and records are removed.
  • Planner code calls native helpers directly instead of looking them up on the native module.
  • Freshness, janitor, check, diff and deferred-target code call discovery, graph, selection, connection, target, progress, state and output helpers directly.

Verification

  • make test and make check-ci passed with all optional dependencies available.
  • E2E tests for freshness, janitor, check, diff, plan, test, model migrations and the native analysis seams passed.
  • Compiler differential: 371 projects, unchanged goldens. Planner differential: 11 projects matched.
  • Compile outputs and exit codes match the reference on synthetic and private compile-only projects.
  • Windows cross-check passed. Independent review found no blocking issues.

…ontexts in Rust

PlannerScopeResolution, PlannerIdentityContext, PlannerRelationsContext,
ModelPlanContext and PlanEntryBuildInputs are frozen native classes with
typed fields instead of generic native records. Plan entry construction,
SQL resolution and cursor bound computation read their fields directly.
Constructors take the same keywords; the classes no longer support
dataclasses.replace.
Model migration requests, declarations, discovery results and
compatibility results are Rust structs. Discovery, fingerprint matching,
origin resolution, compatibility checks, decisions, execution choices,
redirected cursor inspection and the live-state inspection are called
directly instead of through the native module. Removes the
corresponding native records and pyfunctions, none of which had a
Python caller.
Planner resolution, entry, migration, scenario, warehouse, audit and
command-plan code calls the native helpers it needs as Rust functions
instead of looking them up on the native module and calling them with
keyword dictionaries. Keyword-only helpers receive their arguments
directly; signature helpers receive typed values. SQL code scanning in
reference resolution uses the scanner directly, and the migration
fingerprint cache default is constructed natively.

Calls that tests deliberately replace on the native module stay module
lookups: SQL test planning, migration fingerprint computation, table
type planning, and the compile pipeline's execution plan and Python run
outputs. The stale-identity unit test now supplies the project fields
change detection reads instead of replacing it.
…r, check and diff

The freshness, janitor, check, diff and deferred-target code calls the
native discovery, graph, selection, connection, target, progress, state
and output helpers it uses as Rust functions instead of looking them up
on the native module. SQL test chain resolution is called directly; SQL
test planning stays a module lookup because tests observe it there.
Native classes the commands construct (progress reporters, the event
writer, the cost context and freshness errors) are still created through
the module.
@kvlonge
kvlonge enabled auto-merge (squash) October 16, 2026 17:55
@kvlonge
kvlonge merged commit ecc31b7 into main Oct 16, 2026
40 checks passed
@kvlonge
kvlonge deleted the feat/chi599-batch-5 branch October 16, 2026 18:35
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