Skip to content

fix(cli): coerce plan --min-intervals to int - #5919

Merged
StuffbyYuki merged 1 commit into
SQLMesh:mainfrom
jthurlburt:fix-min-intervals-cli-int-coercion
Jul 30, 2026
Merged

fix(cli): coerce plan --min-intervals to int#5919
StuffbyYuki merged 1 commit into
SQLMesh:mainfrom
jthurlburt:fix-min-intervals-cli-int-coercion

Conversation

@jthurlburt

@jthurlburt jthurlburt commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

Why. plan --min-intervals is a click option with no type, so the raw string is passed through Context.plan() to range(min_intervals) in _calculate_start_override_per_model, raising TypeError: 'str' object cannot be interpreted as an integer. Any CLI plan that passes --min-intervals and produces backfill work crashes.

What. Add type=int to the option. Valid values backfill as intended; a non-integer now produces a standard click usage error (Error: Invalid value for '--min-intervals': 'abc' is not a valid integer.) instead of a traceback. One-line fix plus a regression test.

Test Plan

  • New tests/cli/test_cli.py::test_plan_min_intervals — builds prod, edits a model to force a dev backfill, then asserts plan dev --min-intervals 1 exits 0 and plan dev --min-intervals abc exits 2 with the click error. Verified it fails without the fix (TypeError) and passes with it by reverting type=int.
  • Reproduced the original crash on a clean checkout (duckdb example) before applying the fix.
  • make style: ruff, ruff-format, mypy, valid-migrations all pass (prettier/eslint skipped — UI only, unrelated).

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) — see Test Plan note
  • My commits are signed off (git commit -s) per the DCO

@jthurlburt
jthurlburt force-pushed the fix-min-intervals-cli-int-coercion branch 2 times, most recently from 2d9f6d6 to f3cf063 Compare July 27, 2026 16:36
The plan --min-intervals option had no type, so click passed the raw
string through to Context.plan(). It reached range(min_intervals) in
_calculate_start_override_per_model and raised:

    TypeError: 'str' object cannot be interpreted as an integer

Add type=int; a non-integer value now yields a clean click usage error
instead of a traceback.

Signed-off-by: jthurlburt <jthurlburt818@gmail.com>
@StuffbyYuki
StuffbyYuki force-pushed the fix-min-intervals-cli-int-coercion branch from f3cf063 to 4faf8e3 Compare July 28, 2026 05:37
@StuffbyYuki
StuffbyYuki merged commit e4b4867 into SQLMesh:main Jul 30, 2026
32 checks passed
@jthurlburt
jthurlburt deleted the fix-min-intervals-cli-int-coercion branch July 30, 2026 14:04
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