refactor: model desired and observed constraints - #355
Open
Tomoscorbin wants to merge 2 commits into
Open
Conversation
Tomoscorbin
commented
Aug 13, 2026
Tomoscorbin
commented
Aug 13, 2026
Tomoscorbin
commented
Aug 13, 2026
Tomoscorbin
marked this pull request as ready for review
August 14, 2026 09:54
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
Desired*declarations andObserved*catalog occurrencesdesired_nameandcatalog_namefieldsWhy
Constraint names have different meanings before and after creation. A desired name is a creation preference; an observed name is a physical catalog handle. Treating either as relational identity creates false drift and replacement work.
This PR makes
desired_key == observed_keyexpress the reconciliation question directly. The four lifecycle values are the complete constraint vocabulary; private functions hide their shared mechanics without introducing another constraint-like entity.Behavior and compatibility
This intentionally changes name-only drift: a matching catalog definition is adopted regardless of its catalog name. Structural differences still produce drop-and-set actions.
Public declarations still generate the existing default desired names, and newly created constraint SQL remains named exactly as before. Optional names, Databricks-assigned naming, and the
Set*toAdd*action redesign remain in later PRs.This is PR 1 of the constraint-lifecycle redesign and is stacked on
feature/constraint-lifecycle-redesign-plan.Validation
uv run pytest -q— 1,258 passed, 78 deselected; 97.14% coverageuv run mypy srcuv run ruff check .uv run ruff format --check .uv run lint-importsuv run --group docs sphinx-build -W -b html docs /tmp/delta-engine-pr355-docsgit diff --check