fix(tracker): 修复观虚牌堆顶展示与张数守恒#38
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: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: 4
🤖 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/handler/PubGsCMoveCard.js`:
- Around line 68-70: 在包含 SpellID 判断的条件中先将 SpellID 归一化为数字,再使用 [7011, 987,
988].includes 进行匹配,确保字符串形式的 ID 也能命中;修改该条件附近的 SpellID 处理,保留现有分支逻辑不变。
In `@tests/tracker/pileDisplayOrder.test.ts`:
- Around line 657-660: 补强 placeholders.forEach 相关断言,除验证占位牌位于 pile 外,还要验证其在
pile.cards 中紧接明牌段之后,保持占位回补到明牌段正下方的顺序契约;不要仅检查牌堆归属。
In `@tests/tracker/pubGsCMoveCard.test.ts`:
- Around line 83-107: 参数化观虚相关测试,使 SpellID=987 和 988 都覆盖相同的预期行为:在
tests/tracker/pubGsCMoveCard.test.ts 的对应测试中分别验证同区展示的来源和目标位置归一为牌顶;在
tests/tracker/roleOptTargetNtf.test.ts 对两者分别验证牌堆段与目标手牌段解析;在
tests/tracker/trackerController.test.ts 对两者分别验证牌序重排及重复消息幂等性。使用现有测试结构复用断言,避免仅覆盖
987。
In `@tests/tracker/trackerController.test.ts`:
- Around line 147-148: 强化 trackerController 测试中针对 pile.cards
的断言,先明确验证目标占位卡存在,再断言其 isKnown 不为 true;不要使用会让 undefined
通过的可选链断言,确保占位实体缺失或牌堆数量不足时测试失败。
🪄 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 Plus
Run ID: 5bc95505-0735-4975-a18f-941c2ca39234
📒 Files selected for processing (11)
docs/protocols/GsCRoleOptTargetNtf-987.mdsrc/handler/GsCRoleOptTargetNtf.jssrc/handler/PubGsCMoveCard.jssrc/logic.jssrc/tracker/gameState.tssrc/tracker/roomMovement/sources.tssrc/tracker/runtime/trackerController.tstests/tracker/pileDisplayOrder.test.tstests/tracker/pubGsCMoveCard.test.tstests/tracker/roleOptTargetNtf.test.tstests/tracker/trackerController.test.ts
变更
SpellID=987/988)的GsCRoleOptTargetNtf与配套PubGsCMoveCard同区展示。showCards会重排到协议端点,不再只确认牌面。createExternal导致牌堆5+123多一张的问题:优先与牌堆未知实体交换,保持张数守恒。docs/protocols/GsCRoleOptTargetNtf-987.md,并清理废弃权变花色残留。原因
观虚协议会声明牌堆顶正 ID,但本地可能:
add回牌顶,盖住刚展示的明牌;影响
观虚后牌顶序列与牌堆数量应正确:观看 5 张后为
5 明 + 剩余暗,不会再出现5+123。玩家区随机转移约束在身份回收时通过replaceCardInConstraintGroups迁移,不主动打散。验证
pnpm test:trackerpnpm typecheck:trackerpnpm lintpnpm buildSummary by CodeRabbit