Skip to content

fix: remove PubSub API - #217

Merged
Aryex merged 4 commits into
release-1.0from
alexl/agent/pubsub-client-privatize
Aug 6, 2026
Merged

fix: remove PubSub API#217
Aryex merged 4 commits into
release-1.0from
alexl/agent/pubsub-client-privatize

Conversation

@Aryex

@Aryex Aryex commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

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, and sunsubscribe are no longer callable on Valkey or Valkey::Pipeline. Valkey::PubSubCallback#pubsub_callback is 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:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated. — n/a, API removal only; see Testing.
  • Documentation is updated (if applicable).
  • Linters have been run (bundle exec rubocop) and pass.
  • Destination branch is correct - release-1.0

@Aryex
Aryex requested a review from Sasidharan3094 August 1, 2026 01:42
@Aryex Aryex self-assigned this Aug 1, 2026
@Aryex
Aryex force-pushed the alexl/agent/pubsub-client-privatize branch from 136ab82 to 8bb7bd9 Compare August 4, 2026 20:56
@Aryex
Aryex requested a review from jamesx-improving August 4, 2026 21:11
@Aryex
Aryex force-pushed the alexl/agent/pubsub-client-privatize branch from d710923 to e82b715 Compare August 4, 2026 21:15
@Aryex
Aryex marked this pull request as ready for review August 4, 2026 21:15
@Aryex
Aryex requested a review from currantw August 5, 2026 18:01

@jamesx-improving jamesx-improving left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 :subscribe inside PubSubCommands carries through Commands.include PubSubCommands into Valkey.include Commands and Pipeline.include Commands. Calling client.subscribe(...) raises NoMethodError: private method 'subscribe' called for an instance of Valkey, matching the docstring claim.
  • FFI callback still wires up. lib/valkey.rb:263 passes method(:pubsub_callback) into Bindings.create_client_from_uri. Ruby's Method API and FFI callback dispatch both bypass visibility, so making pubsub_callback private 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/, and examples/ for subscribe / unsubscribe / etc. — no callers other than the definitions in pubsub_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 builds send("pubsub_#{subcommand}", *args), so pubsub(:subscribe) would look up pubsub_subscribe, which does not exist and would raise NoMethodError. It cannot accidentally reach the private subscribe.
  • Not covered by tests. test/lint/pubsub_commands.rb only exercises publish / 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 intended implements.
  • 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.

@currantw currantw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed to e82b715.

Comment thread README.md Outdated
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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Calling this raises NoMethodError

Is it even possible to "Use ... at your own risk"? Should we just say "don't use"?

Comment thread CHANGELOG.md Outdated
Comment on lines +5 to +8
### 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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need Breaking Changes pre-GA release?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

good point. To be removed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removed in b916df3

@Aryex Aryex changed the title fix: privatize subscribe command methods fix: remove PubSub API Aug 5, 2026
Comment thread CHANGELOG.md
Comment on lines 3 to 5
## Pending

### Changes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit. Was this intentional? If Pending is empty, maybe just remove?

@currantw currantw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me ✅

@xShinnRyuu xShinnRyuu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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(...)

Comment thread lib/valkey/commands/pubsub_commands.rb Outdated
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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

typo Use at your own risks -> Use at your own risk

Comment thread lib/valkey/commands/pubsub_commands.rb Outdated
# Publish a message to a channel.
#
# @api experimental
# @note EXPERIMENTAL: usable today, but part of the Pub/Sub surface and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should probably update this usable today since its wont be usable with this PR

Signed-off-by: Alex Le <alex.le@improving.com>
@Aryex
Aryex force-pushed the alexl/agent/pubsub-client-privatize branch from b916df3 to 6b9b83f Compare August 6, 2026 17:30
Aryex added 3 commits August 6, 2026 10:33
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>
@Aryex
Aryex merged commit d95d166 into release-1.0 Aug 6, 2026
1 check passed
@Aryex
Aryex deleted the alexl/agent/pubsub-client-privatize branch August 6, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants