Skip to content

UI: Fix grid columns vanishing when a Dag version has been cleaned - #73514

Open
Eason09053360 wants to merge 1 commit into
apache:mainfrom
Eason09053360:fix-grid-ti-summaries-missing-serdag
Open

Eason09053360 wants to merge 1 commit into
apache:mainfrom
Eason09053360:fix-grid-ti-summaries-missing-serdag

Conversation

@Eason09053360

Copy link
Copy Markdown
Contributor

Why

_get_serdag returns SerializedDAG | None, but the caller guarded it with if TYPE_CHECKING: assert serdag, which never runs. After airflow db clean removes a version's serialized Dag row, the AttributeError fires inside the StreamingResponse generator once the 200 is already sent: the client gets a silently truncated NDJSON body and loses every run queued behind the failing one. This was a real raise HTTPException(404) until #52302.

What

  • routes/ui/grid.py: an unresolvable version now falls through to the flat-node path already used for tasks missing from the current structure. A 404 is no longer possible mid-stream, and skipping the run would hide task instances that still exist.
  • That log drops from error to warning, matching models/taskinstance.py. It still fires per affected run per auto-refresh — happy to dedupe per request if preferred.
  • Two tests in test_grid.py; both fail without the fix.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

`_get_serdag` is declared `SerializedDAG | None` and logs when it returns None,
but the caller guarded it with `if TYPE_CHECKING: assert serdag`, which never
executes at runtime. Once `airflow db clean` removes a version's serialized Dag
row, the resulting AttributeError is raised inside the `StreamingResponse`
generator -- after the 200 has been sent. The client gets a silently truncated
NDJSON body and loses every run queued behind the failing one, with no status
code to detect it by. The guard was a real `raise HTTPException(404)` until
apache#52302 replaced it with the no-op assert.

A 404 is no longer available that far into the stream, and skipping the run
would hide task instances that are still in the database, so an unresolvable
version now falls through to the flat-node path the endpoint already uses for
tasks the current structure no longer contains.

That makes the missing serialized Dag an expected, handled condition, and the
grid re-streams every visible run on each auto-refresh, so its log drops from
error to warning -- matching the existing sites for the same condition in
models/taskinstance.py.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant