fix: allow an explicit --execution-time to extend the plan end past the prod frontier#5892
Open
nnqtruong wants to merge 2 commits into
Open
fix: allow an explicit --execution-time to extend the plan end past the prod frontier#5892nnqtruong wants to merge 2 commits into
nnqtruong wants to merge 2 commits into
Conversation
… prod frontier Signed-off-by: wtruongdata <quang072000@gmail.com>
Signed-off-by: wtruongdata <quang072000@gmail.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.
Description
Why.
--execution-timetells a plan "pretend it is now X". Today that only works in one direction: if prod's recorded intervals are newer than X, the plan end is clamped down to X — but if X is beyond the last interval recorded in prod, the plan end stays capped at the prod frontier and the flag is silently ignored. That's the behavior reported in #5640: with no model changes,sqlmesh plan --execution-time '2025-12-28' --auto-applyreports "No changes to plan" and fills nothing, even though 2025-12-26/27 are due. The confusing part for users is that the same command appears to work in dev and on a first deploy — only because no prod frontier exists yet to cap against — and thatplan --run(which skips the caps) fills the intervals fine.What. In
Context.plan_builder(), whenexecution_timeis explicitly provided, no explicitendis given, and the execution time is past the computed default end (the prod frontier), the default end and the per-model interval-end caps (end_override_per_model) are raised up to the execution time. This mirrors the existing precedent for explicit--end(which drops those caps entirely viaPlanBuilder.override_end), and is bounded by the already-correctplan --runbehavior: raising caps toward the explicit execution time cannot schedule anything the cap-free--runpath wouldn't. No behavior changes when--execution-timeisn't passed, when--endis given, on first deploys, or when the execution time is behind the frontier (the downward clamp is preserved).Closes #5640
Test Plan
test_plan_execution_time_ahead_of_prod_frontier— the issue scenario end-to-end on the sushi example (backfill required, plan end = execution time, intervals advance after apply; downward clamp still asserted).test_plan_execution_time_ahead_of_prod_frontier_matches_run_for_all_models— a daily+weekly project with different per-model frontiers; asserts plainplan --execution-time Xreports byte-identical missing intervals toplan --run --execution-time X.test_plan_execution_time_ahead_of_prod_frontier_with_explicit_end— explicit--end+ far-future execution time: backfill stops at the explicit end.test_plan_min_intervals— rawplan.endnow equals the explicit execution time (1s past the old day-aligned frontier); comment explains why no interval computation changes.assert plan.requires_backfill→False).tests/core/test_context.pyandtests/core/test_plan.py(-m "not slow and not docker"), themake fast-testfast component (2544 passed; 6 failures are local-onlypyodbc/unixODBC driver import errors intest_connection_config.py, a module this PR doesn't touch), and the CLI repro from the issue before/after.Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO