Skip to content

feat(native): resolve model configuration natively behind the preview engine - #1009

Merged
kvlonge merged 3 commits into
mainfrom
feat/native-model-config
Oct 7, 2026
Merged

kvlonge merged 3 commits into
mainfrom
feat/native-model-config

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Why

Header columns, audits and ${...} templates are parsed in Python for every model. This moves that work native behind the opt-in native-preview engine, byte-identical to Python or deferring to it.

Changes

  • New sqlbuild-model-config crate: MODEL header columns and model audits, ${...} template expansion (if, eq, ne, coalesce, ENV:, CTX:, variables) with its environment and context reads, and template and macro presence scans. Anything else defers to Python.
  • The model loop parses all header metadata in one native batch and expands config templates natively when the new model_config stage is enabled. It is registered at the preview tier, so the shipped native default is unchanged.
  • Errors stay in Python: a native rejection re-runs the Python path, which raises its exact error; if Python succeeds instead, a mismatch error names SQLBUILD_COMPILER_ENGINE=python.
  • Compiler differential: seeds generate templated targets and audited, typed header columns; render coverage requires three new kinds; the failure corpus adds seven model config errors. Generated seeds shift, so both shared-analysis seed tests move to seed 34 and now assert a clean compile and real reuse.
  • Layering, path defaults, enum contract columns and validators stay in Python until the Python render stage is removed.

Verification

  • Seeded parity: 80k generated headers and 240k template values over every resolver flag set, 0 mismatches.
  • Engine-tier integration tests (python, native, native-preview), forced-rejection mismatch tests, and an E2E CLI compile comparing python with native-preview for success and error output.
  • make compiler-differential with captures and coverage: 151 identical, render 66/66, discovery 66/66; make compiler-differential-shipped: 145 identical; dense 3k and a large private project identical.
  • cargo test, clippy and fmt (1.98.0), make check-ci, make test (11495 passed), tests/e2e/scripts/compiler_differential.

Parses MODEL header columns and audits, expands ${...} config templates and scans config for templates and macro calls with the Python compiler's exact rules, deferring to Python wherever it cannot reproduce them.
… engine

The model loop parses every model's header columns and audits in one native batch and expands config templates natively under native-preview. Python keeps every error: a native rejection re-runs Python, and a mismatch is raised if Python then succeeds.
Seeds now generate templated targets and model headers with typed, audited columns, render coverage requires them, and the failure corpus adds model config errors.
@kvlonge
kvlonge enabled auto-merge (squash) October 7, 2026 17:03
@kvlonge
kvlonge merged commit e166844 into main Oct 7, 2026
67 of 70 checks passed
@kvlonge
kvlonge deleted the feat/native-model-config branch October 7, 2026 17:59
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