fix(tracker): 修复嚣翻牌底被误放到牌顶#40
Conversation
协议 pos 与 Zone 端点约定一致,normalizeProtocolZoneTarget 不应再做顶底互换。
|
Warning Review limit reached
Next review available in: 45 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 (1)
📝 WalkthroughWalkthrough更新 Changes牌堆端点语义
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
🧹 Nitpick comments (1)
src/tracker/runtime/trackerController.ts (1)
853-855: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value使用空值合并运算符(
??)简化代码。你可以使用
??运算符来替代显式的undefined和null检查,这在 TypeScript 中更加简洁且符合惯用语。♻️ 建议的重构
- const hasExplicitPosition = protocolZone.pos !== undefined && protocolZone.pos !== null - // 未携带 pos 的看牌消息默认表示牌顶。 - const position = hasExplicitPosition ? protocolZone.pos : POSITION_TOP + // 未携带 pos 的看牌消息默认表示牌顶。 + const position = protocolZone.pos ?? POSITION_TOP🤖 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/tracker/runtime/trackerController.ts` around lines 853 - 855, 简化 protocolZone 位置解析逻辑:移除 hasExplicitPosition 及其显式的 undefined/null 检查,在 position 赋值中使用空值合并运算符,使缺少 pos 时仍默认使用 POSITION_TOP,存在有效 pos 时保持原值。
🤖 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.
Nitpick comments:
In `@src/tracker/runtime/trackerController.ts`:
- Around line 853-855: 简化 protocolZone 位置解析逻辑:移除 hasExplicitPosition 及其显式的
undefined/null 检查,在 position 赋值中使用空值合并运算符,使缺少 pos 时仍默认使用 POSITION_TOP,存在有效 pos
时保持原值。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0ad0956c-f0c8-45c5-844e-6548c67c7d0f
📒 Files selected for processing (4)
docs/protocols/CGsRoleSpellOptRep.mddocs/protocols/README.mdsrc/tracker/runtime/trackerController.tstests/tracker/trackerController.test.ts
变更内容
normalizeProtocolZoneTarget对协议pos的错误顶底互换SpellID=3336的牌底观看结果会正确定位到牌堆底原因
CGsRoleSpellOptRep嚣翻分支本身已经按POSITION_BOTTOM同步,但控制器在规范化协议 zone 时把POSITION_BOTTOM又翻成了POSITION_TOP,导致协议第一项(牌底)被当成牌顶展示。协议
pos与Zone.add/remove共用同一套端点约定,显式端点应直接透传。影响
Datas第一项会正确落在牌堆底pos的牌堆观看消息仍默认按牌顶处理pos的公共区明牌同步不再被错误翻转验证
pnpm exec vitest run tests/tracker/trackerController.test.ts tests/tracker/roleSpellOptRep.test.tspnpm typecheck:trackerpnpm lintSummary by CodeRabbit
功能改进
文档