Skip to content

[bugfix] Give a usage error for out of range --frame-window and save-images size options - #610

Merged
Breakthrough merged 2 commits into
Breakthrough:mainfrom
EnesSoydan:fix/cli-option-ranges
Nov 17, 2026
Merged

Breakthrough merged 2 commits into
Breakthrough:mainfrom
EnesSoydan:fix/cli-option-ranges

Conversation

@EnesSoydan

Copy link
Copy Markdown
Contributor

Fixes #609

detect-adaptive -f/--frame-window and save-images -n/--num-images, -s/--scale, -H/--height and -W/--width accepted any value, and values the code can't use ended in a traceback. The config file had the same gap.

This makes these keys RangeValues in CONFIG_MAP and uses _click_range for the CLI options, like min-images, max-images and compression:

  • frame-window and num-images: at least 1
  • scale, height, width: at least 0, since 0 already means not set

A bad value now gives a usage error on the command line and a config load error in a config file. Valid values and defaults don't change, and the generated CLI docs are the same.

Tests: test_cli_option_out_of_range and test_cli_config_file_option_out_of_range in tests/test_cli.py. ruff check, ruff format and pyright pass. The full suite passes apart from test_write_scene_list_ffmetadata_ffmpeg_roundtrip, which fails the same way on main on my machine (Windows, no ffmpeg on PATH).

@Breakthrough

Copy link
Copy Markdown
Owner

LGTM, thank you for finding this!

We should probably take a look to see if there are other related issues for similar asserts.

@Breakthrough Breakthrough added this to the 0.8 milestone Nov 17, 2026
@Breakthrough
Breakthrough merged commit e6987e1 into Breakthrough:main Nov 17, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

detect-adaptive --frame-window and save-images -n/-s/-H/-W crash with a traceback on out of range values

2 participants