Repository navigation
Conversation
…fill decisions RemovePlayerFromQueue followed battleground links and removed seated participants from running matches; guard with IsActivePlayer. Add the missing observability: backfill invites (per-team active/invited counts), rejected join confirmations (a desync source behind an observed 11v10), and invite expirations.
There was a problem hiding this comment.
🟡 Changes recommended
There is a confirmed high-impact correctness risk around taking the address of a range variable (&bg) plus missing tests for the new “don’t yank active players” guard and link-unlink scoping concerns.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes a queue-removal edge case that could incorrectly eject active battleground participants, and adds trace logging to make backfill/invite-related desyncs (e.g., 11v10) diagnosable.
Changes:
- Add backfill decision logs (per team) when inviting groups into in-progress battlegrounds.
- Log and surface errors when join confirmations are rejected, and prevent
RemovePlayerFromQueuefrom removing active/seated battleground participants. - Add invite-expiration logging and attempt to limit invite-expiry cleanup to the affected battleground.
File summaries
| File | Description |
|---|---|
| apps/matchmakingserver/service/battleground-queue.go | Adds backfill invite tracing; review also flags a correctness issue around passing &bg from a range loop. |
| apps/matchmakingserver/service/battleground_service.go | Adds join-rejection logging, prevents queue removal from yanking active players, and adds invite-expiry tracing/unlinking. |
| apps/matchmakingserver/battleground/battleground.go | Adds IsActivePlayer helper used to guard queue-removal behavior. |
Review details
Suppressed comments (1)
apps/matchmakingserver/service/battleground-queue.go:179
- Same as above: this backfill trace is on a hot path and can spam Info logs under load; Debug (or sampling) is usually safer for per-iteration decisions.
log.Info().
- Files reviewed: 3/3 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if freeSlotsAlliance > 0 { | ||
| groupsToInvite := q.findGroupsForGivenSlots(freeSlotsAlliance, battleground.TeamAlliance) | ||
| if len(groupsToInvite) > 0 { | ||
| log.Info(). |
Comment on lines
+199
to
+203
| // IsActivePlayer reports whether the player is a seated participant. | ||
| func (b *Battleground) IsActivePlayer(playerGUID uint64, realmID uint32) bool { | ||
| unwrappedGUID := guid.PlayerUnwrapped{ | ||
| RealmID: uint16(realmID), | ||
| LowGUID: guid.LowType(playerGUID), |
Comment on lines
+775
to
+779
| // "Remove from queue" must never yank a seated participant out of | ||
| // a running match — active players leave through | ||
| // PlayerLeftBattleground only. Only invite/queue links are undone. | ||
| if bg.IsActivePlayer(playerGUID, realmID) { | ||
| continue |
Comment on lines
+883
to
+887
| s.removeBattlegroundLinkForPlayer(BattlegroundKey{ | ||
| RealmID: bg.RealmID, | ||
| InstanceID: bg.InstanceID, | ||
| BattlegroupID: bg.BattleGroupID, | ||
| }, uint64(invite.GUID.LowGUID), uint32(invite.GUID.RealmID)) |
| Int("invited", len(bg.InvitedPlayersPerTeam[battleground.TeamAlliance])). | ||
| Int("groups", len(groupsToInvite)). | ||
| Msg("backfill invites alliance") | ||
| q.inviteGroupsToBG(groupsToInvite, &bg, battleground.TeamAlliance) |
This was referenced Aug 30, 2026
Review follow-ups: unit tests for Battleground.IsActivePlayer (seated players only, realm-aware) and for RemovePlayerFromQueue keeping a seated participant untouched - a regression would either mutate the battleground state or panic on the fixture's nil events producer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two issues found while chasing an 11v10:
Verified live: the traces made the 11v10 reproducible and the guard removes the yank; backfill decisions are now auditable per team (active/invited counts).