YAshhh29 commented on code in PR #71575:
URL: https://github.com/apache/airflow/pull/71575#discussion_r4112451514
##########
providers/common/ai/src/airflow/providers/common/ai/durable/fingerprint.py:
##########
@@ -85,9 +107,16 @@ def _strip_volatile(messages_dump: list[dict[str, Any]]) ->
list[dict[str, Any]]
timestamps, part-level timestamps); user data such as tool arguments is
never recursed into, so an argument legitimately named ``run_id`` still
affects the fingerprint.
+
+ Raises ``TypeError`` if a message did not dump to a mapping. A python-mode
dump
+ passes an object it does not recognize straight through, and a fingerprint
that
+ cannot strip the volatile fields would change on every attempt, so the
caller
+ degrades to an unverifiable ``None`` instead.
"""
stripped = []
for message in messages_dump:
+ if not isinstance(message, Mapping):
+ raise TypeError(f"expected a dumped message mapping, got
{type(message).__name__}")
cleaned = {k: v for k, v in message.items() if k not in
_VOLATILE_MESSAGE_KEYS}
if isinstance(cleaned.get("parts"), list):
Review Comment:
The json-mode dump turns the tuple back into a list, so the timestamp strip
applies again. There's a test with tuple parts and two different part
timestamps.
##########
providers/common/ai/src/airflow/providers/common/ai/durable/fingerprint.py:
##########
@@ -85,9 +107,16 @@ def _strip_volatile(messages_dump: list[dict[str, Any]]) ->
list[dict[str, Any]]
timestamps, part-level timestamps); user data such as tool arguments is
never recursed into, so an argument legitimately named ``run_id`` still
affects the fingerprint.
+
+ Raises ``TypeError`` if a message did not dump to a mapping. A python-mode
dump
+ passes an object it does not recognize straight through, and a fingerprint
that
Review Comment:
Dropped the guard and the test. With the json-mode dump every message comes
back as a mapping, and as you said, that input couldn't occur anyway.
##########
providers/common/ai/docs/durable_execution.rst:
##########
@@ -102,6 +102,30 @@ cache:
never replays responses that belong to a different conversation.
4. After successful completion, the cached steps are deleted.
+Fingerprints are computed from each value's canonical form, so ordinary types
that
Review Comment:
Updated. The paragraph now says fingerprints use pydantic's JSON rendering
and that older entries still match, the run-wide causes include the tool
definitions the request carries, and the `BinaryContent` note mentions the
cascade when the re-run returns something different.
--
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]