henry3260 commented on code in PR #70138: URL: https://github.com/apache/airflow/pull/70138#discussion_r3757973400
########## airflow-core/tests/unit/api_fastapi/execution_api/versions/v2026_06_30/test_dag_runs.py: ########## @@ -0,0 +1,88 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from __future__ import annotations + +import pytest + +from airflow._shared.timezones import timezone +from airflow.utils.state import DagRunState + +pytestmark = pytest.mark.db_test + +ADDED_IN_2026_06_30 = frozenset({"team_name", "partition_date"}) + + [email protected] +def old_ver_client(client): + """Last released execution API before ``team_name`` and ``partition_date`` were added.""" + client.headers["Airflow-API-Version"] = "2026-04-06" + return client + + [email protected] +def dag_runs(session, dag_maker): + with dag_maker(dag_id="test_dag_run_fields", session=session, serialized=True): + pass + dag_maker.create_dagrun( + state=DagRunState.SUCCESS, + logical_date=timezone.datetime(2025, 1, 1), + run_id="run1", + ) + dag_maker.create_dagrun( + state=DagRunState.SUCCESS, + logical_date=timezone.datetime(2025, 1, 10), + run_id="run2", + ) + session.commit() Review Comment: > Neither fixture run sets `partition_date`, so both fields are `None` here and a value-gated converter (pop only when the value is falsy) would pass all three tests while still 500-ing a 2026-04-06 client on a partitioned Dag. `partition_date` is a real column, so setting it on one run before the commit closes that gap, the same way `test_old_version_strips_partition_date_from_dag_run` does in the sibling `test_task_instances.py`. > > Worth noting `team_name` can't be exercised here at all -- it isn't a `DagRun` column, just a transient attribute the TIRunContext route assigns, so on these two routes it is always `None`. Applied! -- 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]
