Skip to content

feat(native): report declaration and scope errors natively - #1033

Merged
kvlonge merged 2 commits into
mainfrom
feat/native-stage-errors
Oct 8, 2026
Merged

kvlonge merged 2 commits into
mainfrom
feat/native-stage-errors

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Why

Native compiler stages still re-ran the Python implementation after a failure, only to get Python's exact error. For declarations and scopes that re-run is pure overhead and, under the macro bridge, executes macros twice. This is the first error-family slice of moving those errors native.

Changes

  • Declaration files: a native parse failure, read error or value error is raised directly; Python no longer re-parses the file to cross-check it. Files native defers still parse in Python.
  • @enum/@const references: the native scan returns the references Python resolves plus the error that stops its walk (unclosed quote or block comment, malformed reference). The expansion raises Python's first error in walk order instead of handing the string back to Python, with shared messages.
  • Exact errors stay CompileInputError (code P001, same text, same lifecycle error_type on every engine) and carry bridge_independent=True. This includes Python's own scan errors when the native scan defers.
  • Macro bridge: the stage re-runs in Python only for failures after the bridge has scanned SQL that are not marked bridge_independent.
  • Tests: native/Python parity on generated reference SQL, declaration files without the cross-check, bridge re-run rules, E2E compiles proving identical errors with macros run once (including a Python-scanned unclosed quote), the lifecycle error_type on all three engines, and five failure-corpus cases.

Verification

  • cargo test --workspace --all-features, clippy and fmt with Rust 1.99.0
  • Focused pytest for the macro bridge, model loop, authored SQL and declaration files, plus the E2E module
  • make compiler-differential with CI flags (233 identical), make compiler-differential-shipped (227 identical), tests/e2e/scripts/compiler_differential
  • make check-ci, make test, public-repository scan

@kvlonge
kvlonge force-pushed the feat/native-stage-errors branch from de7a3de to 527c175 Compare October 8, 2026 15:20
@kvlonge
kvlonge enabled auto-merge (squash) October 8, 2026 15:20
@kvlonge
kvlonge merged commit 241fb56 into main Oct 8, 2026
38 checks passed
@kvlonge
kvlonge deleted the feat/native-stage-errors branch October 8, 2026 16:31
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