Skip to content

feat(console): list preview backfills in their own plan summary section - #6275

Open
Vamsi-klu wants to merge 1 commit into
SQLMesh:mainfrom
Vamsi-klu:feat/separate-preview-backfills-in-plan
Open

Vamsi-klu wants to merge 1 commit into
SQLMesh:mainfrom
Vamsi-klu:feat/separate-preview-backfills-in-plan

Conversation

@Vamsi-klu

@Vamsi-klu Vamsi-klu commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Closes #5116.

In dev plans, models that are backfilled only for a preview were listed under "Models needing backfill:" with a (preview) suffix. That reads as if they need a real backfill, even when nothing will be reused in prod. Previews now get their own section, using the explainer's existing wording:

Models needing backfill:
└── sushi__dev.new_model: [full refresh]
Models needing preview (data will NOT be reused in production):
└── sushi__dev.fo: [2026-11-26 - 2026-11-26]

Before, the same plan printed:

Models needing backfill:
├── sushi__dev.fo: [2026-11-26 - 2026-11-26] (preview)
└── sushi__dev.new_model: [full refresh]
  • Entries are split with plan.deployability_index.is_deployable(snapshot). That's the same check that drove the (preview) suffix and the explainer's "preview" note, so which models count as previews doesn't change.
  • Each section is printed only if it has entries, and each section is truncated on its own. A dev plan with only previews no longer prints an empty "Models needing backfill:" header.
  • MarkdownConsole gets the same split, so the two consoles stay consistent. The CI bot only summarizes prod plans, where every snapshot is deployable, so its PR comments don't change.
  • I updated the three docs pages that show preview output.

Test Plan

  • New test_plan_summary_separates_preview_backfills, parametrized over TerminalConsole and MarkdownConsole. It uses a sushi dev plan with a forward-only change (preview) and a new model (backfill). It fails before the change and passes after.
  • New test_plan_summary_omits_empty_preview_section guards the backfill-only case.
  • tests/core/test_console.py, tests/cli, tests/integrations/github/cicd, tests/core/test_plan.py, tests/core/test_context.py and tests/core/integration: 626 passed and 2 failed. test_cli.py::test_dlt_pipeline fails the same way on clean main, and test_cli.py::test_signals passed when re-run alone. A separate run of tests/integrations/github and tests/cli/test_cli.py gave 184 passed and 1 failed, the same test_dlt_pipeline failure, which I reproduced on clean main.
  • ruff format --check and ruff check are clean. mypy on the changed files reports no errors in them. Its only error is a [has-type] error in sqlmesh/core/config/gateway.py:41, which this PR doesn't touch, and the same mypy command reports it on clean main.

Checklist

  • I have run make style and fixed any issues (ruff, ruff-format and mypy on the changed files)
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test). I ran the affected suites listed above, not the full make fast-test.
  • My commits are signed off (git commit -s) per the DCO

🤖 Generated with Claude Code

Summary by CodeRabbit

  • User Experience
    • Plan summaries now list models needing backfill separately from models needing preview. Preview sections clarify that their data will not be reused in production, and are omitted when no models need preview.
  • Documentation
    • Updated plan examples and walkthroughs to match the separate preview and backfill sections, including examples with limited date ranges and forward-only plans.

Dev plans listed models that are only backfilled for a preview under
"Models needing backfill:" with a "(preview)" suffix, which reads as if
they need a real backfill. List them in a separate "Models needing
preview (data will NOT be reused in production):" section instead,
using the explainer's wording, in both the terminal and Markdown
consoles. Each section is printed only if it has entries.

Previews are still identified by the deployability index, so which
models count as previews doesn't change.

Closes SQLMesh#5116

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Vamsi-klu <nrvamsi13@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Plan summaries now show models needing preview separately from models needing backfill. Terminal and Markdown output, tests, and plan examples use the separate sections.

Changes: Plan Output

Layer / File(s) Summary
Separate preview sections
sqlmesh/core/console.py, tests/core/test_context.py, docs/concepts/plans.md, docs/examples/incremental_time_full_walkthrough.md, docs/examples/sqlmesh_cli_crash_course.md
Terminal and Markdown output place preview models under a separate heading that notes preview data will not be reused in production. Tests check section order, model placement, and omission of empty preview sections. The examples show the updated headings and intervals.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Low

Suggested reviewers: treysp, mday-io, sungchun12

Merge Risk: Minimal · up to f1794

This change shows models needing preview separately from models needing backfill in dev plan summaries and updates the related documentation. It affects only the text of console output, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: preview-only backfills in dev plan summaries now appear in their own section. It uses the conventional commit form and matches the PR objectives and the code changes i…
Description check Passed The description follows the template. It has a Description section that explains the problem, the new output, and the split logic, and it links issue #5116. It has a Test Plan section with specific te…
Linked Issues check Passed Issue #5116 asks that dev-preview-only backfills not appear under "Models needing backfill", and suggests a separate preview section. The diff to sqlmesh/core/console.py implements this in both consol…
Out of Scope Changes check Passed All changed areas connect to #5116. The console.py changes implement the requested section split. The tests in tests/core/test_context.py and the documentation updates in docs/concepts/plans.md, docs/…
Full details: Title check

Explanation

The title names the main change: preview-only backfills in dev plan summaries now appear in their own section. It uses the conventional commit form and matches the PR objectives and the code changes in console.py and the tests.

Full details: Description check

Explanation

The description follows the template. It has a Description section that explains the problem, the new output, and the split logic, and it links issue #5116. It has a Test Plan section with specific tests, suite results, lint and mypy results, and the reproduced failures on clean main. The checklist is present. One item is unchecked, and the author states that the full make fast-test was not run.

Full details: Linked Issues check

Explanation

Issue #5116 asks that dev-preview-only backfills not appear under "Models needing backfill", and suggests a separate preview section. The diff to sqlmesh/core/console.py implements this in both consoles. TerminalConsole._show_missing_dates (around lines 2150-2172) builds a separate preview tree with the header "Models needing preview (data will NOT be reused in production):". MarkdownConsole._show_missing_dates (around lines 3524-3562) builds separate backfill and preview lists, each with its own header. Snapshots are routed by plan.deployability_index.is_deployable(snapshot), so the preview classification is unchanged. Each section prints only when it has entries, and truncation applies per section. The new tests named in the PR description cover both consoles and the empty-preview case. The docs updates are supporting changes. No coding requirement from #5116 is unmet. I did not re-run the tests; the Pass rests on the code diff and the PR's reported test results.

Full details: Out of Scope Changes check

Explanation

All changed areas connect to #5116. The console.py changes implement the requested section split. The tests in tests/core/test_context.py and the documentation updates in docs/concepts/plans.md, docs/examples/incremental_time_full_walkthrough.md, and docs/examples/sqlmesh_cli_crash_course.md show the new output and cover the changed behavior. The MarkdownConsole change keeps both consoles consistent, as the PR states. The inspected diff contains no unrelated logic changes. The summary reports no changes outside these areas.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8c8dbf82-e6bf-4752-90e2-dff6f1477207
Commits

Reviewing files that changed from the base of the PR and between ce229ae and f1794cb.

Files selected for processing: 5

  • docs/concepts/plans.md
  • docs/examples/incremental_time_full_walkthrough.md
  • docs/examples/sqlmesh_cli_crash_course.md
  • sqlmesh/core/console.py
  • tests/core/test_context.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify preview backfills in explained plan

1 participant