fix: remove PubSub API - #217
Conversation
136ab82 to
8bb7bd9
Compare
d710923 to
e82b715
Compare
jamesx-improving
left a comment
There was a problem hiding this comment.
Verdict: Approve
0 high-confidence findings (3 doc nits).
Summary
Small, focused change that hides the unfinished Pub/Sub subscription surface from the 1.0.0 public API by marking subscribe / unsubscribe / psubscribe / punsubscribe / ssubscribe / sunsubscribe and the FFI push callback pubsub_callback as private, plus README/CHANGELOG updates.
Verification performed
- Visibility propagates through nested include. Confirmed via a standalone Ruby repro that
private :subscribeinsidePubSubCommandscarries throughCommands.include PubSubCommandsintoValkey.include CommandsandPipeline.include Commands. Callingclient.subscribe(...)raisesNoMethodError: private method 'subscribe' called for an instance of Valkey, matching the docstring claim. - FFI callback still wires up.
lib/valkey.rb:263passesmethod(:pubsub_callback)intoBindings.create_client_from_uri. Ruby'sMethodAPI and FFI callback dispatch both bypass visibility, so makingpubsub_callbackprivate does not break the incoming Pub/Sub push path. Verified with a standalone repro. - No internal callers. Grepped
lib/,test/valkey/,test/cluster/,test/lint/, andexamples/forsubscribe/unsubscribe/ etc. — no callers other than the definitions inpubsub_commands.rb. Privatization does not break any in-tree code paths. pubsub()dispatcher cannot re-expose the private methods. The convenience method at line 262 buildssend("pubsub_#{subcommand}", *args), sopubsub(:subscribe)would look uppubsub_subscribe, which does not exist and would raiseNoMethodError. It cannot accidentally reach the privatesubscribe.- Not covered by tests.
test/lint/pubsub_commands.rbonly exercisespublish/spublish/pubsub_*introspection commands (all of which remain public); no test covers the new "calling subscribe raises NoMethodError" contract. Consistent with the PR description ("n/a, API removal only") — not a defect, but worth noting.
Doc nits (optional)
README.md:325— Reads as past tense: "The Ruby client partially implemented the Pub/Sub GLIDE-Core API…". Likely intendedimplements.CHANGELOG.md:7–8— The bullet has a hard newline inside the sentence ("…to be added in\nlater releases."). Markdown renders as a space, but reflowing to one line reads better.lib/valkey/pubsub_callback.rb:5— Trailing whitespace:"# Pub/Sub API is not yet ready. Use at your own risk. "has a stray trailing space. RuboCop territory; not a defect.
LGTM.
| Pub/Sub is currently not supported and is not ready for use. The Ruby client partially | ||
| implemented the Pub/Sub GLIDE-Core API and full support is planned for future release. | ||
|
|
||
| Use the current Pub/Sub API at your own risk. |
There was a problem hiding this comment.
Calling this raises NoMethodError
Is it even possible to "Use ... at your own risk"? Should we just say "don't use"?
| ### Breaking Changes | ||
|
|
||
| * Ruby: Pub/Sub subscription commands are no longer public API. `subscribe`, `unsubscribe`, `psubscribe`, `punsubscribe`, `ssubscribe`, and `sunsubscribe` are now private, and the internal FFI push callback `Valkey::PubSubCallback#pubsub_callback` is private as well. Full pub/sub implementation to be added in | ||
| later releases. |
There was a problem hiding this comment.
Do we need Breaking Changes pre-GA release?
There was a problem hiding this comment.
good point. To be removed.
| ## Pending | ||
|
|
||
| ### Changes |
There was a problem hiding this comment.
Nit. Was this intentional? If Pending is empty, maybe just remove?
xShinnRyuu
left a comment
There was a problem hiding this comment.
Mostly just nits comments so ill approve, but ideally you fix the inline comments
- Update description to reflect that entire PubSub surface is removed, not just subscription commands
- Consider adding regression test - Single test asserting NoMethodError when calling client.subscribe(...)
| module Commands | ||
| # This module contains commands related to Valkey Pub/Sub. | ||
| # Pub/Sub is not yet supported and is partially implemented. | ||
| # Use at your own risks. |
There was a problem hiding this comment.
typo Use at your own risks -> Use at your own risk
| # Publish a message to a channel. | ||
| # | ||
| # @api experimental | ||
| # @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and |
There was a problem hiding this comment.
Should probably update this usable today since its wont be usable with this PR
Signed-off-by: Alex Le <alex.le@improving.com>
b916df3 to
6b9b83f
Compare
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
Signed-off-by: Alex Le <alex.le@improving.com>
Summary
Withholds the Pub/Sub subscription commands from the public API for release 1.0.0. Clearly document that Pub/Sub API is not ready for use.
Issue link
Related #216
Features / Changes
What changed:
subscribe,unsubscribe,psubscribe,punsubscribe,ssubscribe, andsunsubscribeare no longer callable onValkeyorValkey::Pipeline.Valkey::PubSubCallback#pubsub_callbackis private as well.Pub/Sub API is not documented as experimental and not ready for use.
Checklist
Before submitting the PR make sure the following are checked:
bundle exec rubocop) and pass.release-1.0