Add VALIDATION_OP=check_binds: bind-check a dbt test's compiled SQL - #60
Merged
Conversation
EXPLAINs a dbt test's compiled SQL against the candidate schema via the engine adapter and creates nothing, so a test naming a column a candidate change dropped or renamed fails the release at its source instead of being silently skipped or failing later, further from the cause. check_binds joins _NODE_OPS and loads CANDIDATE_SQL_URI exactly as build_from_sql does; the dispatch calls adapter.check_binds(candidate_sql) after ensure_schema, building nothing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmwnLzBDNG75NcYvX7w1gJ Signed-off-by: Simone Carolini <simonecarolini.sc@gmail.com>
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.
Summary
Adds a new validation op
check_bindsto the runner. It fetches the node's compiled SQL from S3 (CANDIDATE_SQL_URI, exactly likebuild_from_sql), callsadapter.check_binds(sql)— the engine's EXPLAIN, which parses and binds the read against the candidate schema without scanning rows — and creates nothing. Success exits 0 with the usual result block; a bind error (a dropped/renamed column or relation) surfaces the engine's error line through the same log/exit path as the build ops so the classifier sees it.continuo's release-controller emits
check_bindsfor every dbt test of a changed model, so a test whose SQL no longer binds against the shapes a release produces rejects that release at its source. This runtime release must ship (images published to ghcr) before continuo's PR pinning the tag merges — the executor emitscheck_bindsonly once that continuo PR is deployed, and a runtime without this op exits on the unknown op.Changes
continuo_python_runtime/validation/runner.py:check_bindsadded to_NODE_OPS; the candidate-SQL-loading branch now covers bothbuild_from_sqlandcheck_binds; a dispatch branch callsadapter.check_binds(candidate_sql)and creates no table; module +main()docstrings updated.tests/test_validation_runner.py: three tests mirroring the siblingbuild_from_sqltests (success asserts the adapter's recorded bind call with no build/clone/column-build; bind-error exit; empty-candidate-SQL exit), plus the twocheck_bindscases wired into the one-sentinel-block invariant table.CHANGELOG.md:[Unreleased]Added entry.Test plan
uv run pytest tests -k check_binds -v— the three new tests pass.uv run pytest tests -v(non-Docker CI gate) — full suite green (the Docker image-smoke tests require a locally pre-built dev image and are unrelated).🤖 Generated with Claude Code
https://claude.ai/code/session_01HmwnLzBDNG75NcYvX7w1gJ