Pushkal-Gupta commented on code in PR #71647:
URL: https://github.com/apache/airflow/pull/71647#discussion_r3836241076
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/asset_state_store.py:
##########
@@ -106,7 +107,12 @@ def _resolve_asset_id_by_uri(uri: str, session:
SessionDep) -> int:
return asset_id
[email protected]("/by-name/value")
[email protected](
+ "/by-name/value",
+ responses=create_openapi_http_exception_doc(
+ [(status.HTTP_404_NOT_FOUND, "Asset not found, or it has no value for
the key")]
+ ),
+)
Review Comment:
Good catch, and you're right — that's a real defect in the check, not just
in this file. `ROUTER_CLASSES` was `{"APIRouter", "AirflowRouter"}`, so router
inheritance silently did not apply to any Cadwyn-based execution API route.
Added `VersionedAPIRouter` and re-audited all six execution API route
modules:
| Router | Declares | Was added | Now |
|---|---|---|---|
| `asset_state_store` (Versioned) | 401, **404** | 404 ×2 | **reverted** |
| `task_state_store` (Versioned) | 401, 403, **404** | 404 | **reverted** |
| `hitl` (Versioned) | *(none)* | 409 | kept |
| `task_instances` (Versioned) | *(none)* | 500 | kept |
| `asset_events` (plain) | 401, 404 | 400 | kept |
| `xcoms` (plain) | 401, 403, 404 | 400 ×2 | kept |
So three of the fifteen were false positives. `asset_state_store.py` and
`task_state_store.py` are now byte-identical to `main`. The other twelve stand,
and no public-spec change is affected — all three reverts were execution API,
and regenerating both specs produces no diff.
Re-running the corrected check against the pre-PR tree now reports 11
violations rather than 15; with the `/ui/teams` 403 that the audit found but
the check exempts, that is the 12 declarations this PR keeps.
Added a regression test (`cadwyn-versioned-router-declares-the-status`) so
this cannot silently regress.
--
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]