Repository navigation
fix(flow): show rule enable state and unique indexes in the db code digest - #1836
Conversation
Independent adversarial review: APPROVEFrom: Codex. Reviewed actual head 5d7de36 in a fresh detached worktree.
Validation: 211 snapshot/frame tests pass against an isolated PostgreSQL 16.15 cluster. Eight independent live probes pass: all four rule activation modes, expression/covering/NULLS NOT DISTINCT unique-index creation and deletion, and replacing a same-named index's predicate. Every change is missed by the exact parent implementation, detected by this PR, and followed by a stable reread. Full Flow Ruff/format and mypy pass (591 sources). The environment used locked package dependencies plus pinned psycopg2-binary 2.9.10. Only PostgreSQL 16 was tested in this review. The other items left open in #1674 are outside this approval. Synthetic data, headless resource gate; I did not change or push this PR. |
Part of #1674
What changed
db_snapshot.pynow reads rules frompg_rewritewithev_enabled, soALTER TABLE ... DISABLE RULEshows as a "(database code)" change. Before, it readpg_rules, which has no enabled state. A view's own_RETURNrule is still left out, the same aspg_rulesdid.pg_index.indisunique, withindisvalidandpg_get_indexdef). ACREATE UNIQUE INDEXthat is not a constraint changes which writes the database accepts, and before this it did not show when it was made or dropped.How it was tested
tests/test_db_snapshot_postgres.py:test_disabling_a_rule_showsandtest_a_unique_index_made_or_dropped_shows.tests/test_db_snapshot_postgres.pyandtests/test_frame_database.pyagainst a scratch local Postgres 17 withOPENADAPT_SNAPSHOT_POSTGRESset: 211 passed.db_snapshot.pyand the new tests, both new tests fail.db_snapshot.py.What could not be tested