From 5689ceab6f0065f542a8a17abb46640552d10811 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Thu, 27 Aug 2026 19:48:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E4=B8=83=E7=8E=8B=EF=BC=9A=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=94=9F=E6=88=90=E5=A4=B9=E5=85=B7=E3=80=81BuryHandl?= =?UTF-8?q?er=20=E6=8E=A5=E4=BD=8F=20maipai.playproc=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E7=94=A9=E9=94=99=E6=96=AD=E8=A8=80=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 配合上一个 commit 服务端补发的 maipai.playproc,重新生成真包夹具(diff 只新增 三家 maipai 包各一份 round-1 初值 playproc,无其他变化)后跑一致性测试,暴露出 前端还有一处对应缺口:BuryHandler.js 组 table.playproc 时没有接 data.playproc (PlayHandler.js 早已对 chupai1/2/3 做了同样的原样拷贝),于是「埋牌完成→庄家 首出」窗口增量路径的 table.playproc 停在上一阶段的 null。现补上,并在 test_handlers_bury.js 新增一条用例守住、用「退回修复必转红」反向验证。 test_handlers_play.js:84 的 `S.table.playproc.shuaicuo` 断言的正是此前 Fix Round 2 裁决②(本手信息收进事件载荷、不进 GameState)判定为缺陷的旧映射,playproc 改为 原样拷贝服务端结构后必然读 null 硬崩。按 task-12d-report.md §8 的裁决与建议替换: 断言改为守事件载荷(EQW_CARD_PLAYED 的 shuaicuo/order/seat/cards/count/flower/ cardtype)+ playproc 原样拷贝,强度不降——原断言只守住"甩错标志被处理"这一件事, 新断言额外多守了"本手信息不得混入 playproc"一条。 client/tests/test_consistency.js 全绿(23 checks,此前 20 绿/3 红); client/tests/run.js 全绿(20 脚本);server/games/erqiwang/test/run.js 全绿 (17 脚本/675 checks,见上一个 commit)。 Co-Authored-By: Claude Opus 5 (1M context) --- .../codes/net/handlers/BuryHandler.js | 10 +++- client/tests/fixtures/packets.json | 52 ++++++++++++++++++- client/tests/test_handlers_bury.js | 14 +++++ client/tests/test_handlers_play.js | 15 +++++- 4 files changed, 85 insertions(+), 6 deletions(-) diff --git a/client/js/01_SubGame/codes/net/handlers/BuryHandler.js b/client/js/01_SubGame/codes/net/handlers/BuryHandler.js index 87ffd7a..73eeb1c 100644 --- a/client/js/01_SubGame/codes/net/handlers/BuryHandler.js +++ b/client/js/01_SubGame/codes/net/handlers/BuryHandler.js @@ -15,6 +15,11 @@ // // 【bottomcards 到此失效,要清空】:底牌在上庄时已翻给玩家看并并入手牌,埋牌完成后 // 只剩「埋牌底牌 burycards」有意义;deskinfo 的 PushCards 不带 bottomcards,重连重建恒为 []。 +// +// 【playproc 是服务端的「本轮进行态」,原样拷贝】:埋牌完成时服务端已就地开好 round-1 +// 的进行态(庄家首出、桌面全空),恒有、三家同值,与 chupai1/2/3.playproc / 重连包 +// PushCards.playproc 同源同结构(服务端同一个 get_playproc())。没有它,「埋牌完成 → +// 庄家首出」这段窗口增量路径 table.playproc 会停在上一阶段的 null,与重连路径不一致。 var EQW_BuryHandler = EQW_BuryHandler || { handle: function (data) { @@ -30,10 +35,11 @@ var EQW_BuryHandler = EQW_BuryHandler || { }); //底牌已并入手牌、埋牌完成即失效(重连的 PushCards 不带它),显式清空保持两条路径一致 EQW_GameState.my.bottomCards = []; - //三家牌况(仅可查牌模式)与闲家才可能有的亮牌 + //三家牌况(仅可查牌模式)、闲家才可能有的亮牌、本轮进行态(恒有,见上方注释) EQW_GameState._apply(EQW_GameState.table, data, { seatlist: 'seatlist', - liangpai: 'liangpai' + liangpai: 'liangpai', + playproc: 'playproc' }); EQW_GameState._apply(EQW_GameState.turn, data, { seat: 'seat', diff --git a/client/tests/fixtures/packets.json b/client/tests/fixtures/packets.json index 7359ccf..f948e8f 100644 --- a/client/tests/fixtures/packets.json +++ b/client/tests/fixtures/packets.json @@ -410,6 +410,22 @@ ] ] ], + "playproc": { + "round": 1, + "start": 0, + "currseat": 0, + "startcount": -1, + "startflower": -1, + "starttype": -1, + "maxseat": -1, + "maxcard": -1, + "cards": [ + null, + null, + null + ], + "shuai_demand": null + }, "cards": [ 52, 19, @@ -9590,7 +9606,23 @@ -1 ] ] - ] + ], + "playproc": { + "round": 1, + "start": 0, + "currseat": 0, + "startcount": -1, + "startflower": -1, + "starttype": -1, + "maxseat": -1, + "maxcard": -1, + "cards": [ + null, + null, + null + ], + "shuai_demand": null + } } }, { @@ -18733,7 +18765,23 @@ -1 ] ] - ] + ], + "playproc": { + "round": 1, + "start": 0, + "currseat": 0, + "startcount": -1, + "startflower": -1, + "starttype": -1, + "maxseat": -1, + "maxcard": -1, + "cards": [ + null, + null, + null + ], + "shuai_demand": null + } } }, { diff --git a/client/tests/test_handlers_bury.js b/client/tests/test_handlers_bury.js index ca7aeb3..b9d868d 100644 --- a/client/tests/test_handlers_bury.js +++ b/client/tests/test_handlers_bury.js @@ -55,4 +55,18 @@ S.reset(); EQW_BuryHandler.handle({ success: true, seat: 0, countdown: 20 }); t.eq('无亮牌时保持 null', S.table.liangpai, null); +// playproc:埋牌完成时服务端已就地开好 round-1 的进行态,恒有、原样拷贝进 table.playproc, +// 与 chupai1/2/3.playproc 同源同结构(协议 §9),漏接会让「埋牌完成→庄家首出」这段窗口 +// 增量路径 table.playproc 停在上一阶段的 null、与重连路径不一致 +S.reset(); +EQW_BuryHandler.handle({ success: true, seat: 0, countdown: 20, cards: [1, 2, 3], + burycards: [9, 10, 11, 12, 13, 14, 15, 16], + playproc: { round: 1, start: 0, currseat: 0, startcount: -1, + startflower: -1, starttype: -1, maxseat: -1, maxcard: -1, + cards: [null, null, null], shuai_demand: null } }); +t.eq('埋牌 playproc 原样拷贝服务端本轮进行态', S.table.playproc, { + round: 1, start: 0, currseat: 0, startcount: -1, startflower: -1, starttype: -1, + maxseat: -1, maxcard: -1, cards: [null, null, null], shuai_demand: null +}); + process.exit(t.done('handlers_bury') ? 0 : 1); diff --git a/client/tests/test_handlers_play.js b/client/tests/test_handlers_play.js index 1e4cf27..c6aae21 100644 --- a/client/tests/test_handlers_play.js +++ b/client/tests/test_handlers_play.js @@ -78,10 +78,21 @@ t.eq('第二轮跨包累加捡分', S.aset.grade, 25); t.eq('第二轮下一轮首家(证明第二个包确被处理)', S.turn.seat, 1); // ================= 甩错 ================= +// shuaicuo 是「这一手」的一次性信息,走 EQW_CARD_PLAYED 事件载荷,不进 GameState; +// playproc 是服务端下发的本轮进行态,原样拷贝,两者结构不同、不得混写(见 PlayHandler 顶部注释)。 S.reset(); evts.length = 0; +var lastPlayed = null; +EventBus.on(EQW_Events.EQW_CARD_PLAYED, function (p) { lastPlayed = p; }); EQW_PlayHandler.handle({ success: true, seat: 0, cards: [11], shuaicuo: 1, count: 1, - flower: 3, cardtype: 101, nextseat: 1, countdown: 15 }, 1); -t.eq('甩错标志', S.table.playproc.shuaicuo, 1); + flower: 3, cardtype: 101, nextseat: 1, countdown: 15, + playproc: { round: 2, start: 0, currseat: 1, cards: [[11], null, null] } }, 1); +t.eq('甩错标志走事件载荷', lastPlayed.shuaicuo, 1); +t.eq('本手信息走事件载荷', [lastPlayed.order, lastPlayed.seat, lastPlayed.cards, + lastPlayed.count, lastPlayed.flower, lastPlayed.cardtype], + [1, 0, [11], 1, 3, 101]); +t.eq('本手信息不进 GameState', S.table.playproc.hasOwnProperty('shuaicuo'), false); +t.eq('playproc 原样拷贝服务端本轮进行态', S.table.playproc, + { round: 2, start: 0, currseat: 1, cards: [[11], null, null] }); // ================= 缺必需字段 ================= S.reset();