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
Thanks for the feedback! I will add a validation test and can separate it as
a different test method.
One clarification: earlier I had added a check to raise 400 when update_mask
contained invalid fields, but removed it since intersection already handles
those cases (silently ignoring them), which is consistent with other APIs.
However, for non_update_fields like key, the situation is different:
- Invalid fields can be ignored safely.
- But when a client tries to update key, they’re explicitly trying to modify
something immutable.
Right now, if key is passed in the request body or update_mask, it gets
stripped out via non_update_fields = {"key"} — so it’s never updated, but the
API still returns success.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]