Skip to content

feat!: pin SQLQuack 0.21.0 and bound nested function calls by a configurable depth - #92

Merged
kvlonge merged 6 commits into
mainfrom
feat/sqlquack-0-21-call-depth
Nov 19, 2026
Merged

kvlonge merged 6 commits into
mainfrom
feat/sqlquack-0-21-call-depth

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Why

SQLQuack 0.21.0 is published. SQLClean pinned 0.18.1, and SQLClean and SQLBuild link one SQLQuack, so SQLClean moves first. 0.19.0 to 0.21.0 also bound nested function calls, and SQLClean had no setting for that limit: custom Rules, fix's re-parse check, format's statement split and sqlclean facts all parsed at a fixed 256.

An earlier commit on this branch said SQLClean reads none of the tree fields SQLQuack changed. That is wrong. sql_facts walks SQLQuack's CTE, join, table and column nodes, and built-in Rules run on SQLQuack's trees inside sqlquack-lint. On 0.20.0, SQLCLEAN018 and SQLCLEAN043 were silent for a Databricks (SELECT ... OVER w ...) WINDOW w AS (...); 0.21.0 fixes that.

Changes

  • Pin all six sqlquack-* crates to the v0.21.0 tag.
  • New sqlclean.toml key max_function_call_depth (default 256, from 1 to 512), used by built-in Rules (and their cache key), custom Rules, format, fix and its re-parse check. Nesting past it is a SQLCLEAN999 finding, or a format refusal that leaves the file as written; both name the key.
  • sqlclean facts takes --max-function-call-depth, since it reads no configuration.
  • parse_sql, file_facts and statement_ends take the limit.
  • Docs and the generated skill describe the key and flag.

BREAKING CHANGE: format requests without a depth were unbounded and are now bounded at 256; a depth above 512 is declined; parse_sql, file_facts and statement_ends take a max_function_call_depth argument.

Verification

  • cargo test --all (41 + 8) and Python tests (76) pass; make check-ci passes.
  • New tests fail without the change: custom Rules and format at depth 300, and the Databricks named window for SQLCLEAN018/043.
  • facts, format and check match the 0.9.7 release byte for byte on the Snowflake comparison files.

All six sqlquack crates move from the v0.18.1 tag to the v0.20.0 tag
together. SQLClean reads none of the tree fields SQLQuack changed in
0.19.0, so no reader changes, and the format corpus is unchanged in every
dialect.

Lint and format requests take max_function_call_depth, 256 when absent and
at most 512. Lint used SQLQuack's fixed 128 before; a format request that
left it out had no bound of SQLClean's own. Nesting past the limit is a
parse error that names the setting.
The refusal for deep function-call nesting tells the user to raise
max_function_call_depth, so sqlclean.toml now has that key (default 256,
from 1 to 512). check passes it to the built-in Rules and format and fix
pass it to the formatter, whose refusal now names the setting as lint's
does. The built-in result cache key includes it.

Splitting statements, custom Rules, fix's parse check and facts still
parse at the fixed 256 until SQLQuack's parse_sql takes the depth.
Custom Rules, fix's re-parse check, statement splitting for format and
sqlclean facts parsed through parse_sql at SQLQuack's fixed default of
256 nested calls, so a file the configured max_function_call_depth
accepts was refused there with a hint to raise a setting already raised.

SQLQuack's parse_sql now takes the limit. parse_sql, file_facts and
statement_ends take it too, and every caller passes the configured
value. sqlclean facts reads no configuration, so it takes
--max-function-call-depth (default 256, from 1 to 512).

A Databricks test covers SQLCLEAN018 and SQLCLEAN043 on a named window
defined after a parenthesized query, which SQLQuack 0.20.0 missed.

BREAKING CHANGE: parse_sql, file_facts and statement_ends take a
max_function_call_depth argument.
All six sqlquack crates move from SQLQuack's main commit to the v0.21.0
tag. 0.21.0 resolves a named window written after a parenthesized query,
so SQLCLEAN018 and SQLCLEAN043 check Databricks
(SELECT ... OVER w ...) WINDOW w AS (...) again, and its parse_sql takes
the call-depth limit SQLClean now passes everywhere.
The lint and format call-depth tests assert against their expected
outcomes without branching, and move with the Databricks named-window
test out of the oversized lint test file. The default and maximum depth
are SQLClean constants rather than a re-export. The format e2e test
also covers the default limit, which leaves 300 nested calls as written
and names the key that raises it.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sqlclean with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2cfaf40
Status: ✅  Deploy successful!
Preview URL: https://62261188.sqlclean.pages.dev
Branch Preview URL: https://feat-sqlquack-0-21-call-dept.sqlclean.pages.dev

View logs

@kvlonge
kvlonge merged commit 17a5239 into main Nov 19, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant