Repository navigation
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved moderate signature mismatches remain in the reviewed files.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 6
Open (6)
What changed in this PR
Adds RBS type definitions for the Net::Ping class hierarchy and public constants.
Changes:
- Added signatures under
sig/net/ping/. - Defined WMI status and version types.
- Captured implementation-specific return types; no
lib/changes.
| File | Findings |
|---|---|
sig/net/ping/wmi.rbs |
Moderate (3 votes): Add the WMI::PingStatus constant alias. |
sig/net/ping/version.rbs |
No findings. |
sig/net/ping/udp.rbs |
No findings. |
sig/net/ping/tcp.rbs |
Moderate (3 votes): Include false in TCP#ping’s return type. |
sig/net/ping/ping.rbs |
Moderate (3 votes): Include String in exception’s type. Moderate (1 vote): Permit string ports in readers and constructors. |
sig/net/ping/icmp.rbs |
Moderate (3 votes): Include false in ICMP#ping; remove the inherited port= writer. Moderate (1 vote): Declare the optional initialization block. |
sig/net/ping/http.rbs |
Moderate (3 votes): Make private redirect?’s result nilable. |
sig/net/ping/external.rbs |
No findings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
bea11c7 to
9fd8367
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved moderate RBS accuracy issues remain in several signatures.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 7
Open (7)
Widen response return type to bool or nil · New Model ICMP port writer as unavailable · New Accept constructor block in ICMP initialize · New Include false in ICMP ping return type · New Include String in exception reader type · New Include false in TCP ping return type · New Declare nested WMI PingStatus constant alias · New
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Address the three moderate type-definition issues concerning service-name ports and exception class objects.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
Resolved since last review (7)
9fd8367 to
244ad0f
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved findings cover CI validation, initializer self typing, WMI option keys, and inaccurate return-type documentation.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
c98e0c3 to
9a5f643
Compare
9a5f643 to
544a9f2
Compare
544a9f2 to
ccfb5f3
Compare
Covers Ping and its TCP/UDP/ICMP/External/HTTP/WMI subclasses. Validated with `rbs validate`. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ccfb5f3 to
dcd8d3c
Compare



What
Add RBS type signatures for the
Net::Pingclass hierarchy (Ping,TCP,UDP,ICMP,External,HTTP,WMI) undersig/net/ping/.Why
The gem had no type definitions, so consumers using Steep/RBS-based type checking had no static type information for this library's public API.
Changes
sig/net/ping/{ping,tcp,udp,icmp,external,http,wmi,version}.rbs, mirroringlib/net/ping/.Ping::WMI#ping's return type is declared asStruct::PingStatus(defined at the top-levelStructnamespace, matching whereStruct.new('PingStatus', ...)actually creates the constant at runtime), with aPingStatus: singleton(::Struct::PingStatus)constant alias insideWMIfor the equivalentNet::Ping::WMI::PingStatusreference the source also creates.Ping::TCP#pingandPing::ICMP#pingare typed asFloat | false | nil: the method body ends with@duration = ... if bool, which evaluates to the duration ornilon the normal path, but both methods also have explicit earlyreturn falsebranches on socket/timeout failures.UDP,External, andHTTPexplicitly returnbooland are typed accordingly.Ping#exceptionis typed as(Exception | String | singleton(Errno::ECONNREFUSED))?:TCP/UDP/ICMPassign real exception instances (and TCP assigns theErrno::ECONNREFUSEDclass object itself on one branch), whileExternal/HTTPonly ever assignStringmessages.Ping#port(and the corresponding constructor parameter, including theUDP/ICMP/HTTPinitializer overrides) is typed as(Integer | String)?, sinceport=documents andexamples/example_pingtcp.rbdemonstrates passing a service-name string such as"http".Ping::HTTP#redirect?(private) is typed as returningbool?sinceresponse && ...evaluates tonilwhenresponseisnil.Ping::ICMPoverrides the inheritedport=as((Integer | String)?) -> bot, sinceundef_method :port=inlib/net/ping/icmp.rbmakes any call raiseNoMethodErrorat runtime and RBS has no syntax to un-declare an inherited method;botdocuments the call as unreachable, following the same convention stdlib sigs use for methods that always raise.Ping::WMI#ping/#ping?acceptHash[Symbol | String, untyped]foroptions, sincelib/net/ping/wmi.rbinterpolates option keys without restricting them to symbols.lib/ornet-ping.gemspec— the gemspec already globs**/*, so the newsig/files are picked up automatically.Validated with
rbs validateand cross-checked the method surface againstrbs prototype rb. Went through several rounds of Copilot review; all findings were verified against the implementation before being applied.