Fix deriveEventsByIdForUrl relay scoping to prevent cross-space event leakage #214

Closed
opened 2026-04-16 20:15:15 +00:00 by userAdityaa · 3 comments
Collaborator

Description

deriveEventsByIdForUrl currently reacts to tracker add/remove updates for any relay URL, not strictly the store target URL. This causes per-relay stores to include events from other relays and remove events incorrectly when unrelated relay mappings change.

Impact:

  • Inflates per-space store size
  • Causes extra update churn
  • Increases GC pressure in multi-space usage

Expected

  • storeA only contains events tracked on wss://a.
  • storeB only contains events tracked on wss://b.
  • Removing mapping from wss://b should not affect storeA unless event is no longer tracked on wss://a.

Related to: Improve Performace (#182)

### Description `deriveEventsByIdForUrl` currently reacts to tracker add/remove updates for any relay URL, not strictly the store target URL. This causes per-relay stores to include events from other relays and remove events incorrectly when unrelated relay mappings change. ### Impact: * Inflates per-space store size * Causes extra update churn * Increases GC pressure in multi-space usage ### Expected * storeA only contains events tracked on wss://a. * storeB only contains events tracked on wss://b. * Removing mapping from wss://b should not affect storeA unless event is no longer tracked on wss://a. Related to: [Improve Performace (#182)](https://gitea.coracle.social/coracle/flotilla/issues/182)
Author
Collaborator

Hey @hodlbod, what are your thoughts on this?

I haven’t self-assigned it, if this is something that should be worked on now, I’d be happy to take it on. Thanks.

Hey @hodlbod, what are your thoughts on this? I haven’t self-assigned it, if this is something that should be worked on now, I’d be happy to take it on. Thanks.
userAdityaa added the dev label 2026-04-16 20:15:40 +00:00
Owner

Thank you, great observation. I put together a quick fix, let me know if you think this solves it: https://github.com/coracle-social/welshman/commit/2020276bf60a110aee26850a3d5d7110353c259e

Thank you, great observation. I put together a quick fix, let me know if you think this solves it: https://github.com/coracle-social/welshman/commit/2020276bf60a110aee26850a3d5d7110353c259e
Author
Collaborator

Thank you for the quick fix, I went through the changes and verified the behaviour.
This resolves the issue from my side, closing this.

Thank you for the quick fix, I went through the changes and verified the behaviour. This resolves the issue from my side, closing this.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coracle/flotilla#214