Fix batch_func validation for invalid output coords#890
Conversation
Greptile SummaryFixes a silent pass-through in
|
| Filename | Overview |
|---|---|
| earth2studio/models/batch.py | Single-character logic fix: and → or in the batch-dimension guard, so a valid input_coords paired with an invalid output_coords now correctly raises ValueError instead of falling through to a KeyError later. |
| test/models/test_batch.py | Adds test_invalid_output_coords_raise — a focused regression test for the exact bug scenario where input_coords starts with "batch" but output_coords removes it, ensuring the ValueError is raised at compress time. |
Reviews (1): Last reviewed commit: "Fix batch guard for invalid output coord..." | Re-trigger Greptile
Closes #889
Description
output_coordsearlier inbatch_func._compress_batchbatchWhy
The existing guard only raised when both
input_coordsandoutput_coordswere invalid. Ifinput_coordswas valid butoutput_coordswas not, the call got past the compatibility check and later failed in_decompress_batchwithKeyError: 'batch'instead of the intended earlyValueError.\n\n## Impact\nThis makes the batching path fail fast with the compatibility error for misconfigured models and keeps the failure mode predictable.\n\n## Validation\n-uv run pytest 'test/models/test_batch.py::test_invalid_output_coords_raise' 'test/models/test_batch.py::test_invalid_ordering_raises[cpu]'\n-uv run ruff check earth2studio/models/batch.py test/models/test_batch.py