Skip to content

fix: serialize WeaviateDocumentStore grpc_port and grpc_secure#3453

Merged
bogdankostic merged 2 commits into
deepset-ai:mainfrom
ly-wang19:fix/weaviate-to-dict-grpc
Jun 22, 2026
Merged

fix: serialize WeaviateDocumentStore grpc_port and grpc_secure#3453
bogdankostic merged 2 commits into
deepset-ai:mainfrom
ly-wang19:fix/weaviate-to-dict-grpc

Conversation

@ly-wang19

@ly-wang19 ly-wang19 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Related Issues

None — found while reviewing to_dict/from_dict parity across the document stores.

Proposed Changes:

WeaviateDocumentStore.to_dict() omitted grpc_port and grpc_secure, so they were lost on a to_dict/from_dict round-trip and a reloaded store fell back to the defaults (50051 / False). Added both to to_dict(); from_dict already forwards them via default_from_dict.

How did you test it?

Added a round-trip regression test with non-default values (grpc_port=50052, grpc_secure=True) — fails before the change, passes after. Updated the existing test_to_dict assertion. Non-integration tests + ruff pass.

Notes for the reviewer

One-line change in to_dict; no from_dict change needed.

Checklist

WeaviateDocumentStore.to_dict() serialized url, collection_settings, auth,
headers and the embedded/additional config, but omitted grpc_port and
grpc_secure. Both are real constructor parameters used to build the
connection (connect_to_custom / connect_to_local), so they were silently
lost on a to_dict/from_dict round-trip (e.g. a pipeline dumped to YAML and
reloaded), and a reloaded store fell back to the defaults (50051 / False).

Add both to the to_dict() payload (from_dict already forwards init params
via default_from_dict) plus a round-trip regression test; the existing
to_dict assertion is updated with the two default values.
@ly-wang19 ly-wang19 requested a review from a team as a code owner June 16, 2026 09:04
@ly-wang19 ly-wang19 requested review from bogdankostic and removed request for a team June 16, 2026 09:04
@github-actions github-actions Bot added integration:weaviate type:documentation Improvements or additions to documentation labels Jun 16, 2026
@bogdankostic

Copy link
Copy Markdown
Contributor

Thanks for the PR @ly-wang19! The unit tests are failing currently, could you make sure to fix them?

The bm25/embedding/hybrid retriever serialization tests embed the
WeaviateDocumentStore.to_dict() output inside their own expected dict.
Now that to_dict() serializes grpc_port and grpc_secure, the embedded
document_store init_parameters in those fixtures must include them too,
otherwise the retriever to_dict assertions fail (the Python 3.10/3.14
CI failures reported on this PR).
@ly-wang19

Copy link
Copy Markdown
Contributor Author

Thanks @bogdankostic — fixed in 0b83a18.

The failures came from the retriever serialization tests (test_bm25_retriever.py, test_embedding_retriever.py, test_hybrid_retriever.py), which embed WeaviateDocumentStore.to_dict() inside their own expected dict. Now that to_dict() also serializes grpc_port/grpc_secure, those embedded document_store init_parameters fixtures needed the two keys added (grpc_port: 50051, grpc_secure: False — the constructor defaults). Updated all 10 embedded blocks across the three retriever test files; the document-store's own to_dict/from_dict tests were already updated in the original commit.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report (weaviate)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/weaviate/src/haystack_integrations/document_stores/weaviate
  document_store.py
Project Total  

This report was generated by python-coverage-comment-action

@bogdankostic bogdankostic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks @ly-wang19!

@bogdankostic bogdankostic merged commit b764cdf into deepset-ai:main Jun 22, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:weaviate type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants