Skip to content

FIX: validate horizon parameter in fit_predict, predict, and fit_predict_async tools#355

Open
Sandrakimiring wants to merge 6 commits into
sktime:mainfrom
Sandrakimiring:fix/horizon-validation-fit-predict
Open

FIX: validate horizon parameter in fit_predict, predict, and fit_predict_async tools#355
Sandrakimiring wants to merge 6 commits into
sktime:mainfrom
Sandrakimiring:fix/horizon-validation-fit-predict

Conversation

@Sandrakimiring

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #354

What does this implement/fix? Explain your changes.

Three tools accepted horizon: int but passed it through with no validation:

  • fit_predict_tool — passed bad horizon to executor silently
  • predict_toolrange(1, horizon+1) produced fh=[] when horizon≤0
  • fit_predict_async_tool — created a background job with a bad horizon

Added a guard as the first check in each function — before any executor,
asyncio, or job-manager code is reached. Values less than 1 now return:
{"success": False, "error": "horizon must be a positive integer."}

Does your contribution introduce a new dependency? If yes, which one?

No new dependencies.

What should a reviewer concentrate their feedback on?

The 3 guards in src/sktime_mcp/tools/fit_predict.py and the 9 new
tests in TestHorizonValidation in tests/test_core.py.

PR checklist

  • I've added unit tests and made sure they pass locally.

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.

[BUG] horizon parameter not validated in fit_predict, predict, and fit_predict_async tools

1 participant