Skip to content

fix is_empty/is_null=False conversion to grpc#1051

Merged
coszio merged 1 commit into
devfrom
fix-is_empty-false
Jul 29, 2025
Merged

fix is_empty/is_null=False conversion to grpc#1051
coszio merged 1 commit into
devfrom
fix-is_empty-false

Conversation

@coszio

@coszio coszio commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

Conversion to grpc for is_empty field condition was broken because python returns False for None and also for False in if model.is_empty

@coszio coszio requested a review from joein July 29, 2025 13:20
@netlify

netlify Bot commented Jul 29, 2025

Copy link
Copy Markdown

Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit 0d8e4ea
🔍 Latest deploy log https://app.netlify.com/projects/poetic-froyo-8baba7/deploys/6888ca8a4dca6f00085cc795
😎 Deploy Preview https://deploy-preview-1051--poetic-froyo-8baba7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coszio coszio changed the title fix is_empty=False conversion to grpc fix is_empty/is_null=False conversion to grpc Jul 29, 2025
@coderabbitai

coderabbitai Bot commented Jul 29, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The changes update the convert_field_condition method in the RestToGrpc class to use explicit is not None checks for optional fields instead of relying on their truthiness. This adjustment affects how the method determines which field is present when constructing a gRPC FieldCondition from a REST model. Additionally, in the test fixtures, a new FieldCondition with is_empty=False and a corresponding Condition are added, and this new condition is included in the min_should list of the existing filter object.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • generall

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-is_empty-false

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/conversions/fixtures.py (1)

100-103: Add the new FieldCondition and Condition to the related fixtures lists

field_condition_is_empty_false and its wrapper condition_field_is_empty_false are created here but are not referenced in the "FieldCondition" and "Condition" arrays further down (around lines 1577 and 1604).
If downstream parametrised tests rely on those arrays to discover all variants, the new objects will never be exercised.

@@ "FieldCondition": [
         field_condition_values_count,
+        field_condition_is_empty_false,
 ]
@@ "Condition": [
         condition_values_count,
+        condition_field_is_empty_false,
 ]
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af11ad0 and 0d8e4ea.

📒 Files selected for processing (2)
  • qdrant_client/conversions/conversion.py (1 hunks)
  • tests/conversions/fixtures.py (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
tests/conversions/fixtures.py (2)
qdrant_client/http/models/models.py (1)
  • FieldCondition (796-817)
qdrant_client/grpc/points_pb2.pyi (4)
  • FieldCondition (4596-4654)
  • is_empty (4490-4490)
  • Condition (4477-4514)
  • field (4488-4488)
qdrant_client/conversions/conversion.py (2)
qdrant_client/grpc/points_pb2.pyi (11)
  • match (4611-4612)
  • FieldCondition (4596-4654)
  • Range (4741-4769)
  • DatetimeRange (4773-4805)
  • datetime_range (4629-4630)
  • geo_bounding_box (4617-4618)
  • geo_radius (4620-4621)
  • geo_polygon (4626-4627)
  • values_count (4623-4624)
  • is_empty (4490-4490)
  • is_null (4496-4496)
qdrant_client/http/models/models.py (3)
  • FieldCondition (796-817)
  • Range (2073-2081)
  • DatetimeRange (525-533)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Redirect rules - poetic-froyo-8baba7
  • GitHub Check: Header rules - poetic-froyo-8baba7
  • GitHub Check: Python 3.13.x on ubuntu-latest test
  • GitHub Check: Python 3.12.x on ubuntu-latest test
  • GitHub Check: Python 3.10.x on ubuntu-latest test
  • GitHub Check: Python 3.9.x on ubuntu-latest test
  • GitHub Check: Python 3.11.x on ubuntu-latest test
  • GitHub Check: Pages changed - poetic-froyo-8baba7
🔇 Additional comments (2)
tests/conversions/fixtures.py (1)

157-166: Confirm the fixture order—duplicates may affect min_should evaluation

condition_field_is_empty_false is appended to min_should.conditions immediately after its True counterpart.
Because the conversion code now distinguishes None vs False, having both variants side-by-side makes sense, but double-check any tests that assert positional equality on this list; the insertion can shift indexes and cause brittle assertions.

No change requested if the tests are order-agnostic.

qdrant_client/conversions/conversion.py (1)

2797-2830: LGTM! Critical fix for boolean field conversion.

This change correctly addresses the core issue described in the PR objectives. The previous truthiness checks (if model.is_empty) would evaluate to False for both None (field not set) and False (field explicitly set to false), making it impossible to distinguish between these states during gRPC conversion.

By changing to explicit is not None checks, the code now properly:

  • Handles is_empty=False and is_null=False as valid, explicitly-set values
  • Distinguishes between unset fields (None) and fields explicitly set to False
  • Maintains consistent logic across all optional fields in the method

This ensures correct conversion of FieldCondition objects from REST to gRPC format, particularly for boolean fields where False is a meaningful value distinct from None.

@coszio coszio merged commit 1a63b86 into dev Jul 29, 2025
14 of 24 checks passed
joein pushed a commit that referenced this pull request Jul 31, 2025
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