dheerajturaga opened a new pull request, #75339:
URL: https://github.com/apache/airflow/pull/75339

   Part of [AIP-125 (Inbound 
Webhooks)](https://lists.apache.org/thread/p3dpnor4zwko8tldpncj6ftj1bpp18q7), 
which lets external services such as GitHub trigger Dags by sending webhooks to 
Airflow.
   
   This is part of Phase 2 (webhook waits and asset routes). It targets Airflow 
3.5 if it merges before the 3.5 freeze, and 3.6 otherwise, and its migration is 
stamped 3.5.0. It may merge ahead of the waits that use it ({{PR-25}} to 
{{PR-28}}, which merge together); if they miss the freeze, this PR is reverted 
or restamped for 3.6.
   
   Webhook waits let a running task park in `awaiting_input` until a verified 
delivery that matches it arrives. This adds the `inbound_wait` table and the 
match rules on their own, before anything writes a wait, so the migration and 
the grammar can be reviewed without the concurrency of the resume path. The 
register-wait route ({{PR-25}}) is the first to write to the table.
   
   - A wait belongs to its task instance attempt: deleting the task instance or 
cleaning it with `airflow db clean` removes or archives its waits, and clearing 
keeps them with the archived attempt. `airflow db clean` ages waits on their 
deadline and applies `--dag-ids` and `--exclude-dag-ids` through the task 
instance. A wait's `delivery_id` names the `inbound_delivery` row that resumed 
it but is not a foreign key, as deliveries are cleaned on their own retention, 
which can end before the wait's.
   - `open` is true or null, never false, so the unique constraint on webhook, 
match digest and `open` allows one open wait per webhook and canonical key, and 
a closed wait frees the key for a retry of the same task.
   - Every delivery looks up the open waits of its webhook by the key sets its 
attributes cover, so the table is indexed on webhook, `open` and key digest. 
The same migration indexes `inbound_delivery` on webhook, outcome and received 
time, for finding a webhook's early deliveries.
   - There is no team column, as webhooks have no team in 3.5.
   
   `airflow.webhooks.waits` holds the match grammar as pure functions, so the 
register route, the delivery pipeline, the park-time check and the timeout 
sweep apply one rule: an events filter plus equality on declared attributes, 
values compared as strings, a list meaning any of its values, and mappings 
refused as reserved for operators. A failed match names the first failing key 
with the expected and actual values. The resume event is normalized to JSON and 
the keys serde reserves are escaped, so a payload key such as `__id__` arrives 
as `___id__` rather than failing the task when it resumes.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


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