Brunda10 commented on code in PR #54597:
URL: https://github.com/apache/airflow/pull/54597#discussion_r2371479726
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_variables.py:
##########
@@ -1064,6 +1109,38 @@ class TestBulkVariables(TestVariableEndpoint):
},
id="test_repeated_actions",
),
+ pytest.param(
+ {
+ "actions": [
+ {
+ "action": "create",
+ "entities": [
+ {"key": "var1", "value": "initial",
"description": "Initial Description"}
+ ],
+ "action_on_existence": "fail",
+ },
+ {
+ "action": "update",
+ "entities": [
+ {"key": "var1", "value": "updated",
"description": "Updated Description"}
+ ],
+ "update_mask": ["value"],
+ "action_on_non_existence": "fail",
+ },
+ {
+ "action": "delete",
+ "entities": ["var1"],
+ "action_on_non_existence": "fail",
+ },
+ ]
+ },
+ {
+ "create": {"success": ["var1"], "errors": []},
+ "update": {"success": ["var1"], "errors": []},
+ "delete": {"success": ["var1"], "errors": []},
+ },
+ id="test_variable_dependent_actions_with_update_mask",
+ ),
Review Comment:
Hi @jason810496
Earlier I had added a check to raise 400 when update_mask contained invalid
fields, but as you commented I removed that since intersection already handles
it (invalid fields are silently ignored). That makes sense and is consistent
with other APIs.
But for non_update_fields like key, the situation is different:
With invalid fields, we can ignore them safely.
With restricted fields like key, the user is explicitly trying to update
something immutable.
My question: Right now, if the client includes key in update_mask or request
body, we strip it out via non_update_fields = {"key"}, so it will never be
updated — but the API still returns a success response.
Should we keep the current behavior (silently ignore key), or change it to
raise a 400 to clearly signal that key is immutable?
--
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]