Skip to content

fix: team sizing during the port window reads the invited ledger - #175

Merged
FrancescoBorzi merged 2 commits into
masterfrom
fix-172-invited-ledger
Jul 2, 2026
Merged

fix: team sizing during the port window reads the invited ledger#175
FrancescoBorzi merged 2 commits into
masterfrom
fix-172-invited-ledger

Conversation

@FrancescoBorzi

Copy link
Copy Markdown

Fixes #172

Team-sizing decisions made while accepted players are still on the loading screen could not see them, so a solo got flipped onto a porting premade's side (1v3) and reinforcement over-invited during the port window (3v2 under strict EvenTeams). Both BalanceTeamsOnEntry and GetProjectedBaseCounts now read the BG's invited ledger, which tracks exactly that population; rollback via CFBG.BalanceTeamsOnEntry.Enabled = 0 for the first fix, single-commit revert for the second.

AI tooling (Claude Code) was used to investigate and prepare the change.

The corrector compared live head counts, which exclude every invitee
still porting: accept deletes the queue-side GroupQueueInfo without
decrementing the BG's invited count, so a porting premade is invisible
to GetPlayersCountByTeam. A solo entering before the premade landed got
flipped onto the premade's side, starting the match 1v3.

Compare the invited ledger (entered + accepted-in-flight + pending)
instead, minus the entrant's own still-ledgered reservation, and update
the conf.dist description accordingly.

Fixes #172
A player between accept and worldport ack is in neither term of the
projection: the accept deleted their GroupQueueInfo and AddPlayer has
not run yet. Reinforcement during that window saw the side as short and
over-invited onto it, producing 3v2 (or 6v5) starts under strict
EvenTeams.

Clamp each team's projection up to the BG's invited ledger, which keeps
tracking porting players until RemovePlayerAtLeave or invite expiry.

Note: a separate core defect can leak the invited count by +1 when an
accepted port never lands on the BG map (fix proposed upstream in
azerothcore/azerothcore-wotlk). Under max() a stale +1 converts to
under-reinforcement of that side for the instance's lifetime, which
fails safe and resets at BG end.
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@FrancescoBorzi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: de9d7385-4317-42c6-99f3-b5dfef77fcea

📥 Commits

Reviewing files that changed from the base of the PR and between 902f3af and ecfe955.

📒 Files selected for processing (2)
  • conf/CFBG.conf.dist
  • src/CFBG.cpp
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-172-invited-ledger

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@FrancescoBorzi
FrancescoBorzi merged commit c3ed6f9 into master Jul 2, 2026
2 checks passed
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.

Premade into BGs create unbalance

1 participant