test: consolidate nullability goldens into one bounded scenario - #244
Merged
Marius Volkhart (MariusVolkhart) merged 1 commit intoAug 22, 2026
Merged
Conversation
The where_clause_narrowing scenario was one 8-line schema and one query, added to pin #186. Every scenario directory costs a PostgreSQL Testcontainer and a TestKit build, while queries inside a scenario are nearly free, so a directory per regression is the wrong unit: the follow-on grouping-sets fix skipped scenario coverage entirely rather than pay for another one. Nullability inference is where Norm's defects cluster (#186, #228, #236, #239-241), and it is a generator feature rather than a SQL construct, so it gets a bucket for the same reason crud_generation and type_mappings have one. Renaming to a construct — joins_and_grouping — would name the delivery vehicle: the SQL in these queries is deliberately trivial, and the entire content of each golden is the inferred nullability marker. A bucket named for a cross-cutting property has no membership rule unless one is written down, which is what made the first attempt open-ended. README.md states it: a query belongs here iff its golden's nullability differs from what raw JDBC column metadata reports, so it pins one inference rule end-to-end. A construct-specific bug whose symptom is wrong nullability goes to that construct's scenario instead — a CTE bug to ctes, which already carries nullability-through-RETURNING goldens. The rule lives in README.md rather than a queries.sql comment because QueryFileParser accumulates every comment block into the KDoc of whichever query follows it, and blank lines do not reset the accumulator. Only trailing placement avoided the leak, and a scope rule at the end of the file is not somewhere the next contributor would look. The #186 table and findClaimingRuns query are carried over byte-for-byte. Six queries join them, one per inference rule that previously had only generator unit tests: ROLLUP null-extending a NOT NULL grouping key, an expression grouping key under ROLLUP (#236), LEFT JOIN nullability, LEFT JOIN with a proving WHERE where the outer-join veto deliberately wins, strict function narrowing through lower(), and UPDATE ... SET ... RETURNING where narrowing stays suppressed because SET overwrites the proven column. Scenario count is unchanged at 13. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Marius Volkhart (MariusVolkhart)
requested review from
Matthew Foster (MatthewFoster624) and
Ryan LuMaye (RyanLuMaye)
as code owners
August 22, 2026 15:36
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Marius Volkhart (MariusVolkhart)
deleted the
chore/consolidate-nullability-scenario
branch
August 22, 2026 15:50
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.
where_clause_narrowingwas one 8-line schema and one query, added to pin #186. Every scenario directory costs a PostgreSQL Testcontainer plus a TestKit build, while queries inside a scenario are nearly free, so a directory per regression is the wrong unit — the follow-on grouping-sets fix skipped scenario coverage entirely rather than pay for another one.Nullability inference is where Norm's defects cluster (#186, #228, #236, #239-241), and it's a generator feature rather than a SQL construct, so it gets a bucket for the same reason
crud_generationandtype_mappingshave one. Naming it for a construct instead —joins_and_grouping— would name the delivery vehicle: the SQL in these queries is deliberately trivial, and the entire content of each golden is the inferred nullability marker.Membership rule
A bucket named for a cross-cutting property has no boundary unless one is written down.
test-scenarios/nullability/README.mdstates it:A construct-specific bug whose symptom happens to be wrong nullability goes to that construct's scenario instead — a CTE bug to
ctes, which already carries nullability-through-RETURNING goldens. So #239-241 land here; a CTE resolution bug does not.The rule lives in
README.mdrather than aqueries.sqlcomment becauseQueryFileParserfolds every comment block into the KDoc of whichever query follows it, and blank lines don't reset the accumulator. Only trailing placement avoided leaking into generated KDoc, and the end of a SQL file isn't where the next contributor looks for scope.Coverage
The #186 table and
findClaimingRunsquery carry over byte-for-byte. Six queries join them, one per inference rule that previously had only generator unit tests:departmentHeadcountByRollupdepartmentNameLowerByRollupemployeesByDepartmentemployeesByDepartmentFilteredwidgetByLowerCodelower()clearAccountNoteScenario count unchanged at 13. Goldens generated by
generateGoldenFiles, never hand-edited; every result property's nullability was checked against the rule it claims to pin.:gradle-plugin:checkpasses.Two issues found, not fixed here
:gradle-plugin:testdeclares no input on../test-scenarios, so a scenario-only diff can reportUP-TO-DATEwith zero tests executed. Every verification run for this PR needed--rerun-tasks.SqlStatement.isSingleTableStarProjectionreuses a table's cached entity type when a query selects every one of its columns, discarding analyzed narrowing — so such queries bypass WHERE-clause narrowing in codegen even though the analyzer gets it right. Pre-existing, unrelated to this change.🤖 Generated with Claude Code