Skip to content

feat(native): make native rendering the default compiler path - #1043

Merged
kvlonge merged 8 commits into
mainfrom
feat/native-rendering-default
Oct 8, 2026
Merged

kvlonge merged 8 commits into
mainfrom
feat/native-rendering-default

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Why

Native rendering passed its flip gate, so the default compiler engine now renders natively.

Changes

  • NATIVE_STAGE_TIERS: declaration files and scopes, model config, reference extraction, model loop, macro calls, macro-call store and attachments are shipped; analysis stages stay preview. A failing native render stage still re-runs Python for the exact error.
  • Fix: a reused stored macro call never imports what its macro imports, so compile reuse now also tracks the module files behind stored calls (editing one replayed a stale compile). A new E2E test fails without it.
  • Tests expect the shipped engine to run these stages; an E2E test proves the unset default renders natively, writes the macro-call store and matches python.
  • CI: shipped differential with stage captures and full discovery/render coverage; 3.13/3.14 also compare python with native; Windows checks the default compiles a playground like python; edit performance guard back to the shared ratio.
  • Docs: native rendering by default, SQLBUILD_COMPILER_ENGINE=python is the oracle, macro determinism applies by default.

Release note: compiles render natively by default and keep macro call results under target/cache/, so macros must be deterministic. The first compile after upgrading is cold once. SQLBUILD_COMPILER_ENGINE=python selects the Python compiler.

Residual risks: a new module shadowing a lazily imported one (pkg/sub/__init__.py over pkg/sub.py, or try: import optional_mod) is not detected, since only sys.path entries are stat'd (pre-existing for compile reuse). Editable checkouts don't invalidate the store on SQLBuild Python edits; releases are safe.

Verification

  • Tier, default-engine and stale-replay E2E tests; compile E2E directory
  • make compiler-differential (CI flags), -shipped (coverage); differential E2E
  • cargo test, clippy/fmt on 1.99.0
  • make test, make check-ci, hygiene scan

With SQLBUILD_COMPILER_ENGINE unset, compiles now run declaration files
and scopes, model config, reference extraction, the model loop, macro
calls with the macro-call store, and attachments natively. A failing
native render stage still re-runs Python for the exact error.
SQLBUILD_COMPILER_ENGINE=python remains the oracle; SQL analysis and
later stages stay in the preview tier.

Tests that assumed only native-preview ran these stages now expect the
shipped engine to run them, and an E2E test proves the unset default
renders natively, writes the macro-call store and matches Python. CI
runs the shipped differential with stage captures and full discovery
and render coverage, compares python with native on Python 3.13 and
3.14, and checks on Windows that the default compiles a playground
project to the same files as Python.
…e reuse

With the macro-call store on by default, a compile that reuses a stored
call never runs the macro, so a module the macro imports while running
is not loaded and whole-project reuse stopped tracking it. Editing that
module then replayed a stale compile. Compile reuse now also stamps the
module files the stored call results depend on.

Also: the compile docs no longer say an edited model recompiles
uncached, the one-model edit performance guard returns to the shared
ratio now that rendering is native, and the native declaration error
E2E test covers the shipped engine.
… replay stale output

A macro lazily imports an outside module, or a package module with a transitive import; a compile after an unrelated model edit reuses the stored call, then the module is edited. The next compile must not replay and must match --no-cache, on the default engine and native-preview. Fails without the module tracking fix.
@kvlonge
kvlonge enabled auto-merge (squash) October 8, 2026 20:03
…auncher

uv's Windows console-script launcher runs the entry point as __main__ from a zip appended to sqb.exe. Its location, sqb.exe\__main__.py, is not a readable file, so the store treated the process as running unknown code and was never used or saved on Windows. A __main__ loaded by zipimport is now backed by its archive, the launcher executable. Other zip-imported modules still disable the store. The Windows CI step prints the macro bridge debug log when the store is missing.
…s like preview

Until the macro bridge stops re-running failing stages, the default engine
re-runs macros the same way native-preview does.
@kvlonge
kvlonge merged commit 95491e1 into main Oct 8, 2026
39 checks passed
@kvlonge
kvlonge deleted the feat/native-rendering-default branch October 8, 2026 23:52
kvlonge added a commit that referenced this pull request Oct 9, 2026
* feat(native): analyse models natively behind the preview engine

Run the uncached model analysis as a native session: compact batches,
dataflow waves, shape publication, deferred binding validation and
expression-source shapes. Legacy analyses and input enrichment defer to
Python per model and are recorded.

* test(native): count only lineage deferrals in the fast lineage engine test

* test(native): use the native attachment entry field after #1043 and #1046

* fix(native): compare catalog shapes on cold compiles and record deferrals after the session

Keep the binding catalog's schemas and analysis shapes in captures and
ignore them only on warm stages, where Python's analysis cache skips
catalog preparation. Record per-model deferrals once the session
completes, and fall back to Python when provide or finish panics.
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