Skip to content

fix: flaky Kademlia test#7002

Merged
hanabi1224 merged 1 commit intomainfrom
hm/flaky-kad-test
May 5, 2026
Merged

fix: flaky Kademlia test#7002
hanabi1224 merged 1 commit intomainfrom
hm/flaky-kad-test

Conversation

@hanabi1224
Copy link
Copy Markdown
Contributor

@hanabi1224 hanabi1224 commented May 5, 2026

Summary of changes

Changes introduced in this pull request:

  • fix a bug that full_peers metric was only updated when a remote peer gets disconnected.
  • update test node setup to also listen on quic-v1 protocol

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

Release Notes

  • Tests

    • Updated test suite to support both TCP and UDP/QUIC network protocols for comprehensive protocol coverage.
    • Enhanced stateless node test configurations with expanded network endpoint support.
  • Chores

    • Refined peer metrics collection for improved monitoring.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1b1ce70b-066b-4d5b-98ea-88220d7017b6

📥 Commits

Reviewing files that changed from the base of the PR and between 420a5ab and e42378d.

📒 Files selected for processing (4)
  • scripts/tests/calibnet_kademlia_check.sh
  • scripts/tests/calibnet_stateless_mode_check.sh
  • scripts/tests/harness.sh
  • src/libp2p/peer_manager.rs

Walkthrough

This PR adds UDP/QUIC endpoint support to Forest test node configurations across three shell scripts and improves metrics instrumentation in the peer manager by explicitly updating the full-peer gauge during success and failure logging operations.

Changes

Network Configuration – UDP/QUIC Support

Layer / File(s) Summary
Peer ID Extraction
scripts/tests/calibnet_stateless_mode_check.sh
STATELESS_NODE_PEER_ID extraction changes from fixed field index to extracting the last path segment via rev/cut operations.
Network Listening Endpoints
scripts/tests/calibnet_kademlia_check.sh, scripts/tests/calibnet_stateless_mode_check.sh, scripts/tests/harness.sh
Generated Forest node configurations now include both TCP and UDP/QUIC-v1 listening multiaddrs instead of TCP-only (e.g., ["/ip4/127.0.0.1/tcp/0", "/ip4/127.0.0.1/udp/0/quic-v1"]).

Peer Manager Metrics

Layer / File(s) Summary
Metrics Instrumentation
src/libp2p/peer_manager.rs
log_success and log_failure methods now explicitly update the metrics::FULL_PEERS gauge after mutating the full-peers list; remove_peer uses explicit as i64 cast for consistency.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • LesnyRumcajs
  • akaladarshi
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix: flaky Kademlia test' directly corresponds to the primary objectives, which focus on fixing a bug affecting the Kademlia test's reliability by correcting the full_peers metric update behavior and updating test node protocol configuration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hm/flaky-kad-test
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch hm/flaky-kad-test

Comment @coderabbitai help to get the list of available commands and usage tips.

@hanabi1224 hanabi1224 marked this pull request as ready for review May 5, 2026 11:28
@hanabi1224 hanabi1224 requested a review from a team as a code owner May 5, 2026 11:28
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and sudo-shashank and removed request for a team May 5, 2026 11:28
@hanabi1224 hanabi1224 enabled auto-merge May 5, 2026 11:43
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.10%. Comparing base (420a5ab) to head (e42378d).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/libp2p/peer_manager.rs 33.33% 2 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/libp2p/peer_manager.rs 22.70% <33.33%> (-0.23%) ⬇️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 420a5ab...e42378d. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hanabi1224 hanabi1224 added this pull request to the merge queue May 5, 2026
@hanabi1224 hanabi1224 removed this pull request from the merge queue due to a manual request May 5, 2026
@hanabi1224 hanabi1224 added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 6979e17 May 5, 2026
64 of 65 checks passed
@hanabi1224 hanabi1224 deleted the hm/flaky-kad-test branch May 5, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants