Fix mutable default argument bug in service retrieve methods#98
Closed
zhibindai26 wants to merge 3 commits intomainfrom
Closed
Fix mutable default argument bug in service retrieve methods#98zhibindai26 wants to merge 3 commits intomainfrom
zhibindai26 wants to merge 3 commits intomainfrom
Conversation
The `params: Mapping[str, Any] | None = {}` default was a single dict
shared across all calls. Once mutated (e.g. by passing portfolio_size
or property_type), the stale value persisted in subsequent calls that
omitted params. Changed to `dict[str, Any] | None = None` with
explicit `if params is None: params = {}` in the function body.
Fixed in: PortfolioSizeService, PropertyTypeService, PropertyEventsService.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zshamroukh
approved these changes
Apr 14, 2026
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.
Summary
params={}) inPortfolioSizeService.retrieve(),PropertyTypeService.retrieve(), andPropertyEventsService.retrieve()portfolio_sizeandproperty_typevalues to silently leak into subsequent calls that omitted theparamsargumentparams=Nonewithif params is None: params = {}guard in the function bodyconfigtoConfigDictin pydantic model configsTest plan
ruff check+ruff format --check).retrieve()calls with and withoutportfolio_size/property_typeno longer carry over stale filter values🤖 Generated with Claude Code