amoghrajesh commented on code in PR #67547:
URL: https://github.com/apache/airflow/pull/67547#discussion_r3309054207


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state.py:
##########
@@ -87,7 +88,9 @@ def list_task_states(
     )
     rows = session.execute(paginated).all()
     entries = [
-        TaskStateResponse(key=r.key, value=r.value, updated_at=r.updated_at, 
expires_at=r.expires_at)
+        TaskStateResponse(
+            key=r.key, value=json.loads(r.value), updated_at=r.updated_at, 
expires_at=r.expires_at

Review Comment:
   3.3 hasn't shipped, so the pre-#67418 row scenario cannot exist in any 
deployed cluster.
   
   For the custom backend concern: the core API currently calls 
`get_state_backend()`, but that's a known issue I already flagged in the 
backlog and will be fixing in next PRs, ie: the core API routes should be 
DB-direct (same as XCom), never routing through a custom backend. Once that is 
fixed, the core API only ever reads rows written by the execution API into the 
database, either direct data or references, which always stores 
`json.dumps(value)`, so `json.loads` on read is always safe. The 
`JSONDecodeError` risk goes away entirely at that point.



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