wzhero1 commented on code in PR #827:
URL: https://github.com/apache/flink-agents/pull/827#discussion_r3385389174


##########
python/flink_agents/api/function.py:
##########
@@ -29,6 +29,13 @@
 
 from pydantic import BaseModel, model_serializer
 
+#: Java parameter types of an action method. Action signatures are fixed
+#: ``(Event, RunnerContext)``, so callers never have to spell them out.
+ACTION_PARAMETER_TYPES: List[str] = [

Review Comment:
   Nit: this constant is never meant to be mutated — a `tuple` makes the 
contract enforceable at the language level:
   
   ```python
   ACTION_PARAMETER_TYPES: Tuple[str, ...] = (
       "org.apache.flink.agents.api.Event",
       "org.apache.flink.agents.api.context.RunnerContext",
   )
   ```
   
   `for_action()` already defensively copies with `list(...)`, and pydantic v2 
coerces sequences into `List[str]` on model creation, so all existing call 
sites (including the YAML loader at `_resolve_action_function`) would work 
unchanged. The only difference is that a stray `.append()` or `[0] = ...` would 
raise `TypeError` instead of silently corrupting every downstream caller in the 
process.



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