Repository navigation
Commit d616759
authored
fix: preserve full-replay history and improve SQL test planning (#801)
* fix(sql-tests): render each upstream model once in the textual SQL-test chain
* refactor(sql-tests): make native planner the single SQL-test chain and comparison implementation
The Python SQL-test planner and comparison renderer duplicated the native
implementation used by compile, and the Python textual chain inlined every
upstream model once per dependency path.
- Native planning now returns each test's chain and assertion steps, model
names and warnings, with optional rendered SQL, in one batch call.
- plan/build/test build SqlTestPlanEntry from the native plan; Python keeps
fixture validation and plan metadata only.
- Comparison SQL, difference samples, compile target files and runtime
artifacts all render natively, using the SQL-analysis dialect for CTE
lifting.
- Each distinct missing mock is reported once per test instead of once per
dependency path or chain step.
- Textual assertion fallbacks lift their chain CTEs to the top level.
- Remove the Python assembly, analysis assembly, comparison helpers and
dead wrappers.
* fix(sql-tests): omit SQL from chain steps the comparison never renders
Native plan output carried every chain step's full upstream closure, so
long unmocked chains produced step payloads quadratic in chain length.
- Populate resolvedSql, liftedCtes and comparisonBodySql only for steps
with an expected CTE or an assertion that reads the step's actual CTE,
using one shared rendered-step helper for planner and renderer.
- Skip empty steps when building manifest test compiled_code.
- Add a long-chain regression test bounding step SQL by the rendered SQL
and proving unrendered step SQL cannot change the rendered comparison.
* feat(format): accept file paths and explain path selector errors
* fix(format): keep leading CTE comments on their own lines above the CTE
* feat(lineage): accept several and kind-prefixed targets and expand selections by direction
* feat(sql-tests): compare only the columns listed in the expected CTE
SQL unit tests compared whole rows by position, so an __expected__ CTE had
to list every model column in model order.
- The native planner reads each expected CTE's column list syntactically
(projection names, VALUES alias lists, first set-operation branch) with
the SQL-analysis dialect, keeping authored identifier spelling. It works
without SQL analysis and falls back to full-row comparison when the list
is not explicit.
- Comparison counts and difference samples project both sides to the listed
columns; the actual row count still counts every actual row.
- With SQL analysis and authoritative model columns, unknown expected
columns fail statically before connecting. Otherwise a failed comparison
probes the actual step's columns with a zero-row query and reports the
missing columns as T005 instead of the warehouse error.
- Document the rule in the agent testing skill references.
* feat(sql-tests): report missing mocks in sqb test and sqb compile
Planner ERROR warnings for a SQL test, such as a reference with no mock,
were only visible through `sqb test --inspect`.
- `plan_sql_tests` now turns a test's distinct ERROR-severity planning
messages into fixture diagnostics, so `sqb test`, `sqb build` and
`sqb test --inspect` stop with the existing "Invalid SQL test fixtures"
error before execution. WARNING-severity warnings are unchanged.
- Compile artifact planning reports the same messages as S000 test-phase
compile diagnostics from the single native batch call. They count in the
compile summary, appear in --json, and make compile exit 1. Tests with
planning errors are not stored in the SQL-test artifact cache, so warm
compiles report them again.
* fix(incremental): preserve full history when replay replaces a model
* fix(lineage): honor exclusions and depth for directional selectors
* fix(sql-tests): retain upstream resolution after textual fallback
* fix(plan): hide unresolved cursor placeholders in replay ranges
* perf(compile): omit unused SQL-test execution plans from artifact responses
* test(preview): force a listed-column execution error in failure scenes1 parent 8818e59 commit d616759
102 files changed
Lines changed: 4705 additions & 3109 deletions
File tree
- crates/sqlbuild-rules-native/src
- bindings/_helpers
- compiler
- _helpers/sql_tests
- main
- tests
- sql_lint
- _helpers
- tests
- scripts/cli_preview/_helpers
- src/sqlbuild
- .agents/skills/sqlbuild
- references
- cli
- commands
- _helpers
- compile
- entry
- lineage
- lint
- classes
- main/project
- output
- _helpers
- progress/classes
- compiler
- manifest/_helpers
- planner
- _helpers
- graph
- output
- resolve
- sql_tests
- main
- changes
- execution
- executor
- build/_helpers
- run/_helpers/materializations
- testing
- _helpers
- main
- runtime/observability
- tests
- e2e/src/sqlbuild/cli/commands/main
- build
- compile
- lineage
- test
- integration/src/sqlbuild
- cli/commands/main
- compiler/planner/_helpers/sql_test_assembly
- unit/src/sqlbuild
- cli/commands
- _helpers/lineage
- main
- compile
- entry
- compiler
- manifest
- planner/_helpers
- resolve
- sql_test_assembly
- executor/testing/main
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
124 | 142 | | |
125 | 143 | | |
126 | 144 | | |
| |||
321 | 339 | | |
322 | 340 | | |
323 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
324 | 347 | | |
325 | 348 | | |
326 | 349 | | |
| |||
| 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 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
0 commit comments