aeroyorch commented on PR #68414:
URL: https://github.com/apache/airflow/pull/68414#issuecomment-4900899587

   > Verified against current `main` (`queues/kafka.py`, 
`triggers/await_message.py`) — the required-for-queue / optional-for-sensor 
split, the `None` → `message.value().decode("utf-8")` fallback, and 
message-as-last-positional-arg all check out.
   > 
   > One wording nit on the return contract, since that's exactly what this new 
section documents: the trigger gates on a truthy check (`if event:`), not `is 
not None`. So a function that returns a falsy-but-valid value (`0`, `0.0`, 
`""`, `[]`, `{}`, `False`) is treated as "no match" and polling continues, same 
as returning `None`. A predicate written straight from the example above — 
`return val["amount"] > threshold` — would silently never fire when it 
evaluates to `False`. The "returns any data" phrasing is inherited from the 
existing trigger docstring / `sensors.rst`, so it's a pre-existing ambiguity, 
but since this section is specifically about the return contract it's worth 
making precise here.
   > 
   > Suggested inline edit on the line _"If it returns any data, the returned 
value is used as the payload of the `TriggerEvent`. Otherwise the trigger 
continues polling."_:
   > 
   > > If it returns a truthy value, that value is used as the payload of the 
`TriggerEvent`. If it returns a falsy value (`None`, `0`, `False`, `""`, `[]`, 
...), the trigger keeps polling.
   
   thanks, you're right. Review implemented :)


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