rosemarYuan commented on code in PR #756:
URL: https://github.com/apache/flink-agents/pull/756#discussion_r3361315282


##########
python/flink_agents/plan/actions/action.py:
##########
@@ -71,7 +81,13 @@ def __serialize_config(self, config: Dict[str, Any]) -> 
Dict[str, Any] | None:
 
     @model_validator(mode="before")
     def __custom_deserialize(self) -> "Action":
-        config = self["config"]
+        # Legacy fallback: listen_event_types → trigger_conditions
+        if "trigger_conditions" not in self or self.get("trigger_conditions") 
is None:
+            if self.get("listen_event_types"):
+                self["trigger_conditions"] = list(self["listen_event_types"])
+            self.pop("listen_event_types", None)

Review Comment:
   Same idea on the Python side. While adding the test I found that the custom 
__init__ was rejecting the old key before model_validator(mode="before") had a 
chance to rename it — so the fallback was silently broken. Fixed __init__ to 
accept **kwargs and handle the legacy key, and added a matching deserialization 
test.



##########
api/src/test/java/org/apache/flink/agents/api/EventTypeTest.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.agents.api;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/** Tests for {@link EventType}. */
+class EventTypeTest {
+
+    @Test
+    void builtInConstantsAreNonNull() {

Review Comment:
   You're right — assertNotNull on inlined constants is vacuous. Originally 
addressed in a follow-up PR; now pulled forward into this commit with 
assertEquals(InputEvent.EVENT_TYPE, EventType.InputEvent) and similar for all 8 
built-ins.



##########
python/flink_agents/api/tests/test_event_type.py:
##########
@@ -0,0 +1,38 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+#################################################################################
+"""Smoke tests for :mod:`flink_agents.api.events.event_type`."""
+
+from __future__ import annotations
+
+from flink_agents.api.events.event_type import EventType
+
+
+def test_builtin_constants_are_non_empty_strings() -> None:

Review Comment:
   Mirrors the Java fix — the Python test now asserts EventType.InputEvent == 
InputEvent.EVENT_TYPE directly for all 8 constants. Consistent shape across 
both languages.



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