You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pass placement from KeyValueConfig into StreamConfig in create_key_value - #988
Fixes#538. Value of placement in given KeyValueConfig was not being used in created StreamConfig. KV placement can now be controlled when using create_key_value.
Review: Pass placement from KeyValueConfig into StreamConfig
Gather context (PR diff, CLAUDE.md, related code)
Review the change for correctness
Post review feedback
The change is correct.nats/src/nats/js/client.py:1452 now forwards config.placement into the StreamConfig built in create_key_value. Both KeyValueConfig.placement (nats/src/nats/js/api.py:834) and StreamConfig.placement (nats/src/nats/js/api.py:370) are typed Optional[api.Placement], so this is a direct, type-safe pass-through — consistent with how sibling fields like storage, replicas/num_replicas, and republish are already forwarded a few lines below/above it. This matches the existing pattern used in create_object_store for ObjectStoreConfig.placement as well.
One gap: there's no test covering this. nats/tests/test_js.py has KV tests but none that assert placement set on KeyValueConfig propagates to the resulting stream's StreamConfig.placement. Consider adding a small test that creates a KV bucket with a Placement (e.g. cluster=...) and asserts js.stream_info(...) (or the returned stream config) reflects it — this would also guard against regression if the field ordering/forwarding changes again.
No other issues found — the diff is minimal (1 line), doesn't touch unrelated code, and doesn't require lint/test changes beyond the suggested test.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #538. Value of
placementin givenKeyValueConfigwas not being used in createdStreamConfig. KV placement can now be controlled when usingcreate_key_value.