kaxil commented on code in PR #65222:
URL: https://github.com/apache/airflow/pull/65222#discussion_r3083393324
##########
airflow-core/src/airflow/serialization/definitions/notset.py:
##########
@@ -31,6 +31,12 @@
class ArgNotSet:
"""Sentinel type for annotations, useful when None is not viable."""
Review Comment:
The actual leak path is `serialize_template_field` in `helpers.py` (line
84), which falls back to `str()` when it encounters an object that's not
JSON-serializable and has no `serialize()` method. `SetDuringExecution` already
handles this by defining a `serialize()` method (returned at line 78). Adding
`serialize()` to `ArgNotSet` would follow that same pattern and fix the
template-field path without changing `__repr__` (which affects
`SetDuringExecution` via inheritance and all debugging output). Something like:
```python
@staticmethod
def serialize() -> str:
return "NOTSET"
```
That said, `__repr__`/`__str__` is still a reasonable defense-in-depth
measure for any future code paths that might call `str()` on `ArgNotSet`.
##########
airflow-core/src/airflow/serialization/definitions/notset.py:
##########
@@ -31,6 +31,12 @@
class ArgNotSet:
"""Sentinel type for annotations, useful when None is not viable."""
+ def __repr__(self) -> str:
+ return "NOTSET"
+
Review Comment:
`SetDuringExecution(ArgNotSet)` in
`task-sdk/src/airflow/sdk/definitions/_internal/types.py` inherits these
methods. Its `repr()` would now return `"NOTSET"` instead of something that
indicates "set during execution" semantics. That's confusing when debugging.
Consider overriding `__repr__` on `SetDuringExecution` too, or using a
different approach.
--
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]