Skip to content

docs: members-only matchmaking at scale — design log (DO NOT MERGE yet)#475

Draft
metis-sprock wants to merge 4 commits into
mainfrom
docs/members-only-at-scale-design
Draft

docs: members-only matchmaking at scale — design log (DO NOT MERGE yet)#475
metis-sprock wants to merge 4 commits into
mainfrom
docs/members-only-at-scale-design

Conversation

@metis-sprock

Copy link
Copy Markdown
Collaborator

Draft / discussion artifact — do not merge. Resume point for the members-only-at-scale design.

Captures the full design + the grounded current-state (with file:line citations) so we don't re-investigate when we come back:

  • Current state: role→users RoleCache blob with O(guild-size) write-amplification per change + 60s full reload; gate Branch A (in-mem) vs Branch B (live Discord on the hot path, fails open); purely lazy population; GuildMemberAdd no-op; no role-change handlers; no JWT claims; 30s deny-retry already exists.
  • Core insight: invert role→users → user→roles. O(1) writes, no roster, same shape as bans.
  • Principles: Discord write-only to us; allow eventually-consistent, deny strongly-consistent; JWT carries membership never bans; deny-once-retry.
  • Open decisions: EVRL Member-role config (decides if Branch B is a live fix or future-proofing); JWT should carry guild group roles/permissions for efficient access control #228 claim vs session-param.

Next: get EVRL's config, run through /review-plan, then scope implementation. Related: #228, #467.

When replaceTicket fires after a late arrival cancellation (or any
fallback rebuild), the party handler is now re-queried for the current
member list. Previously the stale snapshot from configureParty was
reused, causing rebuilt tickets to have presences=1 even when new
members had joined.

Root cause: cancelTicketForLateArrival called MatchmakerRemoveAll which
only removes tickets keyed by party ID. When the leader initially had a
party of 1, addTicket takes the solo path and creates a ticket with an
empty party ID. MatchmakerRemoveAll could not find or cancel it.

Fix:
- cancelTicketForLateArrival now also calls RemoveSessionAll to cancel
  solo tickets that have no party ID
- Added a ticketRebuildCh channel on PartyHandler so the late arrival
  can signal the leader's lobbyMatchMakeWithFallback loop to rebuild
  immediately instead of waiting for the fallback timer
- lobbyMatchMakeWithFallback selects on ticketRebuildCh alongside the
  existing fallback and timeout timers

Observed in production: leader submitted 3 consecutive solo tickets
while a party member was present and triggering cancellation each time.

Fixes #459
When a player is in an active Arena/Combat match, party follow events
are now ignored. The party waits until the player returns to social.

Also adds a fast-path check (isFollowerAlreadyInLeaderMatch) to skip
redundant follow processing when the follower is already in the
leader's match, preventing unnecessary "Joined party group" churn.

Observed in production: player mid-match was yanked back to social
when their party leader hit matchmaking.

Fixes #460
When the party follow path directs a player to a social lobby they're
already in, it's now silently treated as success instead of producing
an error.

Fixes #462
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