Drop r-result dependency in favour of an inlined Result type#26
Conversation
|
Warning Review limit reached
Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The connect() promise resolves to a Result (Ok/Fail). This was the only use of the r-result package, so inline the type and remove the runtime dependency. The full r-result instance API is ported verbatim -- ok, fail, isOk, isFail, map, mapFail, and, or, andThen, orElse, toArray, unwrapOr, unwrapOrElse, match, inspect, debug, debugOk, debugFail -- so Result objects are behaviourally identical to r-result. No breaking change for consumers. Also updates the readme reference and removes r-result from package.json / package-lock.json (the package now has zero runtime dependencies).
5b2cc7b to
2705323
Compare
|
@coderabbitai code review |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh pr diff 26 --repo silverbucket/irc-socket-saslLength of output: 8325 🏁 Script executed: #!/bin/bash
cd /tmp 2>/dev/null
rg -n "r-result|rresult" -g '!package-lock.json' . 2>/dev/null | head -50Length of output: 1209 🏁 Script executed: #!/bin/bash
pwd
ls
rg -n "r-result|rresult" -g '!package-lock.json'Length of output: 476 🏁 Script executed: #!/bin/bash
cat -n irc-socket.js | sed -n '1,40p'
echo "---"
grep -n "Ok(\|Fail(" irc-socket.js | head -60
echo "---tests---"
rg -n "r-result|require\(.irc-socket" test | head -20Length of output: 3097 🏁 Script executed: #!/bin/bash
fd . test
echo "---"
rg -n "map|andThen|match|unwrapOr|debug" test | head -40Length of output: 1473
What I checked:
One minor, non-blocking observation: the existing committed test suite ( Overall: no functional issues found, LGTM. ✅ Action performedReview finished.
|
Addresses the review suggestion on #26: the inlined Result type was only exercised indirectly through connect() flows (ok/fail/isOk/isFail), so the remaining methods (map/andThen/match/unwrapOr/inspect/debug/etc.) had no permanent CI coverage. Move the Result type from irc-socket.js into result.js and add test/result.js, which covers every method plus a parity check asserting the instance exposes exactly the r-result method set. No behaviour change; irc-socket.js now requires ./result.js.
|
Addressed the review suggestion in 54bdbf0. The inlined Result type is now extracted into its own module (
|
Summary
Removes the sole runtime dependency,
r-result, by inlining the Result type. No breaking changes — the full r-result instance API is ported verbatim, so Result objects are behaviorally identical.The
connect()promise resolves to aResult(Ok/Fail). That was the only thing the package provided, so it's now defined directly inirc-socket.js.No breaking changes
All 18 r-result instance methods are preserved with identical semantics:
ok,fail,isOk,isFail,map,mapFail,and,or,andThen,orElse,toArray,unwrapOr,unwrapOrElse,match,inspect,debug,debugOk,debugFailTypeError, with the same custom-message behavior.inspectmethod is ported verbatim, matching r-result exactly (including that modern Node no longer auto-invokes a string-namedinspectforutil.inspect— this is unchanged from r-result).Verified with an exhaustive method-by-method behavioral check in addition to the existing suite.
Changes
irc-socket.js: inline theOk/FailResult type; droprequire("r-result").package.json/package-lock.json: remove ther-resultdependency (the package now has zero runtime dependencies).readme.md: update the description of the resolved value.Tests
Full suite passes (51 passing). The existing tests exercise
.ok(),.fail(),.isOk(), and.isFail()across success and every failure path; a separate exhaustive check covers the remaining methods (map,andThen,match,unwrapOr, etc.).