Skip to content

fix: reject more than one static row in predict requests - #139

Open
abhinav-phi wants to merge 1 commit into
sktime:mainfrom
abhinav-phi:validate-static-rows
Open

abhinav-phi wants to merge 1 commit into
sktime:mainfrom
abhinav-phi:validate-static-rows

Conversation

@abhinav-phi

Copy link
Copy Markdown

Fixes #138

static features are broadcast over every time step, but neither
PredictRequest nor CoercedPredictRequest checked the row count. A request
with static={"store": ["urban", "rural"]} passed validation and the sktime
converter kept row 0, dropping the rest silently.

  • PredictRequest now rejects a static table without exactly one row, for the
    column dict, the {columns, data} matrix and the pandas/polars/pyarrow/
    narwhals shapes (via _check_static_rows in types/_checks.py).
  • CoercedPredictRequest gets the same check on the narwhals frame.
  • _static() keeps its existing empty-frame error.

Tests in src/tserve/types/tests/test_models.py:

before: 3 failed, 32 passed
after:  35 passed

The failing cases are static_multi_row_column_dict, static_multi_row_matrix
and static_multi_row; test_single_row_static_is_accepted covers the valid
path.

PredictRequest and CoercedPredictRequest accepted a static table with several rows and the sktime converter silently kept the first one. Require exactly one row in both models and cover the column dict, row matrix and narwhals cases in the model tests.

This branch has not been deployed

No deployments
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] Multi-row static tables are accepted without validation and silently drop all rows after the first

1 participant