Skip to content

fix(gossip): stop a mesh of strangers from crowding out the real subscriber - #20

Merged
ForeverInLaw merged 1 commit into
mainfrom
fix/mesh-minimum-counts-confirmed
Jul 28, 2026
Merged

fix(gossip): stop a mesh of strangers from crowding out the real subscriber#20
ForeverInLaw merged 1 commit into
mainfrom
fix/mesh-minimum-counts-confirmed

Conversation

@ForeverInLaw

Copy link
Copy Markdown
Contributor

ensureTopicMeshMinimum measured a topic's mesh with MeshPeers, which counts peers grafted on spec that have never claimed the channel. That broke grafting two ways at once:

  • the DLo check returns early, so no grafting happens; and
  • the slot count is D - len(meshPeers), which is 0 once six strangers are in — so even reaching selectMeshCandidates could not select anyone.

Why it matters: publishing only reaches peers known to subscribe, and a subscription is learned from a GRAFT and nothing else. A counterpart that is connected and genuinely on the channel therefore never receives a publish. Both ends publish into the substrate, neither hears the other, and every counter reads healthy the whole time.

Both quantities now come from ConfirmedMeshPeers — the same correction already applied to maybeDiscoverTopicPeers in #18. This was the identical bug in the second of the two places that consult the mesh; fixing only the first left the door shut.

Test

A mesh of six unconfirmed peers must not stop the one confirmed subscriber from being grafted. Fails on main — and note it fails there even with the DLo check corrected alone, which is how the slot-count half surfaced.

Scope, honestly

This is a real defect and the test pins it, but it is not what unblocked the DM failure I was chasing. That turned out to be a control-frame dedup in mosh dropping every handshake retransmission. This ships on its own merits.

mesh, gossip and transport suites pass; build and vet clean.

…criber

ensureTopicMeshMinimum measured a topic's mesh with MeshPeers, which counts
peers grafted on spec that have never claimed the channel. Two consequences,
both of which keep the one peer that matters out of the mesh:

  - the DLo check returns early, so no grafting happens at all; and
  - the slot count is D - len(meshPeers), which is 0 once six strangers are
    in, so even reaching selectMeshCandidates could not pick anyone.

Publishing only reaches peers known to subscribe — a subscription is learned
from a GRAFT and nothing else — so a counterpart that is connected and on the
channel still never receives a publish. Both ends then publish into the
substrate and neither hears the other, while every counter reads healthy.

Both quantities now come from ConfirmedMeshPeers, matching the fix already
applied to maybeDiscoverTopicPeers; this was the same bug in the second of the
two places that consult the mesh.

The test asserts a mesh of six unconfirmed peers does not stop the one
confirmed subscriber from being grafted. It fails on main.

Note on scope: this is a real defect and the test pins it, but it was not what
unblocked the observed DM failure — a control-frame dedup in mosh was. Ships
on its own merits, not as the fix for that symptom.
@ForeverInLaw
ForeverInLaw merged commit 040ca9a into main Jul 28, 2026
2 checks passed
@ForeverInLaw
ForeverInLaw deleted the fix/mesh-minimum-counts-confirmed branch July 28, 2026 17:45
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