Skip to content

[codex] Reject boolean n_results values#7091

Open
pragnyanramtha wants to merge 1 commit into
chroma-core:mainfrom
pragnyanramtha:codex/reject-bool-n-results
Open

[codex] Reject boolean n_results values#7091
pragnyanramtha wants to merge 1 commit into
chroma-core:mainfrom
pragnyanramtha:codex/reject-bool-n-results

Conversation

@pragnyanramtha
Copy link
Copy Markdown

Summary

  • Reject boolean values in validate_n_results so n_results=True is not accepted as 1.
  • Add focused coverage for both True and False inputs.

Why

bool is a subclass of int in Python, so the existing isinstance(n_results, int) check let True pass validation even though n_results is documented and validated as a positive integer count.

Validation

  • python -m pytest --noconftest chromadb/test/api/test_types.py -q
  • Direct check that validate_n_results(True) and validate_n_results(False) raise ValueError while validate_n_results(1) still passes.

@github-actions
Copy link
Copy Markdown

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)

@pragnyanramtha pragnyanramtha marked this pull request as ready for review May 17, 2026 01:28
Copilot AI review requested due to automatic review settings May 17, 2026 01:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants