Repository navigation
fix(python): add warning in replace_all_objects for empty objects - #6611
Merged
eric-zaharia merged 3 commits intoJul 6, 2026
Merged
Conversation
Contributor
āļø Code generated!
š Benchmark resultsBenchmarks performed on the method using a mock server, the results might not reflect the real-world performance.
|
eric-zaharia
marked this pull request as ready for review
June 26, 2026 09:21
eric-zaharia
added a commit
that referenced
this pull request
Jun 26, 2026
ā¦ty-check Avoid enumerating non-ICollection IEnumerable inputs via .Any(), which would double-enumerate (and potentially drop records from) one-shot sequences. Matches the Python reference (#6611), which only warns for Sized inputs.
Fluf22
approved these changes
Jul 3, 2026
eric-zaharia
enabled auto-merge (squash)
July 6, 2026 10:40
eric-zaharia
deleted the
port/replaceallobjects-empty-warning-20260626/python
branch
July 6, 2026 11:07
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-java
that referenced
this pull request
Jul 6, 2026
ā¦nerated) algolia/api-clients-automation#6611 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-javascript
that referenced
this pull request
Jul 6, 2026
ā¦nerated) algolia/api-clients-automation#6611 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-kotlin
that referenced
this pull request
Jul 6, 2026
ā¦nerated) algolia/api-clients-automation#6611 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-php
that referenced
this pull request
Jul 6, 2026
ā¦nerated) algolia/api-clients-automation#6611 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-python
that referenced
this pull request
Jul 6, 2026
ā¦nerated) algolia/api-clients-automation#6611 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
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.
š§ What and Why
š JIRA Ticket: API-500
Mirrors #6607 for the Python client: logs a warning when
replace_all_objects(orreplace_all_objects_with_transformation) is called with an empty list of objects, which would otherwise copy settings, batch zero records, and move the temp index over the source ā silently emptying the index. Behavior is unchanged.Changes included:
replace_all_objectsandreplace_all_objects_with_transformationnow emit alogging.getLogger(__name__).warning(...)naming the affected index when called with an empty objects collection.logging.warningnever raises, so an empty call still proceeds with the copy ā batch ā move sequence exactly as before.collections.abc.Sizedguard (isinstance(objects, Sized) and len(objects) == 0) so a lazy iterable is never consumed or materialized;objectsis passed onward untouched. An empty generator goes unwarned by design (no way to test it without consuming it).Warning:docstring note to both methods so the footgun surfaces on IDE hover.import loggingandfrom collections.abc import Sizedare scoped inside the helper bodies to avoid adding unused imports to other generated clients.Usage
Existing call sites are unaffected ā this only adds a
loggingwarning when the list is empty, and never consumes a lazy iterable.