Skip to content

Commit 51157ed

Browse files
gitosaurusclaude
andauthored
Fix Pydantic validator mutating caller's dict (#661)
The collect_additional_datasets model validator was modifying the input dict in-place, adding an empty 'other_datasets' key. When users reused their data_request dict (e.g., adding 'infer' after setting 'train'), the empty 'other_datasets' would cause DataProvider to fail with "No datasets were requested in data_request". Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent 2740c3e commit 51157ed

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/hyrax/config_schemas/data_request.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def normalize_dataset_configs(cls, value: Any) -> Any:
113113
def collect_additional_datasets(cls, values: dict[str, Any]) -> dict[str, Any]:
114114
"""Capture arbitrary dataset keys beyond train/validate/infer."""
115115

116+
# Copy to avoid mutating the caller's dict
117+
values = dict(values)
116118
known = {"train", "validate", "infer"}
117119
extra = {k: v for k, v in values.items() if k not in known}
118120
for key in extra:

0 commit comments

Comments
 (0)