Repository navigation
fix: preserve full-replay history and improve SQL test planning - #801
Merged
Merged
Conversation
…d 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.
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.
…lections by direction
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.
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.
kvlonge
enabled auto-merge (squash)
September 24, 2026 07:23
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
Full replay could replace an incremental table with only its recent cursor window, silently losing history. SQL-test chains could grow exponentially, and duplicate planning implementations caused inconsistent behavior.
Changes
replay_on_change full, including runtime-resolved and microbatch bounds; show resolved replay ranges.Verification