fix(cli): coerce plan --min-intervals to int#5919
Open
jthurlburt wants to merge 1 commit into
Open
Conversation
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>
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.
plan --min-intervalsis a click option with notype, so the raw string is passed throughContext.plan()torange(min_intervals)in_calculate_start_override_per_model, raisingTypeError: 'str' object cannot be interpreted as an integer. Any CLIplanthat passes--min-intervalsand produces backfill work crashes.What. Add
type=intto 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
tests/cli/test_cli.py::test_plan_min_intervals— builds prod, edits a model to force a dev backfill, then assertsplan dev --min-intervals 1exits 0 andplan dev --min-intervals abcexits 2 with the click error. Verified it fails without the fix (TypeError) and passes with it by revertingtype=int.make style:ruff,ruff-format,mypy, valid-migrations all pass (prettier/eslintskipped — UI only, unrelated).Checklist
make styleand fixed any issuesmake fast-test) — see Test Plan notegit commit -s) per the DCO