Skip to content

fix(conversions): read metadata absence from the proto map, not from None - #1602

Merged
joein merged 2 commits into
qdrant:devfrom
feiiiiii5:fix/grpc-metadata-map-absence
Oct 22, 2026
Merged

joein merged 2 commits into
qdrant:devfrom
feiiiiii5:fix/grpc-metadata-map-absence

Conversation

@feiiiiii5

Copy link
Copy Markdown
Contributor

The gRPC transport reports an empty metadata dict where the REST and local transports report None.

GrpcToRest.convert_collection_config and convert_update_collection test model.metadata is not None, but metadata is a map<string, Value> in the proto and a map getter always returns a (possibly empty) container, so that branch is always taken and the else None is dead. With prefer_grpc=True, get_collection(name).config.metadata is {} for a collection without metadata, while the REST transport and QdrantClient(":memory:") return None — which is what models.CollectionConfig.metadata: Optional[Payload] declares. The same file already reads a map by length (len(model.payload) > 0).

Both call sites now use len(model.metadata) > 0, so an empty map becomes None and a populated one is unchanged. This is the same direction as #1408, which keeps an absent UpdateResult.operation_id as None over gRPC; #1473 fixed non-JSON payload encoding in json_to_value, a different call site with the same transport-consistency theme.

Test: pytest tests/conversions/test_validate_conversions.py -q -k metadata_absence fails on dev with AssertionError: assert {} is None and passes here. pytest qdrant_client/local/tests tests/test_common.py tests/test_uploader.py tests/conversions -q → 274 passed. ruff format --check --line-length=99 on both files is clean. Tests that need a running server (tests/congruence_tests/**, tests/test_qdrant_client.py) were not run; the gRPC path is covered at the conversion layer plus the call chain in qdrant_remote.py.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you installed pre-commit with pip3 install pre-commit and set up hooks with pre-commit install?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

…None

A protobuf map getter always returns a container, so the None check in GrpcToRest never fired and get_collection(prefer_grpc=True) reported an empty metadata dict where the REST and local transports report None, against the Optional[Payload] declaration.
@feiiiiii5
feiiiiii5 requested a review from joein as a code owner October 18, 2026 03:18
@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit 16b84ef
🔍 Latest deploy log https://app.netlify.com/projects/poetic-froyo-8baba7/deploys/6ad9d6b2fad1bb06f05401db
😎 Deploy Preview https://deploy-preview-1602--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.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3df61c3b-550d-48d9-afb0-198ed8fe4df3
📥 Commits

Reviewing files that changed from the base of the PR and between 9f45d24 and 6947902.

📒 Files selected for processing: 2
  • qdrant_client/conversions/conversion.py
  • tests/conversions/test_validate_conversions.py

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

Collection configuration and update conversions now return None when the protobuf metadata map is empty. They preserve populated metadata maps as REST dictionaries. A test covers both empty and populated maps.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 69479

Empty gRPC metadata is normalized to None while populated metadata is preserved. No concrete current-head issue requiring a pre-merge fix is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main conversion fix: checking metadata absence from the protobuf map instead of comparing it with None.
Description check Passed The description directly explains the metadata conversion issue, the intended transport consistency, the code changes, and the test results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

@joein
joein merged commit c502da5 into qdrant:dev Oct 22, 2026
9 checks passed
joein added a commit that referenced this pull request Oct 22, 2026
…None (#1602)

* fix(conversions): read metadata absence from the proto map, not from None

A protobuf map getter always returns a container, so the None check in GrpcToRest never fired and get_collection(prefer_grpc=True) reported an empty metadata dict where the REST and local transports report None, against the Optional[Payload] declaration.

* tests: drop the metadata absence test and shorten its comments

---------

Co-authored-by: fei <204683769+feiiii5@users.noreply.github.com>
Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
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