Alwaysgaurav1 opened a new pull request, #69436:
URL: https://github.com/apache/airflow/pull/69436

   ### Description
   
   Currently, in the Task SDK, `Variable.set()` and `Variable.delete()` route 
their requests through the supervisor Execution API, but they do not check if 
the response is an `ErrorResponse`. If the API rejects the write operation (for 
example, returning a 403 Forbidden due to per-task authorization policies), the 
error is silently swallowed, and the task reports a `success` status even 
though the variable was not modified/deleted.
   
   This PR fixes that by:
   - Checking the supervisor response type inside `_set_variable` and 
`_delete_variable` in `airflow/sdk/execution_time/context.py`.
   - Raising an `AirflowRuntimeError` if the response is an `ErrorResponse`.
   - Adding unit tests in 
`task-sdk/tests/task_sdk/definitions/test_variables.py` to ensure that 
`Variable.set()` and `Variable.delete()` correctly raise `AirflowRuntimeError` 
when the Execution API returns an error response.
   
   Closes: #68537


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