Skip to content

feat(native): build compile attachments natively behind the preview engine - #1018

Merged
kvlonge merged 6 commits into
mainfrom
feat/native-attachments
Oct 8, 2026
Merged

kvlonge merged 6 commits into
mainfrom
feat/native-attachments

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Why

M3g moves the compile attachments (everything that is not a model) onto the native path behind the native-preview engine, so the preview compile keeps closing the gap to an all-native compile. Output must stay byte-identical to Python or defer to it.

Changes

  • New NativeStage.ATTACHMENTS (preview tier) and a sqlbuild-attachments crate.
  • Authored SQL outside models (sources, functions, tests, scenarios, audits, hooks) uses the native static variable substitution and declaration reference scan. SQL with $ keeps Python interpolation so unclosed dollar quotes raise Python's message.
  • Source and function header ${...} templates expand natively, recording the same environment reads. A native rejection Python accepts raises NativeStageMismatchError.
  • Attached generic audits render natively: argument merge, raw and quoted @name rendering, severity and run scope. Conflicts, unknown values, odd argument types and non-ASCII whitespace defer to Python.
  • Seed declarations pair with seed files natively.
  • Cursor intrinsic rejection outside models runs natively; anything Python could reject defers.
  • Macros in every attachment kind already run through the feat(native): batch and cache macro calls behind the preview engine #1013 bridge; a new project test proves it for audits, built-in audits, functions, sources, tests, scenarios and hooks.
  • The differential corpus gains a templated source and function (source_template, function_header_template render kinds).

Verification

  • cargo test --workspace, clippy and fmt (1.98.0)
  • Seeded Python-vs-preview parity tests for authored SQL, audit rendering and cursor intrinsics, plus a whole-project compile-input test across engines
  • make compiler-differential with stage captures and full coverage: 168/168; make compiler-differential-shipped: 162/162
  • tests/e2e/scripts/compiler_differential: 18 passed
  • make check-ci, make test (11701 passed), hygiene scan

@kvlonge
kvlonge enabled auto-merge (squash) October 8, 2026 02:19
@kvlonge
kvlonge merged commit 79a5b45 into main Oct 8, 2026
37 checks passed
@kvlonge
kvlonge deleted the feat/native-attachments branch October 8, 2026 03: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