seanghaeli opened a new pull request, #68645: URL: https://github.com/apache/airflow/pull/68645
### Problem The bulk APIs (`PATCH /api/v2/pools` and `PATCH /api/v2/connections`) handle a `create` action with `action_on_existence=overwrite` by dumping the whole request body and `setattr`-ing every field onto the existing record. Because the dump includes fields the request omitted (at their model defaults), an overwrite that changes only e.g. `slots` silently **resets every unmentioned field**. The most damaging case is multi-team: omitting `team_name` nulls an existing pool's/connection's team ownership. `description` and `include_deferred` are clobbered the same way. This is independent of any other in-flight work — it reproduces on `main`. ### Fix Overwrite only the fields the request actually provided, via `model_dump(exclude_unset=True)`. Omitted fields keep their current value; an explicitly-set field (even `None`) is still applied. Applied to both the pools and connections bulk-create overwrite paths (variables use `Variable.set` and are unaffected). ### Tests - `test_bulk_create_overwrite_preserves_unset_team_name` (pools + connections): a team-owned record overwritten with a body that omits `team_name` keeps its `team_name`. Fails on the old code (`team_name` becomes `None`), passes with the fix. - `test_bulk_create_overwrite_applies_explicit_team_name` (pools): an explicitly-provided `team_name` is still applied, so the fix doesn't over-correct. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 4.8) Generated-by: Claude Code (Opus 4.8) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
