eugenegujing opened a new pull request, #7570:
URL: https://github.com/apache/texera/pull/7570

   ### What changes were proposed in this PR?
   
   When a user sets a non-integer `BATCH_SIZE` on a Python `BatchOperator`, the 
validation error they get back is the template text itself:
   
   ```
   BATCH_SIZE cannot be {type(value))}.
   ```
   
   The string literal in `BatchOperator._validate_batch_size` 
(`amber/src/main/python/core/models/operator.py`) is missing the `f` prefix, so 
`{type(value)}` is never interpolated and it additionally contains a stray `)` 
inside the braces. The type of the supplied value is exactly the piece of 
information the message is meant to convey, so as written the error tells the 
user nothing about what they did wrong.
   
   This PR corrects both defects in one line:
   
   ```python
   raise ValueError(f"BATCH_SIZE cannot be {type(value)}.")
   ```
   
   so the user now sees, e.g., `BATCH_SIZE cannot be <class 'float'>.` The 
wording is kept consistent with the sibling messages in the same validator 
(`BATCH_SIZE cannot be None.`).
   
   ### Any related issues, documentation, discussions?
   
   Closes #7565
   
   ### How was this PR tested?
   
   Three tests were added to the existing `TestBatchOperatorValidation` class 
in `amber/src/test/python/core/models/test_operator.py`, pinning the exact 
message by string equality:
   
   - `_validate_batch_size(10.0)` raises `ValueError` with message `BATCH_SIZE 
cannot be <class 'float'>.`
   - `_validate_batch_size("10")` raises `ValueError` with message `BATCH_SIZE 
cannot be <class 'str'>.`
   - constructing a concrete `BatchOperator` subclass with `BATCH_SIZE = 10.0` 
raises the same float message end-to-end.
   
   Full run: `cd amber && pytest src/test/python/core/models/test_operator.py` 
— 32 passed. `ruff check` and `ruff format --check` pass on `src/main/python` 
and `src/test/python` (the same commands CI runs).
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Co-authred by: Claude Code (Claude Fable 5)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to