Skip to content

feat(scenarios): reject quoted and materialized scenario CTE names like SQL tests - #1052

Merged
kvlonge merged 3 commits into
mainfrom
feat/strict-scenario-ctes
Oct 9, 2026
Merged

kvlonge merged 3 commits into
mainfrom
feat/strict-scenario-ctes

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

Scenarios and macro-test scope scans still fell back to a Polyglot re-parse when the CTE scanner failed. That accepted quoted CTE names and AS [NOT] MATERIALIZED, rewrote the bodies, and kept a Python-only path. SQL tests already reject these forms (#1026).

Accepted-input changes (no external users, so no shim; no project in the repo or differential corpus uses these forms):

  • Quoted scenario and macro-test CTE names are errors.
  • AS MATERIALIZED / AS NOT MATERIALIZED are errors in SQL tests, scenarios and macro tests.
  • Unquoted non-ASCII scenario CTE names (e.g. café), previously accepted, are errors (ASCII-only, as for SQL tests).
  • CTE names starting with a digit (e.g. 2024_orders) get the located name error with help.
  • A scenario's located CTE-name error is reported before its other extraction errors, matching SQL tests.

Changes

  • Removed the Polyglot CTE fallback (analysis/ctes.py) from scenario extraction, unclassified SQL-test CTEs and macro-test relationship scans. The native scenario outcome has one error.
  • Scenarios are validated before compile like SQL test blocks, with a located error (path:line:column) and the SQL-test help.
  • Materialization hints get a located error naming the CTE instead of the misleading must use AS (...).
  • Discovery records each scenario's SQL span for locations.
  • testing.mdx and scenarios.mdx document the rules; the skill reference is regenerated.

Verification

  • CLI E2E on python, native and native-preview for a quoted scenario CTE, a materialized scenario CTE and a quoted macro-test CTE: identical located errors with help. Cases are in the failure corpus.
  • waffle_shop compiles to identical artifacts before and after on all engines.
  • Rust tests (incl. scenario body span with CRLF and non-ASCII), clippy/fmt on 1.99.0, focused tests, compiler differentials, make check-ci, hygiene.

…ke SQL tests

Scenarios and macro-test scope scans no longer fall back to a Polyglot
re-parse. Quoted CTE names and AS [NOT] MATERIALIZED are located compile
errors with help on every engine, matching SQL tests.
@kvlonge
kvlonge enabled auto-merge (squash) October 9, 2026 01:41
@kvlonge
kvlonge merged commit 33fd340 into main Oct 9, 2026
39 checks passed
@kvlonge
kvlonge deleted the feat/strict-scenario-ctes branch October 9, 2026 03:08
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