Skip to content

Conversation

@j-rafique
Copy link
Contributor

No description provided.

@roomote
Copy link

roomote bot commented Jan 13, 2026

Rooviewer Clock   See task on Roo Cloud

Reviewed the latest changes (post-review fixes). No issues found.

Changes in this update:

  • Centralized INTEGRATION_TEST environment variable check into integrationTestEnabled() helper function
  • Added proper error handling for hex decode failures in replication key processing (previously silently ignored)
  • Extracted assignReplicationKeysToPeers() into a testable function with unit tests
  • Changed database operations to use context-aware SelectContext() for graceful cancellation handling
  • Improved logging: context cancellation errors now log at Debug level instead of Error (expected behavior during shutdown)
  • Enhanced routing allowlist empty-state messaging to distinguish bootstrap vs. update phases
  • Added comprehensive tests for replication key assignment and limit extension behavior
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

roomote[bot]
roomote bot previously approved these changes Jan 13, 2026
roomote[bot]
roomote bot previously approved these changes Jan 13, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses critical P2P replication and routing issues in a Kademlia DHT implementation by introducing bounded replication windows, routing eligibility gating, and reducing log noise.

Changes:

  • Adds chain-state-based routing eligibility checks to prevent non-active supernodes from participating in the DHT routing table
  • Implements bounded replication key scanning (200k keys per cycle) with stable cursor advancement to enable incremental progress on large backlogs
  • Refactors replication key assignment to use one-pass logic instead of per-peer re-scanning, reducing complexity and resource usage

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
p2p/kademlia/bootstrap.go Returns active supernode IDs as allowlist from chain state and triggers routing table pruning
p2p/kademlia/dht.go Implements routing eligibility gating infrastructure and filters ineligible nodes from routing operations
p2p/kademlia/node_activity.go Adds eligibility checks to node activity monitoring and ping success handlers
p2p/kademlia/replication.go Implements bounded key scanning, one-pass key assignment, and stable window-based cursor advancement
p2p/kademlia/store.go Updates interface to accept maxKeys parameter for bounded queries
p2p/kademlia/store/mem/mem.go Updates signature to match new interface
p2p/kademlia/store/sqlite/replication.go Implements bounded query with limit extension for same-timestamp keys and context cancellation checks
p2p/kademlia/store/sqlite/sqlite.go Reduces log noise by treating context timeout/cancellation as Info instead of Error
p2p/kademlia/redundant_data.go Updates call to use unlimited keys for cleanup operations
docs/p2p-replication-and-routing-changes-2026-01-13.md Comprehensive documentation of changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@j-rafique j-rafique merged commit 92f073c into master Jan 22, 2026
7 checks passed
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