Copilot commented on code in PR #760:
URL: https://github.com/apache/burr/pull/760#discussion_r3202108331


##########
burr/core/action.py:
##########
@@ -243,16 +243,12 @@ def validate_inputs(self, inputs: Optional[Dict[str, 
Any]]) -> None:
         missing_inputs = required_inputs - given_inputs
         additional_inputs = given_inputs - required_inputs - optional_inputs
         if missing_inputs or additional_inputs:
-            raise ValueError(
-                f"Inputs to function {self} are invalid. "
-                + f"Missing the following inputs: {', '.join(missing_inputs)}."
-                if missing_inputs
-                else (
-                    "" f"Additional inputs: {','.join(additional_inputs)}."
-                    if additional_inputs
-                    else ""
-                )
-            )
+            parts = [f"Inputs to function {self} are invalid."]
+            if missing_inputs:
+                parts.append(f"Missing the following inputs: {', 
'.join(missing_inputs)}.")
+            if additional_inputs:
+                parts.append(f"Additional inputs: {', 
'.join(additional_inputs)}.")

Review Comment:
   `missing_inputs` and `additional_inputs` are sets, so `', '.join(...)` 
produces a non-deterministic ordering in the error message (can vary across 
runs/Python versions). Consider sorting before joining to keep error output 
stable and easier to test/debug.
   



##########
burr/core/action.py:
##########
@@ -243,16 +243,12 @@ def validate_inputs(self, inputs: Optional[Dict[str, 
Any]]) -> None:
         missing_inputs = required_inputs - given_inputs
         additional_inputs = given_inputs - required_inputs - optional_inputs
         if missing_inputs or additional_inputs:
-            raise ValueError(
-                f"Inputs to function {self} are invalid. "
-                + f"Missing the following inputs: {', '.join(missing_inputs)}."
-                if missing_inputs
-                else (
-                    "" f"Additional inputs: {','.join(additional_inputs)}."
-                    if additional_inputs
-                    else ""
-                )
-            )
+            parts = [f"Inputs to function {self} are invalid."]
+            if missing_inputs:
+                parts.append(f"Missing the following inputs: {', 
'.join(missing_inputs)}.")
+            if additional_inputs:
+                parts.append(f"Additional inputs: {', 
'.join(additional_inputs)}.")
+            raise ValueError(" ".join(parts))

Review Comment:
   This change fixes subtle error-message construction logic, but there doesn’t 
appear to be regression test coverage for `validate_inputs()` (missing-only, 
additional-only, and both at once). Adding a unit test that asserts the prefix 
and the presence of both clauses would help prevent future 
precedence/formatting regressions.



-- 
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