Skip to content

fix: add post-subscription propagation delay for six-peer test#104

Merged
sanity merged 3 commits intomainfrom
fix/six-peer-connection-limits
Feb 16, 2026
Merged

fix: add post-subscription propagation delay for six-peer test#104
sanity merged 3 commits intomainfrom
fix/six-peer-connection-limits

Conversation

@sanity
Copy link
Contributor

@sanity sanity commented Feb 16, 2026

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 CacheAnnounce messages 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]

sanity and others added 3 commits February 15, 2026 18:14
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>
@sanity sanity merged commit d552b6d into main Feb 16, 2026
1 check failed
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.

1 participant