Repository navigation
Conversation
c6c2495 to
8344c90
Compare
8344c90 to
b3ebc60
Compare
|
Resolve the merge conflict and re-run the CI. |
pierrejeambrun
left a comment
There was a problem hiding this comment.
Thanks for the PR.
Just one small refactoring suggestion
|
Also worth a small |
b3ebc60 to
6f38b51
Compare
|
addressed feedback and added newsfragment. |
Andrushika
left a comment
There was a problem hiding this comment.
Thanks for the PR! the direction makes sense to me.
Left three comments: one on the alias set, one on the bulk error shape, one on test coverage.
Review feedback: the check belongs with the other query parameters in parameters.py, so a route declares it once instead of every route and service calling a validator by hand. Bulk endpoints carry the mask in the request body rather than the query string, so they keep a single check -- now up front, before any entity is written, instead of part way through the loop.
ba8347b to
86ae3ed
Compare
Andrushika
left a comment
There was a problem hiding this comment.
LGTM after fix, thanks!
We should also mention some more affected endpoints in newfragment.
A bad mask on a bulk PATCH failed the whole request with 400, while every other per-action failure (a missing entity, an immutable field) is reported in that action's errors and the rest of the request still applies. Bulk clients now get one error shape for all of them. Serialization aliases were accepted as mask entries although a request body can never carry them, so update_mask=val on a variable passed validation and still updated nothing -- the silent no-op this change exists to remove. Only field names and validation aliases are accepted now. Each route wires the validated update_mask dependency on its own line, so a 400 case is added for every endpoint that takes a mask; dropping the wiring from any one of them now fails a test.
86ae3ed to
cec46f5
Compare
There was a problem hiding this comment.
After second though, I'm afraid this could break some workflow.
Since this isn't critical and other query params work like this (typo in filter or adding extra unknown query parameters will just be ignored without 400ing) I'd lean on not merging this at this point.
I'll close this for now. Feel free to re-open if you want to convert this into a 'warning' instead, without altering the current behavior.
(Also in the current implementation I believe aliased field + bulk TI endpoints are not properly handled)
Summary
update_masklets a PATCH caller say "only apply these fields". Every endpoint implements it by intersecting the mask with the fields present in the body:An entry that matches no field simply falls out of the intersection. Nothing notices, so the request becomes a no-op and still answers
200, echoing back the untouched record. A typo is indistinguishable from success:A stray space does the same, since nothing trims the entries (
update_mask=%20value). A client that checks the status code has no way to learn its patch never landed.dags.pyalready guards against this (if update_mask != ["is_paused"]: raise 400), so rejecting an unusable mask is an established expectation in this API. It was just missing everywhere else that accepts one.Before / after
?update_mask=value200, applied?update_mask=valu200, not applied400naming the unknown field?update_mask=%20value200, not applied200, appliedPATCHwith"update_mask": ["valu"]200, not applied200, error in that action'serrorsThe error names both the offender and the accepted fields:
The change
update_mask_param_factory(body_type)incommon/parameters.pybuilds a validatedupdate_maskquery parameter. The single-entity PATCH routes take it throughDepends: variables, pools, connections, dag runs, and the task-instance patch,dry_runand task-group routes.dags.pyis left alone because it already validates.BulkService.handle_requestvalidates it perupdateaction. A bad mask is reported in that action'serrorswithstatus_code: 400, and the other actions still run. This matches how bulk already reports a missing entity or an immutable field.Two decisions worth flagging:
Field names and validation aliases are accepted, serialization aliases are not.
ConnectionBody.schema_is aliased toschema, andupdate_mask=["schema","extra"]is a working request today, so input aliases must pass. A serialization-only alias is an output name the body can never carry. Accepting it would letupdate_mask=valon a variable (VariableBody.valueserializes asval) through validation as a silent no-op.Whitespace is trimmed rather than rejected.
pools.pyalready compares withmask.strip(), and the intent of" value"is not in doubt.Note on an existing test
test_patch_dag_run_with_update_maskhad a case asserting that{"update_mask": ["random"]}returns200, which recorded the buggy behaviour as an expectation. It now expects400and the error message.Tests
Each route wires the dependency on its own line, so every endpoint that takes a mask has a
400case:valreturn400and leave the row unchanged; a mask with surrounding whitespace still applies400and the stored value is unchangeddry_runand task-group routes return400without setting any state200, with the error inupdate.errorsand the row unchangedtest_variables,test_pools,test_connections,TestPatchDagRunand the new task-instance test: 361 passed.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines