Revert #3331: don't throw on missing network_id in getServerInfo#3379
Revert #3331: don't throw on missing network_id in getServerInfo#3379ckeshava wants to merge 1 commit into
Conversation
The SDK must not enforce network_id rules more strictly than a rippled node does for custom XRPL networks. getServerInfo() once again logs server_info failures via console.error and leaves networkID undefined instead of throwing. HISTORY.md gets a revert entry rather than reverting the original changelog lines. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Walkthrough
ChangesRevert getServerInfo throwing behavior
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: one or more packages not found in the registry. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/xrpl/src/client/index.ts (1)
539-547: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep a regression test for the restored behavior.
Since
connect()depends on this method resolving, add a focused test thatserver_inforejection logs viaconsole.error,connect()/getServerInfo()resolves, andnetworkIDremains undefined for a fresh client.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/xrpl/src/client/index.ts` around lines 539 - 547, The error handling in the server_info fetch path should preserve the restored connect behavior while being covered by regression tests. Update the tests around the getServerInfo()/connect() flow in Client to verify that a rejected server_info request is logged through console.error, that connect() still resolves successfully, and that a fresh client leaves networkID undefined after the failure. Use the Client methods getServerInfo and connect, and assert the console.error side effect plus the unresolved info state for a new client instance.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/xrpl/src/client/index.ts`:
- Around line 526-528: Update the JSDoc for getServerInfo to document its
non-throwing failure behavior: when server_info fails, the promise still
resolves, the existing fields may remain stale, and the error is logged. Make
sure the comment near getServerInfo and any related return description reflect
this contract clearly so callers do not expect an exception.
---
Nitpick comments:
In `@packages/xrpl/src/client/index.ts`:
- Around line 539-547: The error handling in the server_info fetch path should
preserve the restored connect behavior while being covered by regression tests.
Update the tests around the getServerInfo()/connect() flow in Client to verify
that a rejected server_info request is logged through console.error, that
connect() still resolves successfully, and that a fresh client leaves networkID
undefined after the failure. Use the Client methods getServerInfo and connect,
and assert the console.error side effect plus the unresolved info state for a
new client instance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 362ed722-3cd1-4d1a-862d-31f7e6675f9b
📒 Files selected for processing (3)
packages/xrpl/HISTORY.mdpackages/xrpl/src/client/index.tspackages/xrpl/test/client/getServerInfo.test.ts
💤 Files with no reviewable changes (1)
- packages/xrpl/test/client/getServerInfo.test.ts
Reverts the code changes from #3331.
xrpl.js must not enforce
network_idrules more strictly than a rippled node does for custom XRPL networks.Client.getServerInfo()again logsserver_infofailures viaconsole.errorand leavesclient.networkIDundefined instead of throwing, and the test added in #3331 is removed.HISTORY.md keeps the original 5.0.0 changelog lines and instead gains a new Unreleased → Fixed entry recording the revert.
🤖 Generated with Claude Code