fix(tracker): 恢复匿名牌堆洗牌后的暂停追踪#51
Conversation
匿名负 ID 牌堆洗牌时,从未定位身份和状态索引恢复暂停追踪实体。分类仅以小规模剩余牌堆排除身份,并在弃牌重置循环中统计匿名占位,避免对大弃牌堆计算差值。
📝 WalkthroughWalkthrough重构 Changes匿名牌堆洗牌追踪
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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: 1
🧹 Nitpick comments (1)
tests/tracker/anonymousPileSpike.test.ts (1)
4-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win测试逻辑正确,但未覆盖 APPEARED 状态暗身份恢复路径。
新增用例只构造了来自
unlocatedIdentities(UNKNOWN 状态)的候选身份,未覆盖src/tracker/Room.ts中appearedCards.forEach(APPEARED 状态暗身份,如木牛流马场景)这一分支。补充一个该场景的用例,可以同时验证分类正确性,并捕获该分支对应的appearedHiddenIdentityCards归类问题(已在 Room.ts 审阅中提出)。Also applies to: 124-180
🤖 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 `@tests/tracker/anonymousPileSpike.test.ts` at line 4, 在 getPublicFieldCandidateCards 相关测试中补充一个 APPEARED 状态暗身份恢复场景:构造来自 Room.ts 的 appearedCards(例如木牛流马),而非仅使用 unlocatedIdentities 的 UNKNOWN 候选;断言恢复结果的分类正确,并覆盖 appearedHiddenIdentityCards 的归类路径。
🤖 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/tracker/Room.ts`:
- Around line 965-1036: Update the APPEARED-card handling in the
appearedCards.forEach block to pass appearedHiddenIdentityCards to
addSuspendedIdentity instead of neverAppearedCards. Keep the other candidate
sources writing to neverAppearedCards, so suspendedIdentityCards still combines
all entries while appearedHiddenIdentityCount and appearedHiddenIdentityCardIDs
accurately report APPEARED hidden identities.
---
Nitpick comments:
In `@tests/tracker/anonymousPileSpike.test.ts`:
- Line 4: 在 getPublicFieldCandidateCards 相关测试中补充一个 APPEARED 状态暗身份恢复场景:构造来自
Room.ts 的 appearedCards(例如木牛流马),而非仅使用 unlocatedIdentities 的 UNKNOWN
候选;断言恢复结果的分类正确,并覆盖 appearedHiddenIdentityCards 的归类路径。
🪄 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: 1039b06b-5f39-47e1-9b37-1fe62a6b0168
📒 Files selected for processing (2)
src/tracker/Room.tstests/tracker/anonymousPileSpike.test.ts
将 CardCounter APPEARED 桶中的未明示正 ID 归入 appearedHiddenIdentityCards,并补充木牛流马暗标记洗牌回归,锁定暂停结果与诊断分类。
变更内容
验证
pnpm test:tracker(33 个测试文件,260 项通过)pnpm exec vitest run tests/tracker/anonymousPileSpike.test.ts tests/tracker/pileDisplayOrder.test.ts(33 项通过)pnpm typecheck:trackerpnpm lintpnpm exec prettier --check src/tracker/Room.ts tests/tracker/anonymousPileSpike.test.ts tests/tracker/pileDisplayOrder.test.tspnpm buildpnpm build:prodgit diff --check风险与备注
pileDisplayOrder.test.ts现明确区分首次空弃牌堆洗牌和真实弃牌回收洗牌;匿名负 ID 及 APPEARED 暗身份回归仍集中在相关测试文件Summary by CodeRabbit
Bug Fixes
Tests