Conversation
There was a problem hiding this comment.
Pull request overview
Full rewrite of the gem as JRPC 2.0, introducing a new transport layer and two distinct client implementations (SimpleClient and SharedClient) with updated error semantics, CLI tooling, and CI/rubocop/test infrastructure.
Changes:
- Replaced the legacy
TcpClient/BaseClientstack withSimpleClient(single-caller) andSharedClient(multi-thread/fiber shared client with a dedicated transport thread). - Implemented an in-tree TCP transport with netstring framing and revised timeout/connection retry behavior.
- Updated docs, executables, gem dependencies, and added a new RSpec suite + CI workflow for Ruby 3.3/3.4.
Reviewed changes
Copilot reviewed 55 out of 58 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/transport/tcp_spec.rb | New transport-level TCP framing/timeout/connect specs. |
| spec/tcp_client_spec.rb | Removed legacy JRPC::TcpClient specs. |
| spec/support/fake_shared_transport.rb | New test transport for SharedClient using UNIXSocket pair. |
| spec/spec_helper.rb | Updated spec helper load path and support auto-require. |
| spec/simple_client_spec.rb | New SimpleClient behavior and error-translation specs. |
| spec/shared_client/ticket_spec.rb | New SharedClient::Ticket specs. |
| spec/shared_client/registry_spec.rb | New SharedClient::Registry specs. |
| spec/shared_client/outbound_queue_spec.rb | New SharedClient::OutboundQueue specs. |
| spec/shared_client/fiber_spec.rb | New fiber-scheduler integration specs for SharedClient. |
| spec/shared_client_spec.rb | New SharedClient integration specs (threads, TTL, reconnect, close semantics). |
| spec/message_spec.rb | New Message envelope/build/parse/validate specs. |
| spec/id_generator_spec.rb | New IdGenerator specs (single-thread and multi-thread). |
| spec/fake_transport.rb | Removed legacy fake transport used by old client specs. |
| spec/errors_spec.rb | New error hierarchy specs under JRPC::Errors. |
| README.md | Rewritten documentation for 2.0 APIs, behavior, and upgrade notes. |
| Rakefile | Modernized rake task definition and added frozen string literal. |
| lib/jrpc/version.rb | Bumped version to 2.0.0. |
| lib/jrpc/utils.rb | Removed legacy utility class. |
| lib/jrpc/transport/tcp.rb | New TCP transport implementation with framing and connect/read/write logic. |
| lib/jrpc/transport/socket_tcp.rb | Removed legacy socket transport implementation. |
| lib/jrpc/transport/socket_base.rb | Removed legacy socket base implementation. |
| lib/jrpc/transport/base.rb | New transport base API + error types. |
| lib/jrpc/transport.rb | New transport builder entrypoint. |
| lib/jrpc/tcp_client.rb | Removed legacy TCP client implementation. |
| lib/jrpc/simple_client.rb | New SimpleClient implementation. |
| lib/jrpc/shared_client/transport_loop.rb | New SharedClient transport thread event loop. |
| lib/jrpc/shared_client/ticket.rb | New Ticket backed by concurrent-ruby futures. |
| lib/jrpc/shared_client/registry.rb | New registry for in-flight tickets. |
| lib/jrpc/shared_client/outbound_queue.rb | New bounded outbound queue implementation. |
| lib/jrpc/shared_client.rb | New SharedClient implementation + lifecycle management. |
| lib/jrpc/message.rb | New JSON-RPC message helpers (build/parse/validate/error mapping). |
| lib/jrpc/id_generator.rb | New ID generator with optional mutex for thread safety. |
| lib/jrpc/errors.rb | New public error hierarchy under JRPC::Errors. |
| lib/jrpc/error/unknown_error.rb | Removed legacy error class file. |
| lib/jrpc/error/server_error.rb | Removed legacy error class file. |
| lib/jrpc/error/parse_error.rb | Removed legacy error class file. |
| lib/jrpc/error/method_not_found.rb | Removed legacy error class file. |
| lib/jrpc/error/invalid_request.rb | Removed legacy error class file. |
| lib/jrpc/error/invalid_params.rb | Removed legacy error class file. |
| lib/jrpc/error/internal_server_error.rb | Removed legacy error class file. |
| lib/jrpc/error/internal_error.rb | Removed legacy error class file. |
| lib/jrpc/error/error.rb | Removed legacy error class file. |
| lib/jrpc/error/connection_error.rb | Removed legacy error class file. |
| lib/jrpc/error/connection_closed_error.rb | Removed legacy error class file. |
| lib/jrpc/error/client_error.rb | Removed legacy error class file. |
| lib/jrpc/error.rb | Removed legacy error require aggregator. |
| lib/jrpc/base_client.rb | Removed legacy base client implementation. |
| lib/jrpc.rb | Rewired gem entrypoint requires to the new 2.0 architecture. |
| jrpc.gemspec | Updated runtime deps and Ruby requirement (>= 3.3). |
| Gemfile | Added dev tooling dependencies (rubocop, async for fiber specs). |
| CHANGELOG.md | Added 2.0.0 release notes and breaking-change summary. |
| bin/jrpc-shell | Rewritten shell to use SimpleClient and updated parsing/usage. |
| bin/jrpc | Rewritten CLI to use SimpleClient and revised flags/options. |
| bin/console | Added frozen string literal pragma. |
| .travis.yml | Removed legacy Travis CI config. |
| .rubocop.yml | Added RuboCop configuration and plugins. |
| .rspec | Ensures spec_helper is required by default. |
| .github/workflows/ci.yml | Added GitHub Actions CI for RuboCop + RSpec on Ruby 3.3/3.4. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Full rewrite. JRPC 2.0 is not API-compatible with 1.x.
New
JRPC::SharedClient— one shared instance, one connection, serving many callerthreads and/or fibers. Owns a dedicated transport thread that multiplexes
responses by id. Supports Puma threads, rage-rb/Falcon fibers, and mixed
thread/fiber callers. Fiber callers require a spec-compliant
Fiber.scheduler.(Internally drafted as
ThreadQueueClient; never shipped under that name.)JRPC::SimpleClient— single-threaded client, the functional replacement forthe old
TcpClient.concurrent-ruby(~> 1.2) added as a runtime dependency (backs the sharedclient's result futures).
loggeradded as an explicit runtime dependency (no longer guaranteed bundledon Ruby 3.5+).
Removed / breaking
JRPC::TcpClientremoved — useJRPC::SimpleClient.JRPC::BaseClientremoved, including theBaseClient.connectblock helper.JRPC::Errors::*.method_missingmagic removed — pass the full method name as a String or Symbol.invoke_request/invoke_notificationremoved.perform_requestremoved — userequestandnotification.namespace:option removed.timeout:option removed — useread_timeout/write_timeout/connect_timeout(SimpleClient), orttl:(SharedClient).close_after_sent:renamed toautoclose:.connect_retry_countdefault changed from10to0.Errors::MalformedResponseError(aServerError),not
ClientError. In 1.x the missing-comma-terminator case raisedClientError.SimpleClientread/write/connect timeouts now raiseErrors::Timeout, notConnectionError.ojruntime dependency dropped — JRPC uses stdlibjson. For Oj speed,require 'oj'; Oj.mimic_JSONyourself.netstringis no longer a dependency — framing is owned in-tree by the transport.required_ruby_versionset to>= 3.3(the floor where theConditionVariable↔Fiber.schedulercooperation that fiber callers depend onis verified).
bin/jrpcandbin/jrpc-shellrewritten on top ofSimpleClient; flag/usagechanges (see
README.mdandjrpc --help).