Skip to content

fix(smashup): 修复 Block the Path POD 派系来源#3

Open
deathcats4 wants to merge 1 commit into
codex/trickster-gnome-pod-before-scoring-fixfrom
codex/block-the-path-pod-faction-source-fix
Open

fix(smashup): 修复 Block the Path POD 派系来源#3
deathcats4 wants to merge 1 commit into
codex/trickster-gnome-pod-before-scoring-fixfrom
codex/block-the-path-pod-faction-source-fix

Conversation

@deathcats4

Copy link
Copy Markdown
Owner

变更说明

  • Block the Path 优先读取本局参战派系,避免 POD 版本在双方相关卡牌尚未可见时没有可选派系
  • 仅在缺少 factions 元数据时回退到场上和手牌中的可见派系
  • 补充命令链与生产 pipeline 回归测试,覆盖 POD 版本的隐藏信息场景

验证

  • npx vitest run src/games/smashup/tests/factionAbilities.test.ts
  • npx vitest run src/games/smashup/tests/baseFactionOngoing.test.ts

@zhuanggenhua

Copy link
Copy Markdown

Findings

  • Major — 当前不能合并。quality-gate 失败,且失败点不是这次 Block the Path 修复本身,而是合并结果上的既有回归:src/games/smashup/__tests__/specialInteractionChain.test.ts:625,用例 onMinionPlayed trigger: trickster_pay_the_piper > 对手打出随从到有付笛手的基地 → 对手弃一张牌 断言 expected 2 to be 1
  • Major — 我在独立临时克隆里分别复现了 base origin/codex/trickster-gnome-pod-before-scoring-fix 和 PR head origin/codex/block-the-path-pod-faction-source-fix:两边都同样失败在 specialInteractionChain.test.ts:625。这说明当前 blocker 是目标分支基线未绿,而不是本 PR 新引入的行为回归。
  • Nitpicksrc/games/smashup/abilities/tricksters.ts 这次改成优先读取 player.factions,从显式 match metadata 推导可选派系,符合“显式元数据优先于从可见卡面反推”的方向;配套新增的 3 条测试也覆盖了:普通命令链、无可见卡时仍可选本局参战派系、production system stack。

Open Questions / Assumptions

  • 我当前按现有产品语义假设:player.factions 属于本局公开元数据,而不是需要继续隐藏的信息。如果未来有“隐藏派系”模式,这个 helper 需要额外做可见性门禁,而不能直接把所有 player.factions 暴露成选项。

Summary

  • 是否允许 merge暂不允许
  • 原因:PR 合并结果的 quality-gate 仍为红灯;复现结果表明红灯主要来自 base 分支已有失败,而不是本 PR 的 Block the Path POD 修复逻辑。
  • 本 PR 改动判断:修复方向本身是对的,且新加回归测试在 PR head 上通过。
  • 建议下一步:先单独修掉 specialInteractionChain.test.ts:625 对应的 Pay the Piper 回归,再重新跑 quality-gate;门禁转绿后再合并本 PR。

@zhuanggenhua

Copy link
Copy Markdown

发现 quality-gate 红灯的根因不是本 PR 的 Block the Path 实现,而是一个已经过期的测试断言:

  • 文件:src/games/smashup/__tests__/specialInteractionChain.test.ts
  • 用例:onMinionPlayed trigger: trickster_pay_the_piper > 对手打出随从到有付笛手的基地 → 对手弃一张牌

Pay the Piper 现在是交互式弃牌:打出随从后先创建 trickster_pay_the_piper 交互,只有在响应交互后才真正发出弃牌事件并落状态。旧测试还在按“打出后立即弃牌”断言,所以 CI 会红。

我已在本地隔离 clone 验证过最小修复:把测试改成“先断言交互存在,再 respond(...),最后断言手牌/弃牌堆变化”。本地已通过:

  • npx eslint src/games/smashup/__tests__/specialInteractionChain.test.ts
  • npx vitest run src/games/smashup/__tests__/specialInteractionChain.test.ts --configLoader native --maxWorkers 1
  • npx vitest run src/games/smashup/__tests__/factionAbilities.test.ts src/games/smashup/__tests__/baseFactionOngoing.test.ts --configLoader native --maxWorkers 1
  • npm run i18n:check
  • QUALITY_GATE_BASE=origin/codex/trickster-gnome-pod-before-scoring-fix npm run quality:changed -- ci

但我这边无法直接推回 PR head 分支

  • maintainerCanModify=false
  • git push origin 82b41c9:refs/heads/codex/block-the-path-pod-faction-source-fixpermission denied

如果作者愿意,可以按下面这个最小补丁更新测试,或者先开启 maintainer edits:

@@
 expect(r1.steps[0]?.success).toBe(true);
+const choice = asSimpleChoice(r1.finalState.sys.interaction.current)!;
+expect(choice?.sourceId).toBe('trickster_pay_the_piper');
+expect(choice?.playerId).toBe('0');
+expect(choice.options).toHaveLength(2);
+
+const discardOptionId = findOption(choice, (opt) => opt.value?.cardUid === 'h1');
+const r2 = respond(r1.finalState, '0', discardOptionId, 'pay_the_piper: 选择弃牌');
+expect(r2.steps[0]?.success).toBe(true);
 
-const p0 = r1.finalState.core.players['0'];
+const p0 = r2.finalState.core.players['0'];
 expect(p0.hand.length).toBe(handBefore - 2);
-expect(p0.discard.length).toBeGreaterThan(0);
+expect(p0.hand.some((card: CardInstance) => card.uid === 'h1')).toBe(false);
+expect(p0.discard.some((card: CardInstance) => card.uid === 'h1')).toBe(true);

在当前权限条件下,这就是 merge 的唯一 blocker:技术上补丁已验证,但我不能把它直接推回这个 PR。

@zhuanggenhua

Copy link
Copy Markdown

我这边已完成复核并本地修掉当前 CI blocker,但因为这个 PR 的 head 分支未开放维护者修改权限(maintainerCanModify=false),且我对 deathcats4/BoardGame 没有 push 权限,所以没法直接把补丁推回原 PR 分支。

结论

  • 原 PR 里的 Block the Path 派系来源修复本身没有再发现新的逻辑 blocker。
  • 当前 quality-gate 红灯来自无关测试回归:src/games/smashup/__tests__/specialInteractionChain.test.ts 里的 trickster_pay_the_piper 断言仍按“打出后立即弃牌”写,但现在实现已经是先创建交互,再在 respond 后才真正弃牌

我本地已验证通过的最小修复

本地补了一个最小测试修复 commit:82b41c9 (test(smashup): 修正付笛手交互链回归)

修改点只有 1 个文件:

  • src/games/smashup/__tests__/specialInteractionChain.test.ts

修法是把测试改为:

  1. 先断言产生 trickster_pay_the_piper 交互
  2. respond(...) 选择弃牌
  3. 最后断言手牌减少 2、h1 不在手牌且进入弃牌堆

本地验证

  • npx eslint src/games/smashup/__tests__/specialInteractionChain.test.ts
  • npx vitest run src/games/smashup/__tests__/specialInteractionChain.test.ts --configLoader native --maxWorkers 1
  • npx vitest run src/games/smashup/__tests__/factionAbilities.test.ts src/games/smashup/__tests__/baseFactionOngoing.test.ts --configLoader native --maxWorkers 1
  • npm run i18n:check
  • QUALITY_GATE_BASE=origin/codex/trickster-gnome-pod-before-scoring-fix npm run quality:changed -- ci

以上本地都已通过。

当前 blocker

要让这个 PR 真正转绿并继续 merge,需要作者二选一:

  1. 开启“Allow edits by maintainers”后我再直接推回;或
  2. 作者自行应用上述测试修复(可直接按 commit 82b41c9 的内容修改)

只要这个测试补丁进到 PR head,按当前本地验证结果,quality-gate 应可恢复为绿色。

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.

3 participants