feat(api): report how an environment's targets diverge on pull - #1271
Draft
aparajon wants to merge 3 commits into
Draft
feat(api): report how an environment's targets diverge on pull#1271aparajon wants to merge 3 commits into
aparajon wants to merge 3 commits into
Conversation
An environment whose targets each hold their own schema has no single live schema, so pulling only the primary presented one target's schema as the environment's. A pull now fans out across every target and reports how each one differs from the primary. The response body is still the primary's schema, which is what a caller materializes. Alongside it, each other target reports its table count and the tables the two do not agree on: held by both with different DDL, held only by the primary, or held only by that target. Tables are compared by the dialect parser's canonical form, so formatting never reads as a schema difference. Deployments that are expected to hold the same schema are neither pulled nor compared. A difference between them is drift for the review-time rollup to block on, and pulling them would cost a round trip each to learn what the configuration already asserts. A target that cannot be pulled, or a table whose DDL cannot be compared, fails the pull. Reporting no divergence for a target that was never compared would describe the environment as converged on the strength of a comparison that did not happen. Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
Why this matters
Pull materializes an environment's live schema into the repository's schema root. For an environment whose targets each hold their own schema, it reads the primary and returns it as the environment's schema — silently presenting one target's state as all of them. An operator adopting a multi-target database that way would write a schema root that is wrong for every target but one, with nothing in the output saying so.
What it does
Fans out across every target and reports how each one differs from the primary:
How it moves us toward the northstar
Pull was the last read path still collapsing a resolved target list to
targets[0]. Consuming the fullResolveTargetsresult has to hold on reads as well as applies, or an operator's first look at a multi-target database misrepresents it.Opened by Claude (Fable 5).