Skip to content

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

Open
jthurlburt wants to merge 1 commit into
SQLMesh:mainfrom
jthurlburt:fix-min-intervals-cli-int-coercion
Open

fix(cli): coerce plan --min-intervals to int#5919
jthurlburt wants to merge 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

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>
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.

1 participant