Vamsi-klu opened a new pull request, #69745: URL: https://github.com/apache/airflow/pull/69745
## Problem CloudComposerDAGRunSensor and CloudComposerExternalTaskSensor (plus their deferrable triggers) returned True even when zero runs existed inside execution_range. Repro: - API returns [run_from_last_week] - Window is yesterday (execution_range=[2024-05-22 17:00, 2024-05-22 20:00]) - len(dag_runs) != 0 passes - Loop finds no run inside window, for loop exits, returns True (bug) Result: downstream tasks run with missing data — silent data loss, highest severity. Same bug existed in 4 duplicated methods: - CloudComposerDAGRunSensor._check_dag_runs_states - CloudComposerExternalTaskSensor._check_task_instances_states - CloudComposerDAGRunTrigger._check_dag_runs_states - CloudComposerExternalTaskTrigger._check_task_instances_states This is a re-attempt of #61046 which was reverted in #61346 due to system test regression. Previous fix covered only 1 sensor; this covers all 4. ## What I did Introduced found_runs_in_window / found_task_instances_in_window flag: - If no run inside window → returns False (wait), not True - If run inside window with bad state → False - If run inside window all good → True - Keeps strict < boundary semantics, no breaking change to interval interpretation Fix applied to 4 locations in sensors and triggers. ## Impact - Fixes data loss: Sensor now correctly waits when no runs in window instead of silently succeeding - Consistent behavior: All 4 sensor/trigger variants fixed - No API change: Same method signatures, same return type - System test note: Previous revert (#61346) reported infinite waiting loop for airflow_monitoring dag. Correct behavior is to wait; if monitoring dag isn't running, sensor should wait, not succeed with missing data. ## Testing Existing tests: ``` uv run --project providers-google pytest providers/google/tests/unit/google/cloud/sensors/test_cloud_composer.py -k TestCloudComposerDAGRunSensor -xvs → 20 passed uv run --project providers-google pytest providers/google/tests/unit/google/cloud/sensors/test_cloud_composer.py -xvs → 34 passed ``` Manual reproduction (watch-it-fail): - Outside window 2024-05-10 run with window 2024-05-22 to 2024-05-23 → False (was incorrectly True) - Inside window success → True - Inside window failed → False - Mixed inside/outside: only inside counts Edge cases: - Empty list [] → False - All outside window → False - Boundary exclusive (< not <=) preserved - Version <3 vs >=3 handled Static checks: ruff format/check passed, prek pre-commit passed, no new AirflowException. Closes: #57512 Related: #61046, #61346 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Muse Spark 1.1 Generated-by: Muse Spark 1.1 following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
