Skip to content

Pre-release model versions should warn (not error) on contract breaking changes#12623

Open
jecolvin wants to merge 2 commits intodbt-labs:mainfrom
jecolvin:prerelease-contract-warning
Open

Pre-release model versions should warn (not error) on contract breaking changes#12623
jecolvin wants to merge 2 commits intodbt-labs:mainfrom
jecolvin:prerelease-contract-warning

Conversation

@jecolvin
Copy link

@jecolvin jecolvin commented Mar 9, 2026

Summary

Resolves #12164

  • Pre-release model versions (where version > latest_version) now produce a warning instead of a hard ContractBreakingChangeError when a breaking contract change is detected
  • Applies to both contract modifications (same_contract) and model deletion/disabling (same_contract_removed)
  • Non-prerelease versioned models continue to raise errors as before
  • Users can restore the old strict behavior via --warn-error or --warn-error-options

Implementation notes

Adds an is_prerelease property to ModelNode that reuses the existing version comparison logic from VersionSelectorMethod. The two decision points in same_contract() and same_contract_removed() are updated from a 2-way branch (unversioned→warn, versioned→error) to a 3-way branch (unversioned→warn, prerelease→warn, non-prerelease versioned→error).

dbt-protos workaround: The event/logging system requires protobuf messages defined in the external dbt-protos package, which cannot be modified from within dbt-core. Rather than introducing a new PrereleaseBreakingChange event type (which would require a corresponding proto message), this PR reuses the existing UnversionedBreakingChange event with "(pre-release)" appended to the model name to clearly identify the source.

Test plan

  • New TestChangedContractPrereleaseVersioned — makes a breaking change only to a pre-release version (v2), verifies no ContractBreakingChangeError is raised
  • New TestDeletePrereleaseVersionedContractedModel — deletes a pre-release version, verifies warning instead of error
  • All 46 existing test_modified_state integration tests pass
  • All 1610 unit tests pass
  • Linting (flake8 + mypy) passes

…ersions (dbt-labs#12164)

When a model version is pre-release (version > latest_version), breaking
changes to its enforced contract now produce a warning instead of a hard
ContractBreakingChangeError. This applies to both contract modifications
and model deletion/disabling.

Non-prerelease versioned models continue to raise errors as before.
Users can restore the old behavior via --warn-error or --warn-error-options.

Note: Reuses UnversionedBreakingChange event with "(pre-release)" in the
model name rather than introducing a new event type, because the event
system requires protobuf messages defined in the external dbt-protos
package which cannot be modified from within dbt-core.
@jecolvin jecolvin requested a review from a team as a code owner March 9, 2026 20:55
@cla-bot cla-bot bot added the cla:yes label Mar 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@github-actions github-actions bot added the community This PR is from a community member label Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla:yes community This PR is from a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] model versions in pre-release shouldn't trigger contract violation failures

1 participant