Skip to content

feat(native): report reference extraction errors natively - #1037

Merged
kvlonge merged 5 commits into
mainfrom
feat/native-reference-errors
Oct 8, 2026
Merged

kvlonge merged 5 commits into
mainfrom
feat/native-reference-errors

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Why

Under the preview engine, native reference extraction sent rejected calls (P012) back to Python and re-scanned to confirm P001 scan errors, which had no location.

Changes

  • Native returns rejected calls with Python's exact P012 message, help, fix and start; only unsupported line-comment prefixes defer.
  • Native P001 scan errors are raised directly, with no Python re-scan or cross-check.
  • Behavior change, both engines: a model's P001 reference-scan error (unclosed parenthesis, quote or comment, empty argument) now starts with path:line:col:. The fault offset comes from the scan of the SQL that failed and is mapped back to the file through the body start and the declaration and macro expansion spans; nothing is searched. It is located, and raised with bridge_independent=True, only if it lies in authored text and the scan fails identically with every expansion output blanked. Otherwise, and for tests, audits, functions and @@var bodies (no map yet), the error names the file alone and keeps the bridge re-run. The type stays CompileInputError.
  • Failure-corpus expectations are updated; no docs quote these messages.
  • Tests:
    • Rust cases taken from Python.
    • Generated parity on all seven lexical syntaxes, including an escaped-quote header.
    • Source-map cases: header offset, two passes, a fault in macro output, an authored fault shaped by an unclosed macro quote.
    • E2E on all three engines: escaped-quote header, macro-output fault before an authored one (Python re-run kept), authored fault after a macro (no re-run), TEST/AUDIT/FUNCTION headers; lifecycle error_type CompileInputError.

Verification

  • cargo test --workspace --all-features, clippy and fmt with Rust 1.99.0
  • Focused reference, E2E compile and corpus-code tests
  • make compiler-differential with CI flags, make compiler-differential-shipped, tests/e2e/scripts/compiler_differential
  • make check-ci, make test, public-repository scan

@kvlonge
kvlonge force-pushed the feat/native-reference-errors branch from 6eafe48 to 435f67d Compare October 8, 2026 17:54
@kvlonge
kvlonge force-pushed the feat/native-reference-errors branch from 435f67d to a1361e0 Compare October 8, 2026 19:43
@kvlonge
kvlonge enabled auto-merge (squash) October 8, 2026 20:55
…-errors

# Conflicts:
#	tests/e2e/src/sqlbuild/cli/commands/main/compile/_test_types.py
@kvlonge
kvlonge merged commit 8dc2d1e into main Oct 8, 2026
37 checks passed
@kvlonge
kvlonge deleted the feat/native-reference-errors branch October 8, 2026 22:52
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