|
@brucearctor it looks like the direct-modification case already raises PlanError on current main. Could you maybe clarify what version/scenario you reproduced, and update the PR description to state that the net-new behavior is the indirect-modification loop (plus the _check_schema_change refactor). |
Sorry, something went wrong.
|
This PR was opened months ago. Way too long has passed for me to recall. Too stale for me to worry about - it was solving someone else's reported bug -- i was trying to get involved with supporting this project. |
Sorry, something went wrong.
|
Closing, as i thats too long to maintain context |
Sorry, something went wrong.
|
@brucearctor Apologize we didn't pick it up sooner. The TSC was formed and starting to be active in the last couple of weeks after sqlmesh had been donated to Linux Foundation. We'll be more active going forward though |
Sorry, something went wrong.
|
All good. Apologies not needed. I just cant recall the status as was someone else's issue. And given 3 months has passed since opening that PR, it seemed reasonable for me to consider sufficiently stale. |
Sorry, something went wrong.
Summary
Fixes #5719. Destructive schema changes on forward-only models are now surfaced at plan-build time during dev plans (sqlmesh plan dev), not just prod plans.
Problem
When a forward-only model has columns removed or types narrowed, sqlmesh plan dev and PR checks would succeed, but the production deployment would fail with a DestructiveChangeError during MigrateSchemasStage. This left the production environment in an unfinalized state.
Root Cause
PlanBuilder._check_destructive_additive_changes already checked for destructive schema changes at plan-build time (regardless of is_dev), but only for directly modified snapshots. Indirectly modified forward-only models (e.g., downstream models inheriting schema changes from an upstream dependency) were not checked. The evaluator-level check in MigrateSchemasStage catches these for prod, but that stage is skipped for dev plans.
Changes
sqlmesh/core/plan/builder.py
tests/core/test_plan.py
Add 5 new tests for is_dev=True scenarios:
Test Results
All 27 forward-only/destructive tests pass (5 new + 22 existing), zero regressions.