Skip to content

feat: use the built-in policy when there is no policy file - #120

Merged
kvlonge merged 2 commits into
mainfrom
fix/builtin-policy-default
Nov 6, 2026
Merged

kvlonge merged 2 commits into
mainfrom
fix/builtin-policy-default

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Why

In a fresh folder, sqlquack convert revenue.sql --schema schema.json, the command on the homepage, exited 2 because no sqlquack.toml was there. Without a policy file, SQLQuack now uses the built-in policy, which refuses every known divergence.

Changes

  • convert, function, census and index read the file --policy names, else sqlquack.toml in the current directory, else the built-in policy. The Python API does the same.
  • --builtin-policy still chooses the built-in policy, even where a sqlquack.toml exists. A --policy file that doesn't exist, or a policy file that isn't valid, is still a usage error (exit 2).
  • The SQ0008 help for the built-in policy no longer names the flag. The README, policy, quickstart and convert pages and the diagnostics reference describe the new default.

Verification

  • CLI tests in a temporary folder:
    • Without a policy file, convert, census, index and function run (exit 0), and a CURRENT_TIMESTAMP() statement is refused under the built-in policy.
    • A sqlquack.toml in the folder is still read and allows that statement, and --builtin-policy still refuses it.
    • A missing --policy file and an invalid sqlquack.toml exit 2.
  • A census binary test with no policy file.
  • A Python API test, checked against the command line.
  • make check-ci, make test-rust, make verify-recorded.

Without --policy and without sqlquack.toml in the current directory,
convert, function, census, index and the Python API now use the
built-in policy, which refuses every known divergence, instead of
exiting 2. --builtin-policy still chooses it explicitly. A --policy file
that does not exist, or an invalid policy file, is still an error.

kvlonge commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Gate on a677aab (based on main 37e3767):

kvlonge commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Landing gate at 05c97e7 (main 50e3efb merged):

  • make check-ci: exit 0
  • make test-rust: exit 0
  • make verify-recorded: 11,793 cases, 0 failed; nothing regressed
  • Hygiene scan: clean
  • Smoke test in a fresh folder with no sqlquack.toml: sqlquack convert revenue.sql --schema schema.json converts under the built-in default (exit 0), and --policy missing.toml still exits 2.

@kvlonge
kvlonge merged commit 05c97e7 into main Nov 6, 2026
1 check failed
kvlonge added a commit that referenced this pull request Nov 6, 2026
05c97e7

32 models: incremental models compiled by dbt-snowflake 1.12 as an
incremental run, its snapshot staging SQL for the check and timestamp
strategies, merge and delete+insert DML with several incremental
predicates, QUALIFY dedup edge cases and MERGE shapes. The corpus test
helper passes the policy path as an Option, as #120 expects.
@kvlonge
kvlonge deleted the fix/builtin-policy-default branch November 9, 2026 21:31
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