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

   `DateTimeSensorAsync.__init__` computes 
`start_trigger_args.trigger_kwargs["moment"]` by calling
   `timezone.parse(self.target_time)` at Dag-parse time, before Jinja 
templating has run. `target_time`
   is a documented template field (e.g. `"{{ 
data_interval_end.tomorrow().replace(hour=1) }}"`), so a
   templated value raises a raw `pendulum.parsing.exceptions.ParserError` 
there, crashing parsing of the
   entire Dag file, not just the one task.
   
   This can't be fixed by moving the parse into `execute()`: when 
`start_from_trigger=True`, the scheduler
   defers the task straight from `TaskInstance.defer_task()` using the 
pre-computed `self.task.start_trigger_args`
   — `execute()` never runs for this path. So the value genuinely has to be 
resolved in `__init__`, the same
   constraint `TimeSensor` hit in #69610.
   
   Fix: catch the parse failure and raise a clear `ValueError` explaining that 
`start_from_trigger=True`
   requires a static `target_time`, instead of letting the raw `ParserError` 
propagate and take down the
   whole Dag file. Static/ISO `target_time` values are unaffected and keep 
working exactly as before.
   
   Added tests covering both the static-time (still works) and templated-time 
(now raises a clear,
   task-scoped error instead of crashing Dag parsing) cases.
   
   closes: #70284
   Related: #69610
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code
   
   Generated-by: Claude Code following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions).
 I identified the root cause, wrote the fix and tests, ran `ruff check`, `ruff 
format --check`, `mypy`, and the full test file locally (12 passed), and 
verified the fix against the original repro before submitting.


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