Skip to content

feat(tracker): 落地匿名牌堆阶段 1 并记录 G1 收缩决策#44

Merged
llsccm merged 3 commits into
devfrom
codex/anonymous-pile-spike-phase-1
Jul 20, 2026
Merged

feat(tracker): 落地匿名牌堆阶段 1 并记录 G1 收缩决策#44
llsccm merged 3 commits into
devfrom
codex/anonymous-pile-spike-phase-1

Conversation

@llsccm

@llsccm llsccm commented Jul 20, 2026

Copy link
Copy Markdown
Owner

变更内容

  • Room.initDeck 改为匿名牌堆槽,新增 unlocatedIdentities / deckIdentities,揭示时通过 materialize 原地绑定真实身份。
  • 删除牌堆相关 recoverPlayerOccupiedIdentityForPublicRevealinsertUnknownPlaceholderIntoPile 运行时路径;阶段 1 保留旧式暗手牌 interop。
  • 补齐阶段 1 回归、顶底公共候选并存回归,并同步计划、阶段 0/1 报告与 docs/agents/*
  • G1 最终决定 NO-GO / 收缩:保留匿名牌堆作为终点,不推进阶段 2–7;G0/G1 活跃回放采集说明退役。

验证

  • pnpm lint
  • pnpm test:tracker(34 文件 / 254 测试)
  • pnpm typecheck:tracker
  • pnpm build
  • pnpm build:prod
  • Prettier / LF / git diff --check

风险与备注

  • 手牌旧模型仍存在 interop,不是全面身份/槽位解耦终点。
  • 三段真实回放中旧 G0 冲突站点与 interop 均为零触发,但回放来源与技能覆盖未完整标注。
  • 临时回放探针代码清理尚未在本 PR 中执行。

Summary by CodeRabbit

  • 新功能

    • 牌堆现以匿名槽位管理,卡牌身份在首次揭示时再呈现,提升未知牌状态追踪的一致性。
    • 支持从公共区或玩家来源准确物化已知牌,并维持牌堆顺序与身份索引。
  • 改进

    • 优化明牌同步、移动解析、公共候选传播及重复同步处理。
    • 移除开发环境中的临时遍历统计浏览器控制入口,保留同步统计能力。
  • 测试与文档

    • 新增匿名牌堆、身份物化及公共候选场景验证。
    • 更新实施计划、验证记录和阶段结论文档。

将牌堆初始化为匿名槽,通过 unlocatedIdentities/deckIdentities 与
materialize 按需绑定真实身份;删除牌堆 recover/占位插入路径,并保留
阶段 1 旧手牌 interop。根据对照报告与三段回放数据,G1 决定 NO-GO/收缩,
阶段 2-7 不执行,并退役 G0/G1 活跃回放采集说明。
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3cdfa5a1-395c-470a-ae30-d8a921763848

📥 Commits

Reviewing files that changed from the base of the PR and between df0d531 and 41e76b1.

📒 Files selected for processing (2)
  • src/tracker/roomMovement.ts
  • tests/tracker/anonymousPileSpike.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tracker/roomMovement.ts

📝 Walkthrough

Walkthrough

阶段 1 引入匿名牌堆槽位、身份集合和首次揭示物化,更新移动与揭示路径及测试;同时移除长生命周期遍历统计会话、浏览器控制入口和相关全局类型,并归档验证结论。

Changes

匿名牌堆身份解耦

Layer / File(s) Summary
阶段计划与验证结论
docs/anonymous-slot-*.md, docs/agents/*
新增阶段计划、阶段 1 对照报告及归档基线,记录 G1 的 NO-GO/收缩结论。
身份集合与物化基础
src/tracker/Card.ts, src/tracker/CardCounter.ts, src/tracker/Room.ts
牌堆改用匿名槽位,新增 deckIdentitiesunlocatedIdentities、物化 API、身份索引和守恒检查。
移动与揭示路径
src/tracker/roomMovement.ts, src/tracker/roomMovement/*, src/tracker/runtime/trackerController.ts
移动解析和公共区揭示选择匿名目标进行物化,并移除旧占位回补路径。
行为验证与测试夹具
tests/tracker/anonymousPileSpike.test.ts, tests/tracker/*
新增匿名牌堆流程测试,并更新 CardCounter、牌堆顺序、候选传播和控制器断言。
遍历统计控制收缩
src/dom.js, src/tracker/runtime/*, src/tracker/traversalStats.ts, src/types/global.d.ts
移除浏览器回放控制器和长生命周期 session API,仅保留同步遍历统计。

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Protocol
  participant TrackerController
  participant Room
  participant CardCounter
  Protocol->>TrackerController: 发送牌堆或公共区揭示信息
  TrackerController->>Room: resolveKnownCards 指定目标端点
  Room->>Room: materializeAtPublicEndpoint 绑定匿名槽位
  Room->>CardCounter: 更新身份与 UNKNOWN 索引
  Room-->>TrackerController: 返回已物化卡牌
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了匿名牌堆阶段 1 落地及 G1 收缩决策这两个主要变更。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/anonymous-pile-spike-phase-1

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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/roomMovement.ts`:
- Around line 157-175: Update the public-zone branch in the room movement logic
around getPublicEndpointCards and materialize so every knownID missing from
cardIndex is handled when no anonymous endpoint slot is available. Create the
same external entity used by the outside/exile paths, or explicitly report the
failure, instead of allowing filter(Boolean) to silently drop the card; preserve
the requirement that knownCards covers all knownIDs.
🪄 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: 265a63f2-63e6-472d-b6a3-405b0424d96b

📥 Commits

Reviewing files that changed from the base of the PR and between c30be2d and df0d531.

📒 Files selected for processing (29)
  • docs/agents/card_tracker.md
  • docs/agents/testing.md
  • docs/anonymous-slot-identity-decoupling-plan.md
  • docs/anonymous-slot-stage-0-conflict-baseline.md
  • docs/anonymous-slot-stage-1-comparison.md
  • src/dom.js
  • src/tracker/Card.ts
  • src/tracker/CardCounter.ts
  • src/tracker/Room.ts
  • src/tracker/roomMovement.ts
  • src/tracker/roomMovement/candidates.ts
  • src/tracker/roomMovement/sources.ts
  • src/tracker/runtime/browser.ts
  • src/tracker/runtime/trackerController.ts
  • src/tracker/runtime/traversalStatsBrowser.ts
  • src/tracker/traversalStats.ts
  • src/types/global.d.ts
  • tests/tracker/anonymousIdentity.test.ts
  • tests/tracker/anonymousPileSpike.test.ts
  • tests/tracker/anonymousSlotBaseline.test.ts
  • tests/tracker/cardCounter.test.ts
  • tests/tracker/handExchange.test.ts
  • tests/tracker/helpers/room.ts
  • tests/tracker/pileDisplayOrder.test.ts
  • tests/tracker/publicCandidates.test.ts
  • tests/tracker/trackerController.test.ts
  • tests/tracker/traversalBaseline.test.ts
  • tests/tracker/traversalStatsBrowser.test.ts
  • tests/tracker/traversalStatsSession.test.ts
💤 Files with no reviewable changes (6)
  • tests/tracker/anonymousSlotBaseline.test.ts
  • tests/tracker/traversalStatsBrowser.test.ts
  • tests/tracker/traversalStatsSession.test.ts
  • src/tracker/runtime/traversalStatsBrowser.ts
  • src/tracker/runtime/browser.ts
  • src/types/global.d.ts

Comment thread src/tracker/roomMovement.ts
公共区 resolveKnownMoveCards 在端点无匿名槽可物化时,按协议正 ID
补建外部实体,避免 knownCards 被静默截短。
@llsccm
llsccm marked this pull request as ready for review July 20, 2026 09:51
@llsccm
llsccm merged commit d1c4685 into dev Jul 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant