refactor(starpuff): W2 前置債務車——GameScene strangler 拆分 1180→875 行(行為零改變) - #906
Merged
Conversation
- 開工活性錨:GameScene 拆分(1180 行 → 目標 ≤900 行),行為零改變 - 沿用 v17_debt strangler 模式:characterization test 先行再搬移 測試:空 commit 無需測試 Co-authored-by: Cursor <cursoragent@cursor.com>
- spawnGate/syncGateSweep/playerCrossedGate/completeLevel 遷至 createLevelGate - groundTop 沿 bossFactory/eliteRoom 慣例參數注入;模組不 value-import phaser - 掃掠背擋幾何/演出參數/轉場資料行為零改變;checkpoint 重生改走 noteWarp 同語義 - characterization 測試 16 案先行鎖定:生成幾何、tween 參數、掃掠補判、 演出順序、轉場資料與 transitioning 單次化閘 測試:vitest 1054 全綠(1038 既有零修改 +16);tsc --noEmit 0 錯 Co-authored-by: Cursor <cursoragent@cursor.com>
…51 行) - advanceMercy/spawnMercyHeart 遷至 createMercyDirector;每命狀態隨 create 重建歸零 - 卡點重生改走 resetLife 顯式歸零;e2e mercyWarp/mercySpawnedCount 委派同名 API - Clamp 改用同語意本地實作(沿 v17 starCombat 慣例,模組不 value-import phaser) - characterization 測試 10 案先行鎖定:boss/EX 分流門檻、每命上限、 生成錨點幾何(RNG 位置/前室夾限/世界緣夾限)、warp 累加與 resetLife 測試:vitest 1064 全綠(1038 既有零修改 +26);tsc --noEmit 0 錯 Co-authored-by: Cursor <cursoragent@cursor.com>
…1→973 行) - damagePlayer/applyBuff/advanceBuff/advanceTide/advanceMeteors/applyBossVents/ resolveBossQuake 遷至 createDamageDirector;buff 狀態隨 create 重建歸零 - update 逐幀呼叫順序凍結(buff→caramel→…→tide→meteors→vents);接線點 (overlaps/starCombat/caramel/bossRoom/ticketa)全數改走 director 單一真值 - characterization 測試 12 案先行鎖定:護盾格擋管線、buff 拾取/到期同步、 潮汐浸水三聯結算與甦醒窗 0 語意、隕星視窗參數、噴口升力、P3 震落分岔 測試:vitest 1076 全綠(1038 既有零修改 +38);tsc --noEmit 0 錯 Co-authored-by: Cursor <cursoragent@cursor.com>
- syncInhale/syncJumpSfx/clampAboveGround/syncTutorialInput 與 SP 首教塊遷至 createPlayerFeel;嘴部錨點維持穩定參照(fx 吸入粒子與 applyInhalePull 共用) - taughtTransformSp 維持模組級 session 慣例並附測試重置鉤子(沿 starburstDirector) - 設計文件引述綁定同步:02-combat-star.md 變身首教浮字來源檔改指 playerFeel.ts - characterization 測試 10 案先行鎖定:嘴部錨點/參照穩定性、吸入邊緣觸發、 跳躍配音速度判定、沉地防護幾何、SP 教學單次化與語意鍵排除 測試:vitest 1086 全綠(1038 既有零修改 +48);tsc --noEmit 0 錯 Co-authored-by: Cursor <cursoragent@cursor.com>
- bindEvents 分派表遷至 wireSceneEvents(沿 bindSfxToEvents 單一 unbind 出口慣例) - 深耦合 run 狀態的死亡/擊破流程留在 GameScene(handlePlayerDied/handleBossDefeated 以 hook 回流),逐字保留原 handler 本體 - seenFlavorHints 與 P3_HITSTOP_MS 隨路由移動;session 慣例附測試重置鉤子 - characterization 測試 10 案先行鎖定:HP/技能路由、星味首遇 session 語意、 P3 時停與 arena 增益投放守門(資料驅動階段/EX 排除)、票券蝠、解綁零殘留 測試:vitest 1096 全綠(1038 既有零修改 +58);tsc --noEmit 0 錯;lint 0 error Co-authored-by: Cursor <cursoragent@cursor.com>
- 記錄 GameScene strangler 拆分結果:GameScene 降至 875 行 - 記分 +1(reward 1),累計總分 +325 測試:node scripts/verify-002-log.mjs --base-ref origin/main 通過 Co-authored-by: Cursor <cursoragent@cursor.com>
- 純結構重構、行為零改變 → patch(使用者感受不到的內部重構依 SemVer 規則屬 patch) 測試:無(changeset 檔案) Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
s123104
added a commit
that referenced
this pull request
Jul 27, 2026
- 修正 GameScene 拆分後 13 處註解/設計文件位置漂移(rg 全庫掃描,超出點名的 1 處) - AGENTS.md v5.7:rebase 稽核前置、難度驗收證據階層(bot 勝率非裁決真值、至少 ×7 取中位)、 strangler 兩段式 commit 慣例 - 002 條目內文測試數字訂正(1096→1106,檔頭記分不動);新增 patch changeset - L4 交錯 A/B 包絡(4/4↔4/4、TTK 包絡重疊)佐證裁決改採 clearRate+靜態軸 測試:vitest 1106 全綠;tsc 0 錯;lint 0 error;CI Quality Checks(含 002 聚合檢查)全綠
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目標
GameScene.ts原 1180 行,距eslint.config.js的max-lines: 1200硬閘僅剩 20 行;W2(L22/L24 新魔王+稜化/引力化關卡)必然撞閘。本車以 v17_debt(#807)同構的 strangler 手法把 GameScene 拆到 875 行(餘裕 325 行),行為零改變。拆分範圍(沿 v17 交接 handoff_backlog 五切點)
scenes/GameScene.tssystems/levelGate.tssystems/mercyDirector.tssystems/damageDirector.tssystems/playerFeel.tssystems/sceneEvents.ts工法:逐模組機械搬移+同步撰寫新模組單元測試(模組與測試同 commit 落地,與 v17_debt #807 同構)。GameScene 保留 run 狀態(hp/deaths/finished/transitioning/save)與生命週期;抽出模組僅持自身呈現狀態,hooks 閉包延遲解析。
events契約凍結未動;save schema 未動。行為零改變證據(依證據力排序)
1.(最高權重)機械搬移 diff 逐項可驗:五個 extract commit 各自可逐字對照——常數(GATE_*、QUAKE_BOUNCE_VY、MOUTH_OFFSET_X、P3_HITSTOP_MS)、tween 參數、幾何判定、guard 順序與呼叫序皆原樣搬移;
update()逐幀呼叫順序凍結。審查實測佐證:平均行長 42.3→43.9(無壓行湊數)、巢狀三元 rg 零命中。2. 既有測試套件零修改全綠:基準 1038 案(rebase 後 main 為 1048 案)一行未改全數通過;分支 1106 = 1048 + 本車新增 58 案。
3. 靜態軸與確定性指標全等:
4.(補強)新模組單元測試 58 案:levelGate 16/mercy 10/damage 12/feel 10/events 10,逐條轉錄搬移前行為(生成幾何、演出參數、格擋管線、浸水三聯結算、事件分派表、解綁零殘留)。註:模組與測試同 commit 落地,git 史上不構成「先行鎖定舊架構」的證明——行為零改變由第 1–3 條證據鏈承擔,本項僅為迴歸防護網。
5.(觀測,不得作為裁決真值)L4EX bot 勝率:交錯 A/B 下 main 3/42(7.1%)vs branch 3/46(6.5%),z≈0.12 無統計顯著性;且同版 main 跨時段噪訊達 11pp(25%→14%),遠大於觀測差 0.6pp——此指標對機器負載高度敏感,僅作附錄觀測。
e2e:116 passed/4 failed/15 skipped——4 個失敗(
v12:276、v13:179、v15:80、v16:191)已在基準 main 的獨立 worktree 上以逐字相同斷言訊息重現,屬 main 既有破損(#901 未修),非本車引入,已回報 PM。過程透明揭露
開發途中 main 合入 #901/#884/#902;PM 側於 09:00 將本分支 rebase 至
57550da35並補 002 聚合 commit;worker 於 rebase 後重跑全部閘門。註:該次 rebase 因發生於 PR 開啟前且無 pre-rebase ref 留痕,審查席無法以 patch-id 覆核——此治理缺口已依審查建議寫入 AGENTS.md v5.7(follow-up PR)。002 / changeset
回報 PM 的上游既有問題(本車依約不修)
hotfix:417/v11:201具負載敏感 flakiness