fix: name native commander opponents - #6529
Conversation
|
Warning Review limit reached
Next review available in: 32 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughGameProvider now limits commander-avatar setup to AI games and reruns it only for mode or game changes. Native AI tests add deterministic avatar-fetch mocking and verify commander names are written to multiplayer state. ChangesNative AI routing
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
client/src/providers/GameProvider.tsx (1)
595-611: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winGuard against consuming the previous game’s command zone.
On an AI→AI
gameIdchange, this effect can run before the main setup effect cancels the deferred reset and initializes the new game. The immediate store read at Line 604 may therefore see the previous game’s non-emptycommand_zone; Lines 605–608 then mark the effect applied and unsubscribe, so the new native game is never processed. Commander names and avatars can remain stale or missing.Gate both the subscription callback and initial read on the store’s current
gameId(or equivalent session generation), and add a back-to-back AI game regression test.As per path instructions,
useEffectdependencies must carry the right identity for back-to-back prompts.🤖 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 `@client/src/providers/GameProvider.tsx` around lines 595 - 611, Update the AI commander-avatar initialization effect around setupCommanderAvatars so both the store subscription callback and immediate state read only consume state matching the current gameId (or equivalent session identity), preventing stale command_zone data from the previous AI game from marking the effect applied. Ensure the effect dependencies include the identity required for back-to-back AI games, and add a regression test covering consecutive AI game changes.Source: Path instructions
🤖 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.
Outside diff comments:
In `@client/src/providers/GameProvider.tsx`:
- Around line 595-611: Update the AI commander-avatar initialization effect
around setupCommanderAvatars so both the store subscription callback and
immediate state read only consume state matching the current gameId (or
equivalent session identity), preventing stale command_zone data from the
previous AI game from marking the effect applied. Ensure the effect dependencies
include the identity required for back-to-back AI games, and add a regression
test covering consecutive AI game changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c452508f-3e86-46e9-a4d6-2f9e15782ce4
📒 Files selected for processing (2)
client/src/providers/GameProvider.tsxclient/src/providers/__tests__/GameProvider.nativeEngine.test.tsx
3bd35ac to
f89ed0b
Compare
* fix: name native commander opponents * fix: import native commander name test store * fix: isolate commander names by game session --------- Co-authored-by: matthewevans <matthewevans@users.noreply.github.com>
Summary by CodeRabbit