potiuk commented on code in PR #72287:
URL: https://github.com/apache/airflow/pull/72287#discussion_r4077023485


##########
providers/http/tests/unit/http/triggers/test_http.py:
##########
@@ -388,3 +390,71 @@ async def test_trigger_on_post_with_data(
         assert kwargs["data"] == TEST_DATA
         assert kwargs["json"] is None
         assert kwargs["params"] is None
+
+    @pytest.mark.asyncio
+    @pytest.mark.parametrize(
+        "check",
+        [
+            pytest.param(
+                lambda resp: resp == "ok",

Review Comment:
   **Blocking:** these are sync `lambda`s, so `_run_response_check` raises 
before it gets to the signature check, and all six cases fail:
   
   ```
   providers/http/src/airflow/providers/http/triggers/http.py:398: in 
_run_response_check
   E   AirflowException: The response_check callable is not asynchronous.
   ```
   
   Module-level `async def` helpers, parametrized by reference, fix it. They 
also replace the `eval(...)` below, since positional-only parameters are 
ordinary syntax:
   
   ```python
   async def _positional_only(resp, asset_state_store="default_val", /):
       return resp == "ok" and asset_state_store == "default_val"
   ```
   



##########
providers/http/docs/triggers.rst:
##########
@@ -108,10 +113,10 @@ Here's an example of using the ``HttpEventTrigger`` in an 
``AssetWatcher`` to mo
     @dag(start_date=datetime.datetime(2024, 10, 1), schedule=asset, 
catchup=False)
     def check_airflow_releases():
         @task()

Review Comment:
   **Major:** `context["asset_state_store"]` is only populated for tasks with 
concrete inlets or outlets (`task_runner.py:350`), and `schedule=asset` doesn't 
count. As written, `store` is always `None` here and the task prints `Unknown 
has been released`. Declaring the asset as an inlet fixes it:
   
   ```suggestion
           @task(inlets=[asset])
   ```
   



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