kaxil commented on code in PR #74592:
URL: https://github.com/apache/airflow/pull/74592#discussion_r4250047356


##########
airflow-core/tests/unit/jobs/test_scheduler_job.py:
##########
@@ -5957,6 +5957,49 @@ def test_verify_integrity_if_dag_changed(self, 
dag_maker):
         session.rollback()
         session.close()
 
+    @pytest.mark.parametrize("upstream_state", [State.RUNNING, State.DEFERRED])

Review Comment:
   `RUNNING` and `DEFERRED` are both in `State.unfinished`, so the two cases go 
through the same path, and the state that matters here is the downstream TI's, 
which is `None` in both. Nothing checks the other side of the predicate either: 
if the `WHERE` matched every TI in the run, both cases would still pass. Could 
this drop the parametrize and add a finished TI (say a `SUCCESS` sibling) that 
asserts it keeps `original_version_id`?



##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -3382,7 +3382,7 @@ def _verify_integrity_if_dag_changed(self, dag_run: 
DagRun, session: Session) ->
             .where(
                 TI.dag_id == dag_run.dag_id,
                 TI.run_id == dag_run.run_id,
-                TI.state.in_(State.unfinished),
+                or_(TI.state.in_(State.unfinished), TI.state.is_(None)),

Review Comment:
   This looks like a regression from #60956, which replaced the Python loop 
(`if ti.state in State.unfinished`) with this bulk `UPDATE`. The `in` check 
matched `None`; SQL `IN (..., NULL)` never matches a NULL row. So 3.2.0 through 
3.3.2 all have it. Should this go on 3.3.3 too? The `State.unfinished` filter 
at L3261 and the two in `taskinstance.py` already OR in `is_(None)`.



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