henry3260 commented on code in PR #70138:
URL: https://github.com/apache/airflow/pull/70138#discussion_r3627954003


##########
airflow-core/src/airflow/api_fastapi/execution_api/versions/v2026_06_30.py:
##########
@@ -99,6 +99,20 @@ def remove_team_name_field(response: ResponseInfo) -> None:  
# type: ignore[misc
         if "dag_run" in response.body and isinstance(response.body["dag_run"], 
dict):
             response.body["dag_run"].pop("team_name", None)
 
+    @convert_response_to_previous_version_for(DagRun)  # type: ignore[arg-type]
+    def remove_team_name_from_dag_run(response: ResponseInfo) -> None:  # 
type: ignore[misc]
+        """Remove the ``team_name`` field from responses returning a DagRun 
directly."""
+        if isinstance(response.body, dict):
+            response.body.pop("team_name", None)
+
+    # Schema-based converters are matched against the route's response model 
by identity, so a
+    # route annotated ``DagRun | None`` never matches ``DagRun`` and has to be 
addressed by path.
+    @convert_response_to_previous_version_for("/dag-runs/previous", ["GET"])  
# type: ignore[arg-type]

Review Comment:
   > There's a third endpoint that returns a `DagRun` directly: the compat `GET 
/dag-runs/{dag_id}/previous`, kept via `only_exists_in_older_versions` for 
clients pinning older than `2026-04-06`. It has no `response_model` annotation, 
so the `DagRun` schema converter won't match it, and the path converter here 
only covers `/dag-runs/previous`, so a worker pinning e.g. `2025-11-05` still 
gets `team_name`/`partition_date` from it and hits the same `extra="forbid"` 
failure. `note`/`partition_key` (added in `2026-04-06`) look like they already 
leak there for the same reason, so this may be pre-existing rather than 
something this PR must own. Is that compat path still reachable by old clients?
   
   Yes, still reachable — 2025-08-10 through 2025-11-05, and a released SDK did 
call it (at 35d23c3222 it pinned API_VERSION = "2025-08-10" and hit that path).
   
   One correction though: it isn't a 500. That route has no return annotation, 
so response_model is None and FastAPI skips response validation — the server 
returns 200 with every field. The `extra="forbid"` failure lands on the client 
instead, when the old SDK does `PreviousDagRunResult(dag_run=resp.json())`. And 
you're right that it's pre-existing: `note, partition_key and 
triggering_user_name` already leak there today.
   
   On scope — not because it's pre-existing (so is the bug here), but because 
the two don't overlap. Both routes this PR touches were added in 2026-04-06, so 
they return 404/405 below it; the only older version they ever serve is 
2026-04-06, and the only fields added after that are the two this PR strips. 
The compat route is a disjoint set of versions and fields with a different 
failure mode, and fixing it needs a call on whether to give it a response model 
or add path converters for all five fields across four version files.



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