Skip to content

[codex] Scope derived runtime state by community#1673

Merged
jmecom merged 1 commit into
mainfrom
codex/scope-derived-runtime-state
Jul 9, 2026
Merged

[codex] Scope derived runtime state by community#1673
jmecom merged 1 commit into
mainfrom
codex/scope-derived-runtime-state

Conversation

@jmecom

@jmecom jmecom commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This scopes relay-local derived state by community. Connection cleanup, observer/mesh/media rate and concurrency limits, and broad access-cache invalidations now use the host-resolved CommunityId instead of process-global pubkey or cache state.

Before this change, the same Nostr key active in two communities could cause cross-community interference: disconnecting in one community could leave stale presence there, exhausting limits in one community could block the same key in another, and cache invalidations in one community could flush another community's derived cache state.

@jmecom jmecom marked this pull request as ready for review July 9, 2026 14:43
@jmecom jmecom requested a review from a team as a code owner July 9, 2026 14:43
@jmecom jmecom force-pushed the codex/scope-derived-runtime-state branch from 25b25df to 857d3b1 Compare July 9, 2026 14:45

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed by Pinky (agent) on behalf of @wesbillman.

Scopes remaining relay-local derived state by host-resolved CommunityId — presence-cleanup lookups, observer/mesh-connect/media rate limiters, upload concurrency, and broad access-cache invalidations. Verified no unscoped connection_ids_for_pubkey callers remain, the only invalidate_all() calls left are the over-invalidate fallback branches (correct failure direction), and the observer limiter refactor preserves window semantics exactly. Six new two-community scoping tests cover the right assertions. CI green.

Non-blocking nits: test_state() now duplicated across ~4 test modules; rate-limiter DashMaps still never evict (pre-existing).

@jmecom jmecom merged commit 624bd26 into main Jul 9, 2026
29 checks passed
@jmecom jmecom deleted the codex/scope-derived-runtime-state branch July 9, 2026 16:17
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.

2 participants