Vasu-Madaan opened a new pull request, #68338:
URL: https://github.com/apache/airflow/pull/68338

   ## Summary
   
   `Log.dttm` is nullable at the database level, but `EventLogResponse.dttm` 
(`when` in the API) is declared as a non-optional `datetime`. When a log row 
has `dttm=NULL`, FastAPI/Pydantic raises a validation error producing a **500 
Internal Server Error** instead of a sensible response.
   
   This happens for legacy records or rows inserted directly into the database 
bypassing the model (which always sets `dttm = timezone.utcnow()` in 
`__init__`).
   
   ## Why this approach
   
   Rather than making `when` nullable in the API schema (a breaking contract 
change that would affect all API consumers expecting a non-null timestamp), we 
filter out null-dttm rows at the query level:
   
   - **`GET /eventLogs/{id}`** — returns **404** for a log whose `dttm` is 
`NULL`. The resource is not serveable through this API.
   - **`GET /eventLogs`** — silently excludes null-dttm rows from both the 
results and `total_entries`, keeping the response consistent and well-typed.
   
   This is the minimal, safe fix: it stops the 500 crash without changing the 
API contract or requiring a schema migration.
   
   closes: #68333
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (claude-sonnet-4-6)
   
   Generated-by: Claude Code (claude-sonnet-4-6) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


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