feat(introspect): read live ferro-owned CHECK constraints (#342) - #349
Merged
Conversation
Expose live_table_checks from introspect for Postgres pg_get_constraintdef and SQLite inline named CONSTRAINT ... CHECK parsing, with ferro_owned classification and a narrow test FFI for pytest. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
Gate: clearRead the full diff (introspect, parser, FFI, cargo + pytest). AC for #342 is met.
Merging into |
4 tasks
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
LiveCheckandlive_table_checks()insrc/introspect.rsto read named CHECK constraints from live databases: Postgres viapg_constraint+pg_get_constraintdef, SQLite by parsing inlineCONSTRAINT "…" CHECK (…)fromsqlite_master.sql.name, catalogdefinition(returned as-is for Rebuild a table check when the check predicate drifts #344), andferro_owned(ck_*vs user-owned) so Add missing ck_* on migrate_updates #343 reconciliation can distinguish Ferro artifacts without silently dropping user CHECKs._live_table_checks_for_testtest FFI plus cargo/pytest coverage with planted SQL (transfer at-most-one-outflow example).Closes #342
Test plan
cargo test --no-default-features --features testing introspect::uv run pytest tests/test_live_table_checks.py --db-backends=sqlite -vuv run pytest tests/test_live_table_checks.py --db-backends=postgres -v(CI / local Postgres)Made with Cursor