fix: parse asyncConfig from replication config GET response#1996
fix: parse asyncConfig from replication config GET response#1996
Conversation
The server returns asyncConfig inside replicationConfig on collection GET, but the Python client was not parsing it. Add _AsyncReplicationConfig dataclass, wire it into _collection_config_from_json, and export AsyncReplicationConfig from the public API surface. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
Existing callers construct _ReplicationConfig without async_config. Adding a default prevents a breaking positional argument error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes the Python client’s parsing of collection replicationConfig so the server-provided asyncConfig is preserved (instead of being silently dropped), and exposes the parsed type for user type-checking.
Changes:
- Add
_AsyncReplicationConfig/AsyncReplicationConfigoutput dataclass and attach it toReplicationConfigasasync_config. - Parse
replicationConfig.asyncConfigin_collection_config_from_json. - Add unit tests covering presence/absence/partial
asyncConfigandto_dict()behavior; exportAsyncReplicationConfigviaweaviate.outputs.config.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
weaviate/outputs/config.py |
Re-exports AsyncReplicationConfig for public typing. |
weaviate/collections/classes/config_methods.py |
Parses replicationConfig.asyncConfig into _AsyncReplicationConfig during collection GET config parsing. |
weaviate/collections/classes/config.py |
Introduces the _AsyncReplicationConfig dataclass and adds async_config to _ReplicationConfig. |
test/collection/test_config.py |
Adds tests validating parsing and to_dict() serialization for asyncConfig. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Default async_config to None for backwards compatibility (copilot) - Use `is not None` instead of truthiness check for asyncConfig parsing so empty dict is not silently dropped (copilot) - Replace unit tests calling _collection_config_from_json with integration round-trip tests (dirkkul) - Add integration test for creating with async_config then removing it Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4bff06b to
e5ec450
Compare
Override merge_with_existing on _ReplicationConfigUpdate to: - Replace entire asyncConfig when provided (not merge), so omitted fields revert to server defaults. This follows the generative/reranker clear+replace pattern. - Pop asyncConfig from schema when asyncEnabled=False, so disabling async replication also clears the config. Add unit tests for all merge behaviors (replace, clear, preserve, reset) and integration tests for unsetting individual fields, resetting all fields via empty async_config(), and disabling async replication. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
e5ec450 to
7050230
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Revert to truthiness check when parsing asyncConfig from server
response. An empty dict {} means no custom config and should be
treated as absent (None), not as an _AsyncReplicationConfig with
all None fields.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1996 +/- ##
==========================================
+ Coverage 87.84% 87.95% +0.11%
==========================================
Files 280 280
Lines 21347 21652 +305
==========================================
+ Hits 18752 19045 +293
- Misses 2595 2607 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
asyncConfiginsidereplicationConfigon collection GET, but the Python client was silently dropping it —replication_config.async_configwas always missing._AsyncReplicationConfigdataclass (14 optional int fields matching the server schema) and wire it into_collection_config_from_json.AsyncReplicationConfigfromweaviate.outputs.configso users can type-check against it.Test plan
asyncConfig(backwards compat)asyncConfigasyncConfig(missing fields →None)to_dict()round-trip includesasyncConfigwhen presentto_dict()omitsasyncConfigwhenNone🤖 Generated with Claude Code