Fix bulk create+overwrite silently resetting unset fields on pools and connections#68645
Merged
vincbeck merged 3 commits intoJun 17, 2026
Merged
Conversation
…d connections A bulk 'create' with action_on_existence=overwrite dumped the whole request body and set every field on the existing record, so fields the request omitted were reset to their defaults. For multi-team setups this silently nulled an existing pool's or connection's team_name ownership when an overwrite changed only e.g. slots; description and include_deferred were affected too. Only write the fields the request actually provided (model_dump(exclude_unset=True)), so omitted fields keep their current value while explicitly-set fields (even None) are still applied. Adds regression tests for both pools and connections.
seanghaeli
requested review from
bugraoz93,
choo121600,
ephraimbuddy,
jason810496,
pierrejeambrun,
rawwar and
shubhamraj-git
as code owners
June 16, 2026 23:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The bulk APIs (
PATCH /api/v2/poolsandPATCH /api/v2/connections) handle acreateaction withaction_on_existence=overwriteby dumping the whole request body andsetattr-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.slotssilently resets every unmentioned field.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 (evenNone) is still applied. Applied to both the pools and connections bulk-create overwrite paths (variables useVariable.setand are unaffected).Tests
test_bulk_create_overwrite_preserves_unset_team_name(pools + connections): a team-owned record overwritten with a body that omitsteam_namekeeps itsteam_name. Fails on the old code (team_namebecomesNone), passes with the fix.test_bulk_create_overwrite_applies_explicit_team_name(pools): an explicitly-providedteam_nameis still applied, so the fix doesn't over-correct.