Repository navigation
fix: scenario, SQL test and dialect fixes for fixtures, checks and truth tests - #1147
Merged
Merged
Conversation
Required fixture columns were deduplicated by their authored spelling, so a column read as STATUS through a SELECT * import CTE and required again as the declared status was completed twice. Key required columns by their casefolded name, matching the metadata lookup, and complete each declared column at most once. Fixes CHI-630.
Both warehouses reject truth-value tests the SQL parser accepts, so models, audits, SQL tests and hooks compiled cleanly and failed at execution. Report a blocking B103 at the IS keyword of the authored resource with a null-safe rewrite. DuckDB, MotherDuck, PostgreSQL, BigQuery and Databricks accept them. Fixes CHI-631.
…heck SQL Server has no CREATE TABLE IF NOT EXISTS. Guard the freshness table like the other state tables and narrow its indexed key columns from NVARCHAR(MAX), which SQL Server cannot index, to NVARCHAR(450). Fixes CHI-518.
Relation and temporary-table names were lowercased rather than casefolded, so names such as Straße and STRASSE did not match as they do in Python and the runtime relation guard. Fixes CHI-595.
A built-in audit attached to a column the model does not output was bound as resource SQL and reported once per column reference at a made-up audits/generic/<name>.sql path. Report one B002 per audit at its declaration in MODEL() instead. Project audits that override a built-in keep their own file. Fixes CHI-476.
…un comparisons A scenario expected CTE listing fewer columns than its model failed in the warehouse with a raw set-operation error, and the result still reported 0 mismatched with actual=0 expected=0. Reject an expected CTE that omits model output columns or lists columns the model does not output with S512 at planning time, and report a comparison that did not run with an ERROR status and no counts; --json adds comparison_status and reports null counts. Refs CHI-633.
A scenario __expected__ CTE had to list every column its model outputs, so adding a column to a model broke every scenario covering it. Compare the listed columns by name in both directions, as SQL unit tests do, and report missing rows alongside mismatched ones. SCENARIO (expected_columns "all") restores the requirement that every model column be listed, diagnosed with S512 before the scenario runs. Fixes CHI-633.
Scenario assertions and expected output ran without the file's helper CTEs, so reading one failed in the warehouse with a missing-table error, and the summary still reported 0 failing rows. Place the helpers a query reads, with the helpers and fixtures they read, ahead of it in dependency order through the SQL-test helper scope, build models an assertion reads through a helper, and give fixtures only the helpers they read. An assertion that did not run reports ERROR without a count; --json adds query_status and a null count. Fixes CHI-634.
Keying a macro context value recurses once per nesting level up to the 900-level limit. In builds with large frames that recursion overflowed an 8 MB stack and crashed the process instead of reporting the value as unstorable. Each level now runs through stacker::maybe_grow, so the depth limit is reached on any stack size.
A crashed xdist worker was replaced and the run then never finished. With --max-worker-restart=0 the crash is reported as a failure and the run ends.
Scenario checks now receive the file's helper CTEs, so an expected or assertion CTE defining its own CTE with a helper's name failed in the warehouse with a duplicate CTE name. Pass the checks into the helper scope so the SQL-test shadowing check reports it at compile time.
kvlonge
enabled auto-merge (squash)
October 18, 2026 23:10
CHI-634 gives each fixture only the helpers it reads, so the planner fixture test no longer expects every fixture to carry every helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Several SQL test, scenario and dialect bugs made valid projects fail on the warehouse or report misleading results: partial fixtures filled columns twice (CHI-630), Snowflake and SQL Server rejected
IS [NOT] TRUEonly at runtime (CHI-631), scenario expected output had to list every column and unrun checks showed zero counts (CHI-633, CHI-634), plus CHI-518, CHI-595 and CHI-476. A local test run also hit a stack overflow on deeply nested macro context values.Changes
IS [NOT] TRUE/FALSEon Snowflake and SQL Server, with a rewrite suggestion.expected_columns "all"restores the strict check. Missing columns are diagnosed before running; checks that didn't run report errors, not counts (--json: null counts, newcomparison_status/query_status).make testfails when a worker crashes.Verification
sqb test/scenario test/compilefor every fix; offline Snowflake and SQL Server rendering tests; Rust unit tests.