fix: add post-subscription propagation delay for six-peer test#104
Merged
fix: add post-subscription propagation delay for six-peer test#104
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>
…dcast After local subscription confirmation, Freenet peers exchange CacheAnnounce messages to establish bidirectional proximity awareness. In sparse networks (6 peers with Docker NAT), this propagation takes several seconds. Without this delay, UPDATE broadcasts may not reach all subscribers because the proximity cache hasn't established bidirectional awareness yet. This fixes the consistent six-peer-regression failure where messages from one room user never reached the other user despite both peers being locally subscribed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Feb 16, 2026
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 UPDATE messages from one room user never reach the other user, despite both peers being locally subscribed to the room contract.
Root Cause
After local subscription confirmation, Freenet peers exchange
CacheAnnouncemessages to establish bidirectional proximity awareness. In sparse networks (6 peers with Docker NAT, 2-4 P2P connections each), this propagation takes several seconds. Without a delay, UPDATE broadcasts don't reach all subscribers because the proximity cache hasn't established bidirectional awareness yet.Fix
Add a 15-second post-subscription delay (configurable via
RIVER_TEST_SUB_PROPAGATION_SECS) after all peers confirm their subscriptions. This gives the proximity cache time to propagate CacheAnnounce messages bidirectionally before messages are sent.Testing
This addresses the consistent six-peer failure pattern where the mesh topology assertion passes (all peers have >= 2 P2P connections) but message propagation fails.
[AI-assisted - Claude]