Repository navigation
fix(conversions): read metadata absence from the proto map, not from None - #1602
Conversation
…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.
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…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>
The gRPC transport reports an empty metadata dict where the REST and local transports report
None.GrpcToRest.convert_collection_configandconvert_update_collectiontestmodel.metadata is not None, butmetadatais amap<string, Value>in the proto and a map getter always returns a (possibly empty) container, so that branch is always taken and theelse Noneis dead. Withprefer_grpc=True,get_collection(name).config.metadatais{}for a collection without metadata, while the REST transport andQdrantClient(":memory:")returnNone— which is whatmodels.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 becomesNoneand a populated one is unchanged. This is the same direction as #1408, which keeps an absentUpdateResult.operation_idasNoneover gRPC; #1473 fixed non-JSON payload encoding injson_to_value, a different call site with the same transport-consistency theme.Test:
pytest tests/conversions/test_validate_conversions.py -q -k metadata_absencefails on dev withAssertionError: assert {} is Noneand 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=99on 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 inqdrant_remote.py.All Submissions:
devbranch. Did you create your branch fromdev?New Feature Submissions:
pre-commitwithpip3 install pre-commitand set up hooks withpre-commit install?Changes to Core Features: