fix: Peer crawler port field type inconsistency - #6318
Conversation
|
@copilot please add tests (or modify tests if they already exist) |
Added
|
|
@copilot tests appear to be failing, please fix |
... Fixed in commit f089cff:
|
|
@copilot actually, just pull out the tests - they seem to be more of a headache than they're worth for such a small change. We can test manually. |
Removed the test file and reverted the friend declaration in commit 28a1796. |
There was a problem hiding this comment.
Pull request overview
Fixes a type inconsistency in the Peer Crawler /crawl overlay response by ensuring overlay.active[].port is always emitted as a JSON integer (previously a string for outbound peers).
Changes:
- Update
/crawloverlay serialization so outbound peers’portis emitted as a number (consistent with inbound). - Replace inline
"active","in", and"out"literals withjssconstants. - Document the behavior change in
API-CHANGELOG.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/xrpld/overlay/detail/OverlayImpl.cpp | Emits outbound port as an integer and uses jss::active / jss::in / jss::out. |
| include/xrpl/protocol/jss.h | Adds jss::active, jss::in, and jss::out tokens. |
| API-CHANGELOG.md | Notes the Peer Crawler port type consistency change under 3.1.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ### Bugfixes in 3.1.0 | ||
|
|
There was a problem hiding this comment.
The changelog sectioning is inconsistent: this file uses headings like "Additions in X.Y.Z" or "Additions and bugfixes in X.Y.Z" elsewhere, but "### Bugfixes in 3.1.0" appears to be the only standalone bugfix heading. Consider merging this entry into the existing 3.1.0 heading (e.g., rename to "Additions and bugfixes in 3.1.0" or include the bullet under an existing heading) to keep the document structure consistent.
| @@ -30,6 +30,10 @@ This version is supported by all `rippled` versions. For WebSocket and HTTP JSON | |||
|
|
|||
| - `vault_info`: New RPC method to retrieve information about a specific vault (part of XLS-66 Lending Protocol). ([#6156](https://github.com/XRPLF/rippled/pull/6156)) | |||
|
|
|||
| ### Bugfixes in 3.1.0 | |||
|
|
|||
| - Peer Crawler: The `port` field in `overlay.active[]` now consistently returns an integer instead of a string for outbound peers. | |||
There was a problem hiding this comment.
This new changelog bullet doesn’t include a PR reference, while most other entries include a link like "(#NNNN)". Please add the relevant PR number/link for traceability.
| - Peer Crawler: The `port` field in `overlay.active[]` now consistently returns an integer instead of a string for outbound peers. | |
| - Peer Crawler: The `port` field in `overlay.active[]` now consistently returns an integer instead of a string for outbound peers. ([#6156](https://github.com/XRPLF/rippled/pull/6156)) |
42f6b94 to
aea548b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6318 +/- ##
=========================================
- Coverage 79.8% 79.8% -0.0%
=========================================
Files 878 878
Lines 68026 68026
Branches 7555 7560 +5
=========================================
- Hits 54300 54290 -10
- Misses 13726 13736 +10
🚀 New features to boost your workflow:
|
kuznetsss
left a comment
There was a problem hiding this comment.
LGTM, just a few questions
|
@copilot please review the PR comments and evaluate/address them |
- Change outbound peer port from string to integer in getOverlayInfo() - Add "active", "in", "out" JSS constants to jss.h - Update API-CHANGELOG.md with bugfix note Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
6cd5875 to
5360db2
Compare
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com> Co-authored-by: Mayukha Vadari <mvadari@gmail.com> Co-authored-by: Mayukha Vadari <mvadari@ripple.com> Co-authored-by: Bart <bthomee@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com> Co-authored-by: Mayukha Vadari <mvadari@gmail.com> Co-authored-by: Mayukha Vadari <mvadari@ripple.com> Co-authored-by: Bart <bthomee@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com> Co-authored-by: Mayukha Vadari <mvadari@gmail.com> Co-authored-by: Mayukha Vadari <mvadari@ripple.com> Co-authored-by: Bart <bthomee@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com> Co-authored-by: Mayukha Vadari <mvadari@gmail.com> Co-authored-by: Mayukha Vadari <mvadari@ripple.com> Co-authored-by: Bart <bthomee@users.noreply.github.com>
High Level Overview of Change
The Peer Crawler API returns
portas a string for outbound peers but as an integer for inbound peers. This fixes the inconsistency by makingportalways return as an integer.Context of Change
Bug introduced in the original peer crawler implementation (PR #1017, RIPD-866). Outbound peers used
std::to_string()on the port while inbound peers assigned the numeric value directly.Also moves inline string literals
"active","in","out"tojss.hper repo conventions.Type of Change
API Impact
Note: This affects the special peer-port API, not the standard RPC API, so API versioning does not apply.
Before / After
Before: Outbound peers return port as string
{"active": [{"type": "out", "port": "51235", ...}]}After: All peers return port as integer
{"active": [{"type": "out", "port": 51235, ...}]}Test Plan
Manual testing is recommended for this change. Call the peer crawler on a server that has both incoming and outgoing peers and verify:
portfield is returned as an integer for both inbound and outbound peerstypefield uses the expected "in"/"out" valuesOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.