kaxil commented on code in PR #74421:
URL: https://github.com/apache/airflow/pull/74421#discussion_r4540106658


##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -163,8 +163,23 @@ def _wrap_external_ref(ref: str) -> dict[str, JsonValue]:
     return {_EXTERNAL_STATE_REF_KEY: ref}
 
 
-def _unwrap_external_ref(stored: dict) -> str | None:
-    return stored.get(_EXTERNAL_STATE_REF_KEY)
+def _unwrap_external_ref(stored: JsonValue) -> str | None:
+    """Return the reference inside a ``{marker: ref}`` wrapper, or ``None`` 
for any other value."""
+    if isinstance(stored, dict) and stored.keys() == {_EXTERNAL_STATE_REF_KEY}:
+        ref = stored[_EXTERNAL_STATE_REF_KEY]
+        if isinstance(ref, str):
+            return ref
+    return None
+
+
+def _validate_state_store_value(value: JsonValue) -> None:
+    if value is None:
+        raise ValueError("Cannot set value as None")
+    # get() would read such a value back as a backend reference

Review Comment:
   What would older mean though?



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