fix: improve mesh topology assertion to wait for connection formation#103
Merged
fix: improve mesh topology assertion to wait for connection formation#103
Conversation
The test creates a 7-node network (6 peers + 1 gateway) but peers default to min_connections=25, which is unachievable. This causes perpetual topology churn as peers endlessly try to reach the minimum, destabilizing existing connections and breaking UPDATE propagation. Setting min=4, max=5 gives peers achievable targets, eliminating the connection churn that was causing flaky test failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The mesh assertion previously checked once and only required that peers have at least 1 P2P connection. This was too weak — peers with only 1-2 connections can't reliably propagate subscription updates, causing the six-peer test to fail. Now the assertion polls every 10 seconds for up to 90 seconds, waiting until ALL peers have at least 2 P2P connections. This gives the topology manager time to establish connections through Docker NAT, which can be slow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The six-peer regression test consistently fails because the mesh topology assertion
is too weak — it only checks that peers have at least 1 P2P connection, then
proceeds with the test. Most peers end up with only 2-3 connections (below
min_connections=4), causing subscription updates to not propagate.
Approach
Replace the one-shot assertion with a polling loop that waits up to 90 seconds
for all peers to reach at least 2 P2P connections. This gives the topology manager
time to establish connections through Docker NAT.
Testing
This addresses the consistent six-peer-regression failures seen on freenet-core
PRs #3023 and #3031. The connections are stable (no drops after the keepalive fix
in freenet-core) but insufficient due to slow formation through Docker NAT.
[AI-assisted - Claude]