CodeTrainerMan opened a new issue, #1156:
URL: https://github.com/apache/flink-agents/issues/1156

   ### Description
   
   `ContextRetrievalRequestEvent` does not validate `max_results`:
   
   * Java: 
`api/src/main/java/org/apache/flink/agents/api/event/ContextRetrievalRequestEvent.java`
 (3-arg constructor, L40-45)
   * Python: `python/flink_agents/api/events/context_retrieval_event.py` 
(`__init__`, L45-54)
   
   Both constructors accept `0` and negative values and store them as-is.
   
   ### Impact
   
   `max_results` is passed straight into `VectorStoreQuery` by 
`ContextRetrievalAction`:
   
   * 
`plan/src/main/java/org/apache/flink/agents/plan/actions/ContextRetrievalAction.java`
 (L71-74)
   * the Python counterpart in 
`python/flink_agents/plan/actions/context_retrieval_action.py`
   
   Since #1144 made `VectorStoreQuery` reject a non-positive `limit`, an 
illegal `max_results`
   now fails **inside the action at runtime**, far away from where the user 
actually built the
   event. The event is also serialized and exchanged between the Java and 
Python runtimes, so
   an invalid value can cross the language boundary before it blows up.
   
   Validating at construction time fails fast and reports the parameter that is 
actually wrong.
   
   ### Proposed change
   
   Reject `max_results <= 0` in both constructors:
   
   * Java: `IllegalArgumentException`, naming the parameter and its value, 
consistent with #1144
   * Python: `ValueError` (this event is a plain class, not a pydantic model)
   
   Add unit tests on both sides.
   
   ### Related
   
   * #1144 - Reject null and non-positive limit in VectorStoreQuery
   


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