Repository navigation
Commit a411860
authored
fix: scenario, SQL test and dialect fixes for fixtures, checks and truth tests (#1147)
* fix: fill each partial fixture column once across identifier case
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.
* fix: reject IS [NOT] TRUE/FALSE on Snowflake and SQL Server at compile
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.
* fix: create the SQL Server source freshness table with an existence check
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.
* fix: casefold names in explicit-reference relation matching
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.
* fix: report built-in audits on missing columns once at the model header
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.
* fix: diagnose scenario expected columns before running and report unrun 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.
* feat: compare scenario expected output on its listed columns
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.
* fix: let scenario checks read helper CTEs and report unrun assertions
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.
* fix: grow the stack while keying deeply nested macro context values
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.
* test: fail make test when a worker crashes instead of restarting it
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.
* fix: reject scenario checks that redefine a helper CTE name at compile
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.
* test: expect scenario fixtures to carry only the helper CTEs they read
CHI-634 gives each fixture only the helpers it reads, so the planner
fixture test no longer expects every fixture to carry every helper.1 parent f1a5b79 commit a411860
97 files changed
Lines changed: 3127 additions & 185 deletions
File tree
- crates
- sqlbuild-analysis/src
- compiler
- _helpers/sql_tests
- main
- tests
- explicit_references
- _helpers
- tests
- planner_fixtures
- main
- tests
- relation_names/_helpers
- semantic_checks
- _helpers
- metadata_checks
- resource_sql
- tests
- semantic_validation
- _helpers
- main
- tests
- sqlbuild-core/src/scenario_command
- _helpers
- tests
- sqlbuild-python
- src/bindings/_helpers
- analysis
- compiled_project
- discovery
- macro_bridge
- planner_records
- planner_scenario
- result_output
- scenario_command
- scripts/compiler_differential/_helpers/analysis_corpus
- src/sqlbuild
- .agents/skills/sqlbuild/references/docs/concepts
- adapters/sqlserver/classes
- executor/scenario
- main
- tests
- e2e/src/sqlbuild/cli/commands/main
- compile
- scenario
- test
- goldens/compiler/failure
- integration/src/sqlbuild/compiler/planner/_helpers
- unit
- scripts/compiler_differential/_helpers/corpus
- src/sqlbuild
- adapters/sqlserver
- compiler
- planner/_helpers
- references/main
- executor/scenario/main
- website/src/content/docs/docs/concepts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | | - | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| |||
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | | - | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| |||
386 | 389 | | |
387 | 390 | | |
388 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
389 | 403 | | |
390 | 404 | | |
391 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
696 | 696 | | |
697 | 697 | | |
698 | 698 | | |
699 | | - | |
700 | | - | |
701 | | - | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
702 | 719 | | |
703 | 720 | | |
704 | 721 | | |
| |||
753 | 770 | | |
754 | 771 | | |
755 | 772 | | |
756 | | - | |
757 | 773 | | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
| 774 | + | |
763 | 775 | | |
764 | | - | |
765 | | - | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
766 | 781 | | |
767 | 782 | | |
768 | 783 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments