Add PileIdentityLedger and Refactor Room Pile Operations - #69
Conversation
Double-write successful pile events into an independent cohort ledger, compare lightweight DEV observer snapshots, and cover B1-B15 without changing the legacy authority or UI.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough本次变更引入 Changes牌堆身份账本与 Room 集成
移动、位置与观虚流程
测试与验证
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Protocol
participant TrackerController
participant Room
participant PileIdentityLedger
participant GuanXu
Protocol->>TrackerController: 提交移动事件
TrackerController->>Room: 执行物理移动
TrackerController->>PileIdentityLedger: 应用身份移动或揭示
TrackerController->>GuanXu: 分派 987/988 交换事件
GuanXu-->>TrackerController: 返回交换后的移动事件
PileIdentityLedger-->>Room: 提交快照或回滚状态
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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: 4
🧹 Nitpick comments (5)
tests/tracker/helpers/pileGenerationPoolModel.ts (2)
936-946: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value可选:提取重复的「弹出牌顶槽并分类」循环。
drawUnknown、drawAcrossShuffle和gainUnknownFromPileTopRange三处使用完全相同的循环体:弹出pileSlots末尾,null计入playerAnonSlotCount,正 ID 加入playerHiddenPositiveIDs。提取一个局部 helper 可减少三处重复,并保证后续修改同步。♻️ 建议改动
+function popBaselineTopSlots(state: BaselineModelState, count: number): void { + for (let index = 0; index < count; index += 1) { + const slot = state.pileSlots.pop() ?? null + if (slot === null) state.playerAnonSlotCount += 1 + else state.playerHiddenPositiveIDs.add(slot) + } +}Also applies to: 971-975, 1018-1029
🤖 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/helpers/pileGenerationPoolModel.ts` around lines 936 - 946, 提取一个局部 helper,统一执行从 state.pileSlots 末尾弹出槽位并分类的逻辑:弹出 null 时递增 state.playerAnonSlotCount,否则将槽位加入 state.playerHiddenPositiveIDs。更新 drawUnknown、drawAcrossShuffle 和 gainUnknownFromPileTopRange 使用该 helper,保持现有数量校验与循环次数不变。
281-291: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win建议统一
insertExternalAtRandom的身份归一化。
applyCohortEvent在 599 行对insertExternalAtRandom调用normalizeIdentityIDs,但世代模型(281-291 行)和基线模型(947-955 行)直接使用event.cardIDs。如果夹具传入重复 ID 或非正 ID,pileSlotCount的增量会大于实际加入的身份数,countGenerationSlots(state) === identityUniverse.size这条守恒断言会失败,而失败原因难以定位。三个模型使用同一套事件序列,归一化行为应保持一致。♻️ 建议改动
case 'insertExternalAtRandom': { // 外部牌暗置进入牌堆:身份未揭示,属于当前世代候选(§5.8 规则 4)。 - event.cardIDs.forEach((cardID) => { + const cardIDs = normalizeIdentityIDs(event.cardIDs) + cardIDs.forEach((cardID) => { state.identityUniverse.add(cardID) state.locatedIdentityIDs.delete(cardID) state.activeIdentityIDs.add(cardID) state.suspendedIdentityIDs.delete(cardID) }) - state.pileSlotCount += event.cardIDs.length + state.pileSlotCount += cardIDs.length return }🤖 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/helpers/pileGenerationPoolModel.ts` around lines 281 - 291, 统一 insertExternalAtRandom 的身份归一化逻辑:在世代模型和基线模型中复用 applyCohortEvent 使用的 normalizeIdentityIDs 处理 event.cardIDs,仅将去重且有效的 ID加入 identityUniverse 并更新相关集合,同时让 pileSlotCount 按归一化后的实际 ID 数量递增,确保三个模型行为一致。tests/tracker/pileGenerationPool.test.ts (2)
1086-1092: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value可选:按需构造
context字符串。
describeSequence()在每一步迭代中无条件执行JSON.stringify(events, null, 2),即使断言通过也会构造完整字符串。该模式出现在 4 个测试中,每个测试遍历 8 个 seed × 40 步。改为把消息传给 Vitest 的惰性形式,或只在断言失败时构造,可以降低测试运行时间。🤖 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/pileGenerationPool.test.ts` around lines 1086 - 1092, 更新这 4 个测试中的断言上下文构造逻辑,避免在每次迭代中无条件调用 describeSequence() 生成 JSON 字符串;改用 Vitest 的惰性消息形式,或仅在断言失败路径构造上下文,同时保持断言内容和失败时的诊断信息不变。
1190-1207: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win属性测试未覆盖
gainFromPile与gainUnknownFromPileTopRange。
generateSequence不产生这两类事件,因此该断言的期望列表也不含它们。结果是「从牌堆任意位置取牌」和「牌顶范围取牌」两条路径只由手工用例覆盖,不参与逐步守恒与批次基数检查。这两条路径恰好是批次降级逻辑最容易出错的地方(gainUnknownFromPileTopRange会触发mergeAllCohorts)。建议在生成器中加入这两类事件:
gainFromPile从topCohortCandidates()之外的任意 cohort 取候选,gainUnknownFromPileTopRange随机选取rangeSize >= count。需要我提交实现或创建跟踪 issue 吗?🤖 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/pileGenerationPool.test.ts` around lines 1190 - 1207, Update generateSequence to produce both gainFromPile and gainUnknownFromPileTopRange events, selecting gainFromPile candidates from cohorts outside topCohortCandidates() and ensuring gainUnknownFromPileTopRange uses a randomly selected rangeSize greater than or equal to count. Extend the covered-event expectation in the “生成器确实覆盖了全部事件类型” test to include both event types so these paths participate in invariant and batch-size checks.tests/tracker/anonymousPileSpike.test.ts (1)
9-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
getSuspendedIdentityIDs在两个测试文件中重复定义。 同一个辅助函数被复制成两份实现完全相同的本地函数。后续 suspended 语义变化时,两处会不同步。建议抽到tests/tracker/helpers/room.ts中共享导出。
tests/tracker/anonymousPileSpike.test.ts#L9-L12:删除本地定义,改为从./helpers/room导入getSuspendedIdentityIDs。tests/tracker/pileDisplayOrder.test.ts#L19-L21:删除本地定义,改为从./helpers/room导入同一个getSuspendedIdentityIDs。♻️ 建议新增的共享辅助
在
tests/tracker/helpers/room.ts中新增:export function getSuspendedIdentityIDs(room: Room): number[] { return Array.from(room.suspendedKnownCards, (card) => card.id).sort((left, right) => left - right) }🤖 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` around lines 9 - 12, Move the duplicated getSuspendedIdentityIDs helper into tests/tracker/helpers/room.ts as a shared export accepting Room; in tests/tracker/anonymousPileSpike.test.ts lines 9-12 and tests/tracker/pileDisplayOrder.test.ts lines 19-21, remove each local definition and import the shared helper from ./helpers/room.
🤖 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/PileIdentityLedger.ts`:
- Line 195: Update the consistency check in initialize to pass identities.length
to collectConsistencyIssues instead of the raw cardIDs.length, ensuring expected
pile counts use the normalized, deduplicated valid IDs.
In `@src/tracker/roomMovement/sources.ts`:
- Around line 751-758: 更新 isRegularPileDraw 与 takeUnknownCardsFromPublicZone
的分流逻辑:仅在 fromZone 为牌堆且 moveType 为 DRAW 时使用按端点顺序消费明牌的
takeCardsFromPublicZone;非牌堆来源只有在已覆盖暗牌移动路径时才调用
takeUnknownCardsFromPublicZone,否则改用能移除实际明牌实体的路径,避免 moveUnknownCardsForContext
创建匿名占位而保留原区明牌。
In `@tests/tracker/helpers/pileGenerationPoolModel.ts`:
- Around line 1161-1175: Update recycleTrueDiscard to return whether a discard
pile was actually recycled, returning false on an empty trueDiscard and true
after a successful recycle. In the shuffle branch around the shuffleIndex
update, increment shuffleIndex only when recycleTrueDiscard reports true,
keeping empty-discard shuffles from consuming recycledOrders entries.
In `@tests/tracker/traversalBaseline.test.ts`:
- Around line 154-162: 在测试中 materializeDeckIdentities: false 的洗牌场景附近加入中文注释,说明 40
张牌保持匿名槽会导致洗牌遍历全部实体,从而解释 inline snapshot 中
total、cardCounter:update、ambiguousKnownIndex:applyDirty、locationIndex:applyDirty
和 resolveConstraints:playerSnapshotIncremental 的增长;同时补充或运行
materializeDeckIdentities: true 的同一场景遍历快照,确认生产洗牌路径的遍历量未退化。
---
Nitpick comments:
In `@tests/tracker/anonymousPileSpike.test.ts`:
- Around line 9-12: Move the duplicated getSuspendedIdentityIDs helper into
tests/tracker/helpers/room.ts as a shared export accepting Room; in
tests/tracker/anonymousPileSpike.test.ts lines 9-12 and
tests/tracker/pileDisplayOrder.test.ts lines 19-21, remove each local definition
and import the shared helper from ./helpers/room.
In `@tests/tracker/helpers/pileGenerationPoolModel.ts`:
- Around line 936-946: 提取一个局部 helper,统一执行从 state.pileSlots 末尾弹出槽位并分类的逻辑:弹出 null
时递增 state.playerAnonSlotCount,否则将槽位加入 state.playerHiddenPositiveIDs。更新
drawUnknown、drawAcrossShuffle 和 gainUnknownFromPileTopRange 使用该
helper,保持现有数量校验与循环次数不变。
- Around line 281-291: 统一 insertExternalAtRandom 的身份归一化逻辑:在世代模型和基线模型中复用
applyCohortEvent 使用的 normalizeIdentityIDs 处理 event.cardIDs,仅将去重且有效的 ID加入
identityUniverse 并更新相关集合,同时让 pileSlotCount 按归一化后的实际 ID 数量递增,确保三个模型行为一致。
In `@tests/tracker/pileGenerationPool.test.ts`:
- Around line 1086-1092: 更新这 4 个测试中的断言上下文构造逻辑,避免在每次迭代中无条件调用 describeSequence()
生成 JSON 字符串;改用 Vitest 的惰性消息形式,或仅在断言失败路径构造上下文,同时保持断言内容和失败时的诊断信息不变。
- Around line 1190-1207: Update generateSequence to produce both gainFromPile
and gainUnknownFromPileTopRange events, selecting gainFromPile candidates from
cohorts outside topCohortCandidates() and ensuring gainUnknownFromPileTopRange
uses a randomly selected rangeSize greater than or equal to count. Extend the
covered-event expectation in the “生成器确实覆盖了全部事件类型” test to include both event
types so these paths participate in invariant and batch-size checks.
🪄 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: 8bc6635c-ccab-4d01-9689-ca9f9fafba27
📒 Files selected for processing (27)
.prettierignoreCLAUDE.mddocs/agents/card_tracker.mddocs/agents/testing.mdsrc/handler/PubGsCMoveCard.jssrc/handler/specialZones.jssrc/tracker/PileIdentityLedger.tssrc/tracker/Room.tssrc/tracker/roomMovement.tssrc/tracker/roomMovement/sources.tssrc/tracker/runtime/moveEventHandlers.tssrc/tracker/runtime/trackerController.tssrc/tracker/view/publicFieldCandidates.tstests/tracker/anonymousPileSpike.test.tstests/tracker/helpers/pileGenerationPoolModel.tstests/tracker/helpers/trackerController.tstests/tracker/identityConservation.test.tstests/tracker/pileDisplayOrder.test.tstests/tracker/pileGenerationPool.test.tstests/tracker/pileIdentityLedger.test.tstests/tracker/pileIdentityLedgerIntegration.test.tstests/tracker/pubGsCMoveCard.test.tstests/tracker/publicEndpointCards.test.tstests/tracker/resolveConstraintsIncrementalIndex.test.tstests/tracker/specialZones.test.tstests/tracker/trackerController.test.tstests/tracker/traversalBaseline.test.ts
💤 Files with no reviewable changes (1)
- src/handler/specialZones.js
按 FromID/ToID 保留牌堆侧与手牌侧交换桶,避免已知身份误走 known-fallback。 换出手牌回堆后仅记录牌顶前 N 张范围候选,并补充目标视角完整协议回归与文档。
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
tests/tracker/pileGenerationPool.test.ts (2)
1034-1050: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value建议复用一次 cohort 状态,减少模型重放。
nonTopCohortCandidates()先调用topCohortCandidates(),后者内部又执行一次runCohortPoolModel(events),因此单次调用会全量重放事件序列两次。生成器在每一步都调用该函数,重放成本随步数呈平方增长。把 cohort 状态计算一次并复用,可保持语义不变。♻️ 建议的重构
+ /** 取当前牌顶批次里仍可揭示的身份;复用已计算的 cohort 状态。 */ + const topCandidatesOf = (cohortState: ReturnType<typeof runCohortPoolModel>): CardID[] => { + for (let index = cohortState.cohorts.length - 1; index >= 0; index -= 1) { + const cohort = cohortState.cohorts[index] + if (cohort.remainingPileCount <= 0) continue + return sortIDs(cohort.candidateIdentityIDs).filter((cardID) => + availablePileIdentities.has(cardID) + ) + } + return [] + } + /** 搜牌事件故意选择仍有牌在堆、但不属于当前牌顶批次的候选身份。 */ const nonTopCohortCandidates = (): CardID[] => { - const topCandidates = new Set(topCohortCandidates()) const cohortState = runCohortPoolModel(events) + const topCandidates = new Set(topCandidatesOf(cohortState)) const candidates = new Set<CardID>()🤖 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/pileGenerationPool.test.ts` around lines 1034 - 1050, Update nonTopCohortCandidates to call runCohortPoolModel(events) only once and derive both the top-cohort candidates and non-top candidates from that shared cohortState. Preserve the existing filtering and sorted CardID results while eliminating the nested topCohortCandidates model replay.
1140-1148: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value删除恒真条件,避免误导读者。
state.discardKnownIDs.length > 0已经成立时,state.pileSlotCount + state.discardKnownIDs.length >= 1恒真,minDraw > postShuffleCount也恒不成立。这两处判断永不生效,会让读者误以为存在需要跳过的场景。♻️ 建议的重构
- if ( - roll < 93 && - state.discardKnownIDs.length > 0 && - state.pileSlotCount + state.discardKnownIDs.length >= 1 - ) { + if (roll < 93 && state.discardKnownIDs.length > 0) { // 自动补牌:必须超过洗牌前牌堆量,且不超过洗牌后总量。 const postShuffleCount = state.pileSlotCount + state.discardKnownIDs.length const minDraw = state.pileSlotCount + 1 - if (minDraw > postShuffleCount) continue - const count = minDraw + pick(postShuffleCount - minDraw + 1)🤖 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/pileGenerationPool.test.ts` around lines 1140 - 1148, Remove the redundant state.pileSlotCount + state.discardKnownIDs.length >= 1 condition and the unreachable minDraw > postShuffleCount check from the automatic draw branch. Keep the existing roll and discardKnownIDs.length guards and the postShuffleCount/minDraw calculations only if they remain necessary for meaningful behavior.
🤖 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/skill/GuanXu.ts`:
- Around line 87-171: Make resolveProtocolKnownCards and its validation callers
stagePileToExchange, stageHandToExchange, and transferExchangeBucket side-effect
free: add a read-only probe or transactional rollback around Room.materialize
and confirmKnown so failed validation cannot persist CardID identity changes or
mutate card entities. Preserve the existing card selection results for valid
moves, and ensure endpoint materialization cannot consume later anonymous slots
during validation.
---
Nitpick comments:
In `@tests/tracker/pileGenerationPool.test.ts`:
- Around line 1034-1050: Update nonTopCohortCandidates to call
runCohortPoolModel(events) only once and derive both the top-cohort candidates
and non-top candidates from that shared cohortState. Preserve the existing
filtering and sorted CardID results while eliminating the nested
topCohortCandidates model replay.
- Around line 1140-1148: Remove the redundant state.pileSlotCount +
state.discardKnownIDs.length >= 1 condition and the unreachable minDraw >
postShuffleCount check from the automatic draw branch. Keep the existing roll
and discardKnownIDs.length guards and the postShuffleCount/minDraw calculations
only if they remain necessary for meaningful behavior.
🪄 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: a5c8d5f9-3600-48bf-8d3f-73564e3c4e8b
📒 Files selected for processing (20)
docs/agents/card_tracker.mddocs/agents/testing.mddocs/protocols/GsCRoleOptTargetNtf-987.mddocs/protocols/README.mdsrc/tracker/PileIdentityLedger.tssrc/tracker/Room.tssrc/tracker/roomMovement.tssrc/tracker/roomMovement/sources.tssrc/tracker/roomMovement/types.tssrc/tracker/runtime/moveEventHandlers.tssrc/tracker/skill/GuanXu.tssrc/tracker/types.tstests/tracker/anonymousPileSpike.test.tstests/tracker/guanXuExchange.test.tstests/tracker/helpers/pileGenerationPoolModel.tstests/tracker/helpers/room.tstests/tracker/pileDisplayOrder.test.tstests/tracker/pileGenerationPool.test.tstests/tracker/pileIdentityLedger.test.tstests/tracker/traversalBaseline.test.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- src/tracker/roomMovement/sources.ts
- tests/tracker/anonymousPileSpike.test.ts
- src/tracker/roomMovement.ts
- tests/tracker/pileIdentityLedger.test.ts
- src/tracker/PileIdentityLedger.ts
- tests/tracker/helpers/pileGenerationPoolModel.ts
- src/tracker/Room.ts
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/tracker/Room.ts (1)
1187-1219: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win洗牌旧世代关闭不应依赖后续账本调用。
shufflePile()先取pileIdentityLedger.getUnresolvedIdentityIDs()作为expiringIdentityIDs快照,随后才将pileIdentityMove提交给applyPileIdentityMove()。createPileIdentityMove()会在洗牌前收集pileCountBefore,因此随后提交的账本移动事件仍是旧状态;账本洗牌事件不会先于Room.shufflePile()关闭旧世代。把applyPileIdentityMove(...)/账本洗牌事件提前到Room.shufflePile()之前,或不在此函数中读取pileIdentityLedger作为闭世代依据。🤖 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/Room.ts` around lines 1187 - 1219, 调整 shufflePile 的旧世代关闭流程:不要依赖其中读取 pileIdentityLedger.getUnresolvedIdentityIDs() 的快照作为闭世代依据,因为账本洗牌事件会在 Room.shufflePile() 之后才提交。将 applyPileIdentityMove(...) 及其账本事件提前到 shufflePile 执行前,或改用不依赖 pileIdentityLedger 的闭世代依据,同时保留过期身份与洗回身份的正确区分。
🤖 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 `@docs/protocols/GsCRoleOptTargetNtf-987.md`:
- Around line 110-111: 更新步骤 4/5 的回堆说明,明确步骤 5 的协议 CardIDs=[] 仍为空,已知身份 16 不写入线协议
CardIDs。按线协议与内部实体拆分:完整回堆时使用交换桶 sourceCards 按桶内 bottom-first 补充回堆序列;CardCount
表示线协议张数,sourceCards 表示内部实体来源。
In `@tests/tracker/guanXuExchange.test.ts`:
- Around line 11-21: 将观虚测试中的移动类型字面量 11 替换为 src/tracker/MoveEventNormalizer.ts 中的
MOVE_TYPE.EXCHANGE;更新 guanXuMove() 及测试内其他 MoveType 设置,并补充或复用该常量的导入,保持测试行为不变。
---
Outside diff comments:
In `@src/tracker/Room.ts`:
- Around line 1187-1219: 调整 shufflePile 的旧世代关闭流程:不要依赖其中读取
pileIdentityLedger.getUnresolvedIdentityIDs() 的快照作为闭世代依据,因为账本洗牌事件会在
Room.shufflePile() 之后才提交。将 applyPileIdentityMove(...) 及其账本事件提前到 shufflePile
执行前,或改用不依赖 pileIdentityLedger 的闭世代依据,同时保留过期身份与洗回身份的正确区分。
🪄 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: adae2381-787a-4495-a655-dc0ee064d136
📒 Files selected for processing (20)
docs/agents/card_tracker.mddocs/agents/testing.mddocs/protocols/GsCRoleOptTargetNtf-987.mddocs/protocols/README.mddocs/protocols/move-position.mdsrc/tracker/CardCounter.tssrc/tracker/Room.tssrc/tracker/Zone.tssrc/tracker/candidate/cardPositions.tssrc/tracker/runtime/trackerController.tssrc/tracker/skill/GuanXu.tstests/tracker/anonymousPileSpike.test.tstests/tracker/cardCounter.test.tstests/tracker/guanXuExchange.test.tstests/tracker/moveEventLogging.test.tstests/tracker/moveEventNormalizer.test.tstests/tracker/pileGenerationPool.test.tstests/tracker/publicEndpointCards.test.tstests/tracker/resolveConstraintsIncrementalIndex.test.tstests/tracker/traversalBaseline.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- tests/tracker/resolveConstraintsIncrementalIndex.test.ts
- docs/agents/testing.md
- tests/tracker/anonymousPileSpike.test.ts
- tests/tracker/pileGenerationPool.test.ts
- src/tracker/skill/GuanXu.ts
- src/tracker/runtime/trackerController.ts
洗牌先提交身份账本过渡,再据此重建物理牌堆和 suspended 投影。 同时迁移牌堆纯模型到 tests/contracts,纳入 tracker 完整回归,并修正文档与观虚测试常量。
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@docs/agents/card_tracker.md`:
- Line 53: 将文档中的“协议张数”统一改为“协议牌数”(或“协议卡牌数量”),仅更新该术语表述并保持其余洗牌行为说明不变。
In `@tests/contracts/pile-identity/pileGenerationPoolModel.ts`:
- Around line 601-623: Update the insertExternalAtRandom branch to increment
cohortDegradationCount only when mergeAllCohorts actually merges multiple
cohorts, matching the conditional behavior in gainUnknownFromPileTopRange.
Preserve the existing count and cohort updates while ensuring zero- or
one-cohort cases do not increase the degradation metric.
🪄 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: 205b7b40-61c8-4c73-9fff-3fab8435ea75
📒 Files selected for processing (18)
AGENTS.mdCLAUDE.mdCONTRIBUTING.mddocs/agents/card_tracker.mddocs/agents/commands.mddocs/agents/conventions.mddocs/agents/overview.mddocs/agents/testing.mddocs/protocols/GsCRoleOptTargetNtf-987.mdpackage.jsonsrc/tracker/PileIdentityLedger.tssrc/tracker/Room.tssrc/tracker/runtime/trackerController.tstests/contracts/pile-identity/pileGenerationPool.test.tstests/contracts/pile-identity/pileGenerationPoolModel.tstests/tracker/guanXuExchange.test.tstests/tracker/pileIdentityLedgerIntegration.test.tstsconfig.tracker.json
🚧 Files skipped from review as they are similar to previous changes (5)
- CLAUDE.md
- tests/tracker/guanXuExchange.test.ts
- src/tracker/runtime/trackerController.ts
- docs/agents/testing.md
- src/tracker/Room.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary by CodeRabbit
新功能
问题修复