Clantag#4013
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (3)
<review_stack_artifact> </review_stack_artifact> 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/client/SinglePlayerModal.ts (1)
647-715:⚠️ Potential issue | 🟠 Major | ⚡ Quick winValidate identity before dispatching
join-lobby.After this modal opens, the player can still change the username or clan tag. This path closes the modal immediately and relies on
Main.handleJoinLobby()to do the real async clan-tag check later. If that later validation fails, the game never starts and the player loses all the single-player settings they just configured.💡 Possible fix
const usernameInput = document.querySelector( "username-input", ) as UsernameInput; const clanTagInput = document.querySelector( "clan-tag-input", ) as ClanTagInput | null; + await clanTagInput?.awaitValidation(); + if (clanTagInput && !clanTagInput.validateOrShowError()) return; + if (!usernameInput.validateOrShowError()) return; + await crazyGamesSDK.requestMidgameAd();🤖 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/client/SinglePlayerModal.ts` around lines 647 - 715, The code dispatches "join-lobby" and closes the modal before validating the player's identity (username/clan tag), which can cause loss of configured single-player settings if later async validation fails; instead, call and await the existing async validation routine for the clan tag/username (the same check Main.handleJoinLobby would use) using the values from usernameInput.getUsername() and clanTagInput?.getValue() before dispatching the CustomEvent("join-lobby") and only call this.close() after validation succeeds; on validation failure keep the modal open and surface the validation error to the user so their configured game settings (e.g., selectedMap, gameMode, bots, etc.) are preserved.
🤖 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/client/ClanTagInput.ts`:
- Around line 140-166: Capture the current generation (this.checkCounter) into a
local const (e.g., const generation = this.checkCounter) before creating the
debounce Promise / setTimeout or before scheduling the immediate check, and when
resolving call a wrapper that first compares generation !== this.checkCounter
and if different returns a resolved Promise (no-op) otherwise calls
this.checkOwnership(tag); update the debounce.then and the immediate scheduling
path (and the analogous block at the later 186-189 code) to use this generation
guard so cancelled/stale tasks do not run getUserMe()/fetchClanExists().
- Around line 191-205: The async validation currently lets rejections from
getUserMe() or fetchClanExists() bubble out; wrap both awaits in try/catch so
any thrown error results in calling this.reject(tag) and returning (keeping the
stillCurrent() checks intact), ensuring currentCheck/awaitValidation always
resolves via reject(tag) instead of propagating exceptions; specifically, catch
errors around getUserMe() and around fetchClanExists(tag) and funnel them to
this.reject(tag).
In `@src/server/Worker.ts`:
- Around line 367-388: The fast-path using gm.peekClientIdentity and
gm.rejoinClient incorrectly skips later ownership re-validation for reconnects
when a clan tag is present; restrict this shortcut to only apply when the clan
tag is null by checking existingIdentity.clanTag (or censoredClanTag) === null
before returning, so that resolveClanTag(...) still runs for any reconnect that
has a non-null clan tag and triggers the proper ownership validation.
---
Outside diff comments:
In `@src/client/SinglePlayerModal.ts`:
- Around line 647-715: The code dispatches "join-lobby" and closes the modal
before validating the player's identity (username/clan tag), which can cause
loss of configured single-player settings if later async validation fails;
instead, call and await the existing async validation routine for the clan
tag/username (the same check Main.handleJoinLobby would use) using the values
from usernameInput.getUsername() and clanTagInput?.getValue() before dispatching
the CustomEvent("join-lobby") and only call this.close() after validation
succeeds; on validation failure keep the modal open and surface the validation
error to the user so their configured game settings (e.g., selectedMap,
gameMode, bots, etc.) are preserved.
🪄 Autofix (Beta)
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
Run ID: 6d3d3760-30a1-4c74-9a78-19d4d0230717
📒 Files selected for processing (18)
resources/lang/en.jsonsrc/client/ClanApi.tssrc/client/ClanTagInput.tssrc/client/GameModeSelector.tssrc/client/LangSelector.tssrc/client/Main.tssrc/client/SinglePlayerModal.tssrc/client/UsernameInput.tssrc/client/components/PlayPage.tssrc/core/ApiSchemas.tssrc/server/ClanTagOwnership.tssrc/server/GameManager.tssrc/server/GameServer.tssrc/server/Worker.tstests/client/ClanTagInput.test.tstests/client/clan/ClanApiQueries.test.tstests/server/ClanTagOwnership.test.tstests/server/GameLifecycle.test.ts
|
Actionable comments posted: 0 |
If this PR fixes an issue, link it below. If not, delete these two lines.
Resolves #(issue number)
Description:
enforce clantag - makes it so you cant use a tag for a clan that exists
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
w.o.n