Skip to content

Conversation

@Samyak2406
Copy link

@Samyak2406 Samyak2406 commented Nov 13, 2025

Summarize the changes made by this PR.

fixes #5857

@github-actions
Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Nov 13, 2025

Prevent unintended mutation of caller-supplied include lists

The PR fixes issue #5857 where the helper methods that build GetRequest and QueryRequest directly modified the caller-provided include list via append(). In Python, this mutates the caller’s list, producing side-effects if the same list object is reused elsewhere. The patch adds a defensive copy (list(include) if include else []) before any in-place edits, mirroring feedback from earlier review comments.

Key Changes

• Replaced request_include = include with request_include = list(include) if include else [] in _validate_and_prepare_get_request().
• Applied the same defensive-copy logic in _validate_and_prepare_query_request().
• Removed obsolete inline comment # Prepare.

Affected Areas

chromadb/api/models/CollectionCommon.py – request preparation for GET and QUERY paths

This summary was automatically generated by @propel-code-bot

…ult argument while querying a collection
@Samyak2406 Samyak2406 force-pushed the bugfixes/collection-query-mutable-argument branch from 5876fc5 to 72cb36f Compare November 13, 2025 14:50
@Samyak2406 Samyak2406 force-pushed the bugfixes/collection-query-mutable-argument branch from 936410b to 433a610 Compare November 13, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Query - In-place mutation of include parameter causes corruption across calls

1 participant