Skip to content

fix(anon): let pinned teammates see each other - #4945

Open
Zixer1 wants to merge 1 commit into
mainfrom
feat/anon-teammates-visible
Open

fix(anon): let pinned teammates see each other#4945
Zixer1 wants to merge 1 commit into
mainfrom
feat/anon-teammates-visible

Conversation

@Zixer1

@Zixer1 Zixer1 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

With anonymizeNames on, seesReal was true only for yourself or a viewer granted reveal access — so in a Team game you could not identify your own teammate. A team that cannot coordinate is not a team.

A player now also sees the real name of anyone on their pinned team. Only pinned teams: those are assigned server-side via matchmakingTeams, so the server knows them here. A team game that groups by clanTag/friends is resolved on the clients, so the server has no answer to give and nothing is revealed there.

Safe for the same reason target === viewer already is: this widens only username and cosmetics, neither of which the simulation reads (Player.hash excludes names). clanTag and friends do feed assignTeams and are still blanked identically for every viewer.

Pairs with #4944, which is what lets a bot pin teams in the first place.

With anonymizeNames on, seesReal was true only for yourself or a viewer granted
reveal access, so in a Team game you could not identify your own teammate. A team
that cannot coordinate is not a team.

A player now also sees the real name of anyone on their pinned team. Only pinned
teams: those are assigned server-side (matchmakingTeams), so the server knows
them here. A team game that groups by clanTag/friends is resolved on the clients
and the server has no answer to give, so nothing is revealed there.

Safe for the same reason 'target === viewer' already is: this widens only
username and cosmetics, neither of which the simulation reads (Player.hash
excludes names). clanTag and friends DO feed assignTeams and are still blanked
identically for every viewer.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The server now allows players on the same assigned matchmaking team to see real names and cosmetics when names are anonymized. Tests cover opposing teams, unassigned players, non-matchmade games, symmetry, and blank team-assignment fields.

Changes

Matchmaking team visibility

Layer / File(s) Summary
Team visibility logic and validation
src/server/GameServer.ts, tests/server/AnonymizeNamesTeammates.test.ts
GameServer permits real-name and cosmetic visibility for clients with the same assigned matchmaking team. Tests cover matching, opposing, unassigned, non-matchmade, symmetric, and blank-assignment cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: evanpelle

Poem

Teams align, names appear,
Opposing sides stay unclear.
Empty teams reveal no sign,
Tests keep every rule in line.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: pinned teammates can see each other’s real names.
Description check ✅ Passed The description accurately explains the visibility change, its pinned-team limitation, and its effect on related fields.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

@Zixer1 Zixer1 added this to the v34 milestone Aug 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/server/GameServer.ts`:
- Around line 364-369: The seesReal/gameInfo flow exposes team-assignment data
for pinned teammates while anonymizeNames is enabled. In
src/server/GameServer.ts lines 364-369, keep username and cosmetics visible but
ensure gameInfo returns clanTag as null and friends as undefined; update
tests/server/AnonymizeNamesTeammates.test.ts lines 15-29 so makeClient creates
non-null clanTag and non-empty friends, and lines 109-114 assert those fields
are hidden for every player.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7102cdc8-6865-4e4f-961f-b73027261959

📥 Commits

Reviewing files that changed from the base of the PR and between 49d52b0 and ee8b89e.

📒 Files selected for processing (2)
  • src/server/GameServer.ts
  • tests/server/AnonymizeNamesTeammates.test.ts

Comment thread src/server/GameServer.ts
Comment on lines 364 to 369
private seesReal(viewer: ClientID | undefined, target: ClientID): boolean {
return (
!this.gameConfig.anonymizeNames ||
target === viewer ||
this.sameMatchmadeTeam(viewer, target) ||
this.viewerSeesAllNames(viewer)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Keep team-assignment inputs hidden when teammate identity is visible.

Lines 364-369 make pinned teammates enter gameInfo()'s real branch. That branch sends clanTag and friends at src/server/GameServer.ts lines 1595-1601. This exposes team-assignment inputs when anonymizeNames is enabled. It conflicts with the PR requirement that those fields remain blank for every viewer.

  • src/server/GameServer.ts#L364-L369: keep username and cosmetics visible for pinned teammates, but force clanTag to null and friends to undefined in gameInfo() while anonymizeNames is enabled.
  • tests/server/AnonymizeNamesTeammates.test.ts#L15-L29: allow makeClient() to create clients with non-null clanTag values and non-empty friends values.
  • tests/server/AnonymizeNamesTeammates.test.ts#L109-L114: assert that every player has clanTag === null and friends === undefined.
Proposed fix
-              clanTag: hideClanTags ? null : (c.clanTag ?? null),
+              clanTag:
+                this.gameConfig.anonymizeNames || hideClanTags
+                  ? null
+                  : (c.clanTag ?? null),
               clientID: c.clientID,
-              friends: friendsFor(c),
+              friends: this.gameConfig.anonymizeNames
+                ? undefined
+                : friendsFor(c),
📍 Affects 2 files
  • src/server/GameServer.ts#L364-L369 (this comment)
  • tests/server/AnonymizeNamesTeammates.test.ts#L15-L29
  • tests/server/AnonymizeNamesTeammates.test.ts#L109-L114
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/server/GameServer.ts` around lines 364 - 369, The seesReal/gameInfo flow
exposes team-assignment data for pinned teammates while anonymizeNames is
enabled. In src/server/GameServer.ts lines 364-369, keep username and cosmetics
visible but ensure gameInfo returns clanTag as null and friends as undefined;
update tests/server/AnonymizeNamesTeammates.test.ts lines 15-29 so makeClient
creates non-null clanTag and non-empty friends, and lines 109-114 assert those
fields are hidden for every player.

@github-project-automation github-project-automation Bot moved this from Triage to Development in OpenFront Release Management Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development

Development

Successfully merging this pull request may close these issues.

1 participant