The GitHub Actions job "Build Burr" on 
burr.git/fix/validate-inputs-error-message has succeeded.
Run started by GitHub user dashitongzhi (triggered by skrawcz).

Head commit for run:
7b52e7215d62e56424ddef2d2c2123c6e34ac4cc / Cao Hanzhe 
<[email protected]>
fix: correct validate_inputs error message when both missing and additional 
inputs exist

In burr/core/action.py, the validate_inputs() method had a bug in its
error message construction due to operator precedence in a nested ternary
expression.

The original code:
    raise ValueError(
        f"Inputs to function {self} are invalid. "
        + f"Missing the following inputs: ..."
        if missing_inputs
        else (...)
    )

Due to Python operator precedence, the ternary 'if' binds lower than '+',
so the whole expression is evaluated as:
    (str1 + str2) if missing_inputs else (str3 if additional_inputs else "")

This means when BOTH missing_inputs and additional_inputs are non-empty,
the error message only reports the missing inputs and silently drops info
about the additional inputs. Similarly, when only additional_inputs exist,
the 'Inputs to function ... are invalid' prefix is omitted.

Fixed by building error message parts independently:
- Always include the 'Inputs to function ... are invalid' prefix
- Conditionally append missing inputs info
- Conditionally append additional inputs info
- Join all parts with spaces

This ensures all relevant validation errors are reported regardless of
which combination of issues exist.

Report URL: https://github.com/apache/burr/actions/runs/25500966659

With regards,
GitHub Actions via GitBox

Reply via email to