Repository navigation
Conversation
…irect A formatting-only change to a model's query still changes its data hash, since the hash includes the raw query text, so its children's parent data hash changed and they were reported as indirectly modified. They are categorized METADATA, keep their previous version and aren't backfilled, so reporting them differs from a regular metadata change, which doesn't list the children at all. ContextDiff.indirectly_modified now returns False for such snapshots: categorized METADATA with the previous version. The plan builder needs the hash-based answer while categorizing, so that rebuilding a plan doesn't flip forward-only flags, and opts in with include_metadata_only=True. Fixes SQLMesh#5573 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Vamsi-klu <nrvamsi13@gmail.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Description
Fixes #5573.
A formatting-only change to a model's query, such as extra whitespace, still changes its data hash, because the hash includes the raw query text. The model itself is correctly categorized as a metadata change. But its children's
parent_data_hashchanges too, soContextDiff.indirectly_modifiedreported them as "Indirectly Modified", even though they are categorized METADATA, keep their previous version, and aren't backfilled. A real metadata change, like adding an audit, doesn't list the children at all, so the two looked inconsistent.ContextDiff.indirectly_modifiednow returns False for a snapshot whose parent hash changed, if it has been categorized METADATA and kept the previous version. The plan builder only assigns METADATA to an indirectly modified snapshot when every upstream change, including stored parents' changes since its previous version, is METADATA. So this matches what the plan already decided, and a real upstream data change is still reported as indirect.The plan builder needs the raw, hash-based answer during categorization. Otherwise, rebuilding the same plan (e.g. after
set_start) would see already-categorized children and flip their forward-only flag. Its three call sites pass the newinclude_metadata_only=Trueand behave exactly as before. The default is used by the display callers: the plan summary in both consoles, the CI bot and the web UI.Out of scope:
Plan.indirectly_modified, the children listed under a directly modified parent, is built separately and is unchanged. The issue's scenario, a metadata-only parent, never puts anything in it.Test Plan
tests/core/integration/test_change_scenarios.py, on sushi:test_metadata_only_parent_change_is_not_indirect: whitespace inwaiter_revenue_by_day's query. The childtop_waitersis not indirectly modified, is METADATA, keeps its version and has no missing intervals. It fails before the fix.test_data_change_in_parent_is_indirect: a guard showing that a real change in the parent still makes the child indirectly modified.test_metadata_only_parent_change_rebuild_keeps_forward_only_child: a forward-only child of a whitespace-edited parent is METADATA and forward-only after the first build, and stays so after rebuilding the samePlanBuilder. Withoutinclude_metadata_only=True, the rebuild flips the child to non-forward-only. The two categorization call sites back each other up, so the test fails only when both lose the flag. The preview filter call site isn't observable in this scenario.sqlmesh initscenario. The child is no longer listed as indirectly modified, and its category and version are unchanged.tests/core/test_plan.py,test_context.py,test_console.py,test_plan_stages.py,tests/integrations/github/cicd/,tests/core/integration/test_change_scenarios.pyandtest_forward_only.py: 427 passed, with no changes to existing expectations.ruff format --check,ruff checkandmypyon the changed files: clean.Checklist
make styleand fixed any issues (ruff, ruff-format and mypy on the changed files)make fast-test). I ran the affected suites listed above, not the fullmake fast-test.git commit -s) per the DCO🤖 Generated with Claude Code
Summary by CodeRabbit