Skip to content

allow for configuring pr preview default start and min intervals separately#5824

Open
gjesse wants to merge 3 commits into
SQLMesh:mainfrom
gjesse:be-better-about-previewing
Open

allow for configuring pr preview default start and min intervals separately#5824
gjesse wants to merge 3 commits into
SQLMesh:mainfrom
gjesse:be-better-about-previewing

Conversation

@gjesse

@gjesse gjesse commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

This updates SQLMesh PR preview planning so forward-only preview intervals can be controlled independently from the regular PR backfill window.

The GitHub bot now supports separate preview defaults for forward-only changes, allowing PR environments to keep broad default backfills where needed without forcing large preview builds for massive forward-only models.

This also fixes a related planning issue where preview fallback dates could accidentally constrain explicitly selected non-preview backfills when preview models were present. Explicit backfill_models selections now keep their normal model-derived interval behavior, while preview fallback starts are only applied when SQLMesh is implicitly selecting the backfill scope.

Changes

  • Add GitHub bot config for forward-only PR preview windows:
    • default_pr_preview_start
    • pr_preview_min_intervals
  • Pass preview-specific options through PR planning.
  • Ensure forward-only previews can be capped independently from default_pr_start.
  • Do not bind explicit non-preview backfills to short preview intervals when preview models are present.
  • Cover both forward-only and non-forward-only preview paths with regression tests.

Validation

  • Added focused unit coverage for the new planner behavior
  • Added GitHub bot config/controller test coverage
  • Ran targeted pytest and ruff checks

Checklist

  • I have run make style and fixed any issues
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test)
  • My commits are signed off (git commit -s) per the DCO

Signed-off-by: Jesse Hodges <hodges.jesse@gmail.com>
@gjesse gjesse changed the title Be better about previewing allow for configuring pr preview default start and min intervals separately Jun 2, 2026
@gjesse

gjesse commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator Author

I am adding to this to also fix #5789, as they are very closely related

Signed-off-by: Jesse Hodges <hodges.jesse@gmail.com>
@gjesse gjesse force-pushed the be-better-about-previewing branch from 8b75757 to efa54fa Compare June 2, 2026 13:36
@StuffbyYuki

Copy link
Copy Markdown
Collaborator

@gjesse Thank for the PR! A couple of things:

  • For skip_pr_backfill=False shoud affect implicit default_pr_start calculation #5789: when skip_pr_backfill=False, default_pr_start=None, and there's a forward-only preview, this still sets plan start to preview_start ("yesterday") for implicit selection (backfill_models is None).

    That caps regular backfills to 1 day even though previews are already bounded separately via _forward_only_preview_start().

    Before this PR, implicit start was default_start or yesterday, so model-derived start from prod was used when available. Now it's always preview_start ("yesterday" by default from the bot).

    Since previews no longer need plan start, should we stop promoting preview_start to _start here? For example:

    • don't set _start from preview_start for forward-only previews at all, or
    • only do it when skip_backfill=True, and when skip_backfill=False use default_start / model-derived intervals for backfills
  • Could we add a test for the skip_pr_backfill=False shoud affect implicit default_pr_start calculation #5789 scenario?

    • backfill_models=None (implicit selection)
    • skip_backfill=False
    • no explicit start / default_pr_start=None
    • forward-only preview model present

@gjesse

gjesse commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

@gjesse Thank for the PR!

glad to help! great catch on that one ;)

@StuffbyYuki

StuffbyYuki commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

@gjesse Can you look into cicd-tests-windows and style-and-cicd-tests? You can ignore test-dbt-versions. Also DCO checks are missing

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.

2 participants