Skip to content

feat(starpuff): T7-A 運行時功能(UserSettings SSOT / 備援 / PWA / pity meter) - #864

Merged
s123104 merged 17 commits into
mainfrom
feat/starpuff-t7a-runtime
Jul 26, 2026
Merged

feat(starpuff): T7-A 運行時功能(UserSettings SSOT / 備援 / PWA / pity meter)#864
s123104 merged 17 commits into
mainfrom
feat/starpuff-t7a-runtime

Conversation

@s123104

@s123104 s123104 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • UserSettings SSOT 與偏好接線收斂
  • 存檔備援輪替與 checksum 損毀恢復
  • PWA 更新改 prompt 型並加安全場景套用時機閘
  • 統一設定頁與震屏閃光強度閘
  • T7-A changeset 與 002 尾聚合

Test plan

  • pnpm --filter @app/starpuff test:run (911/911 綠)
  • pre-push check 完整跑過

Made with Cursor

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@s123104
s123104 enabled auto-merge (squash) July 25, 2026 20:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5bfadba36b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/starpuff/src/game/core/save.ts
Comment thread docs/dev/002_development_reward_penalty_log.md Outdated
Comment thread apps/starpuff/src/game/logic/mercyHeal.ts Outdated
Comment thread apps/starpuff/src/game/systems/settingsPage.ts Outdated
Comment thread apps/starpuff/src/game/core/settings.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e21ad6885

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/dev/002_development_reward_penalty_log.md Outdated
Comment thread apps/starpuff/src/game/core/save.ts Outdated
Comment thread apps/starpuff/src/game/systems/settingsPage.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3d644fa68

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/dev/002_development_reward_penalty_log.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6dd563e75d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/starpuff/src/pwaUpdateGate.ts
Comment thread docs/dev/002_development_reward_penalty_log.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c9467bcee4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/dev/002_development_reward_penalty_log.md Outdated
Comment thread apps/starpuff/src/game/core/settings.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a763fd70a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/dev/002_development_reward_penalty_log.md Outdated
Comment thread apps/starpuff/src/game/systems/hud.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52c3865117

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/starpuff/src/game/core/save.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc13147e79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/dev/002_development_reward_penalty_log.md Outdated
haotool and others added 16 commits July 26, 2026 08:38
- v19 Consolidation #819 子項 4/7/8/9:統一設定頁、存檔備援、PWA 更新時機、慈悲補血去 RNG
- worktree feat/starpuff-t7a-runtime base main@e611e29b0

測試:開工錨空 commit,無程式變更

Co-authored-by: Cursor <cursoragent@cursor.com>
- mercyHeal 決策去 RNG(#819 卡 9):首次符合門檻固定生成,之後依受傷次數
  (一般 2/boss 1)或低血累計時間(30s/15s)任一達標保底,門檻常數單點於 MERCY_HEAL
- 受傷偵測內建於狀態機(lastHp 比對),GameScene 零新增接線;RNG 僅保留生成位置用
- EX 生存段固定愛心為既有確定性獨立管線,盤點後不動;EX 每命上限 1 沿用

測試:pnpm vitest run mercyHeal 13 案全綠;pnpm test:run 全量 880 案通過;typecheck 通過

Co-authored-by: Cursor <cursoragent@cursor.com>
- persistSave 寫入前把上一份合法主檔輪替至 sp-save-backup,payload 附 canonical djb2 checksum(#819 卡 7)
- loadSave 以 parseSaveStrict 區分損毀與缺席:主檔損毀先從備援恢復回寫,備援亦壞才回預設並 console.warn 留痕
- localStorage 不可用時於 Title 安靜時刻以殼卡明確提示進度無法保存;resetSave 同步清除備援
- 匯出/匯入延後不做(行動 PWA 收益低,002 記裁量)

測試:pnpm vitest run save 28 案全綠(新增備援 9 案,含 legacy 無 checksum 向後相容與雙損毀回退);typecheck 通過

Co-authored-by: Cursor <cursoragent@cursor.com>
- registerType 改 prompt(#819 卡 8):新版 ready 由 onNeedRefresh 標記 pending,不再立即接管
- 新增 pwaUpdateGate:殼層安靜(isShellBusy SSOT)才 updateSW(true) 套用,遊戲/配置/殼卡中絕不 reload
- controls class 邊界觀察者+5s 低頻重試兜底;pending 先清後套防重入;週期與回前景檢查沿用
- e2e t7.spec 守門:遊戲中不套用、Result 自動套用、Title 即套用;備援損毀恢復一併入 spec

測試:pwaUpdateGate 單測 6 案綠;t7 e2e 3 案過;typecheck 通過;prompt 流程經 context7 查證

Co-authored-by: Cursor <cursoragent@cursor.com>
- 新增 core/settings.ts(sp-settings v1 單鍵 schema,#819 卡 4):靜音/觸覺/常亮/
  減少動態/震屏強度/持向/鍵位布局七偏好集中
- 單一 versioned migration 吸收 legacy 散鍵(sp-muted/sp-rotation/sp-key-layout),不刪除向後相容
- rotation/layout/hud 儲存委派 settings;rotationNotice 改走 hasStoredRotationPref
- 觸覺與靜音解耦(卡 11):vibratePattern 單點閘 hapticsEnabled,震動先於靜音早退
- wakeLock 接 wakeLockEnabled 偏好+onSettingsChanged 即時重同步

測試:settings 單測 9 案紅→綠;全量 904 案通過;typecheck 通過

Co-authored-by: Cursor <cursoragent@cursor.com>
- 新增 DOM 設定頁(#819 卡 4):音效/震動/常亮/減少動態/畫面震動三檔即改即存,
  Title「設定」入口;按鈕配置移為頁內轉入口,Title 維持四鈕不溢出
- 新增 cameraFxGate(卡 12):包裝 main camera 單點縮放 shake/flash——off/low/full、
  reducedMotion 強制關震並縮閃光 0.3,boss/fx 全呼叫端零改動
- HUD 靜音鈕訂閱設定變更同步圖示與 aria-pressed;main.ts 增 cameraFx 觀測點
- e2e:設定頁全偏好切換持久、migration 吸收、震屏閘實效(reducedMotion 受擊不震);
  v5/v16/portrait 導航與儲存鍵斷言同步新入口與 sp-settings

測試:cameraFxGate 單測 7 案紅→綠;全量 911 案綠;t7 e2e 6 案+v5/v16/portrait/t2 全過;
真瀏覽器抽驗設定頁截圖與 console 0 錯

Co-authored-by: Cursor <cursoragent@cursor.com>
- 建立 @app/starpuff minor changeset:統一設定頁為使用者可感知新功能(#819 卡 4)
- 002 尾聚合條目:四子項(卡 4/7/8/9+11/12)出貨、測試計數與抽驗證據留痕

測試:changeset 為 release intent 純文檔;本車全量 911 案與 e2e 證據見前五 commit

Co-authored-by: Cursor <cursoragent@cursor.com>
- 審查 Blocking:設定頁全鈕僅綁 pointerdown,鍵盤 Enter/Space 完全無反應(WCAG 2.1.1)
- 抽 core/domButton.bindButtonActivation(#823/#830 先例):指標 pointerdown 即發、
  鍵盤/AT click(detail=0)放行、手勢級旗標防雙觸發;hud.addDomButton 與設定頁全鈕共用消重複
- 補 bindButtonActivation 單測 4 案+e2e 2 案(純鍵盤切換各類偏好、指標全鏈不雙觸發)

測試:domButton 單測 8 案(新增 4 案紅→綠);t7 e2e 8 案全過;typecheck 通過

Co-authored-by: Cursor <cursoragent@cursor.com>
- 審查 Blocking:sp-settings 損毀時直接回預設,legacy 偏好(如 sp-muted=1)被默默丟棄
- loadSettings parse 失敗改 fallback migrateFromLegacy()(legacy 存在即恢復、缺席等同預設)
  並 persist 回寫修復壞主鍵
- 補單測:壞 JSON+legacy、未知 schemaVersion+legacy 皆正確吸收且主鍵被修復

測試:settings 單測 11 案(新增 2 案紅→綠);全量 917 案通過;typecheck 通過

Co-authored-by: Cursor <cursoragent@cursor.com>
- 審查 Should-fix:邊界事件當下立即 reload 可能吃掉場景切換瞬間的點擊
- attemptPwaUpdate 改排 1.5s 寬限,期滿重驗殼層仍安靜才套用;寬限內轉忙
 (點下一關再入遊戲)放棄本次套用,交還 5s 重試管線
- e2e 新增 CTA 競態案:Result 寬限內點下一關照常進 Game、回安全場景後照常套用

測試:pwaUpdateGate 單測 7 案(寬限語意重寫,3 案紅→綠);t7 e2e 9 案全過;typecheck 通過

Co-authored-by: Cursor <cursoragent@cursor.com>
- 審查 Should-fix(PM 裁決刪 legacy):殘留舊值形成雙真相,主鍵遺失時會吸回過期偏好
- 升版與損毀修復落盤成功即 removeLegacyKeys;舊版回滾非支援發佈路徑(PWA 部署單向前進)
- persist 失敗(隱私模式/配額滿)保留 legacy 作下次開機來源;單測與 e2e 釘住兩側行為
- settings.ts 檔頭補跨分頁/併發寫入已知限制註解(last-writer-wins,單分頁互動情境接受)

測試:settings 單測 12 案(刪除案紅→綠+persist 失敗保留案);全量綠;t7 e2e 9 案全過

Co-authored-by: Cursor <cursoragent@cursor.com>
- 審查 Should-fix:輪替守衛(損毀主檔不入備援)原無專測,重構可能默默失守
- save.test 新增:主檔被寫壞後再落盤,備援維持上一份合法存檔、新主檔正常寫入

測試:save 單測 29 案全綠(新增 1 案)

Co-authored-by: Cursor <cursoragent@cursor.com>
- 審查 Should-fix:受傷 1 次+18s CD 比原 60% RNG 期望更慷慨,語意漂移偏鬆
- bossPityHurts 1→2(時間保底 15s 與冷卻不動);門檻常數單點 MERCY_HEAL
- 改後 level-audit 序列抽驗 L4/L12 EX high n=4 cap540:75%/75% 均過 ≥60% 門檻,
  相對 T6 基準(83%/100%)無顯著漂移;EX 每命上限 1、首顆邏輯未動

測試:mercyHeal 13 案(收緊案紅→綠);全量綠;bot 抽驗報告 t7a-pity2-l4/l12(console 0 錯)

Co-authored-by: Cursor <cursoragent@cursor.com>
- loadSave 主檔+備援雙壞無自癒會每次熱呼叫重複 warn:每工作階段節流一次
 (備援恢復路徑回寫自癒、天然單次不動)
- settings 損毀恢復旗標 wasSettingsRecoveredFromCorruption:main.ts 沿存檔不可用
  殼卡慣例於 Title 安靜時刻明確提示「偏好設定已重置」,不再靜默
- 跨分頁/併發寫入已知限制註解已隨 S4 commit 補入 settings.ts 檔頭

測試:save 29 案(節流斷言)+settings 13 案(旗標案);全量 921 案綠;typecheck 通過

Co-authored-by: Cursor <cursoragent@cursor.com>
- 尾聚合:2 Blocking+5 Should-fix/nits 七 commit 全數收斂,測試與 bot 抽驗證據留痕
- 記錄 v9 EX 果凍王案為 T6 既有缺陷(base 復現同敗),bossFsm 屬 T7-B 轄不越權修

測試:純文檔;全量 921 案與 e2e 證據見本輪各 commit

Co-authored-by: Cursor <cursoragent@cursor.com>
- 複核席補抓:keyConfig.addAction 六鈕仍僅綁 pointerdown——套用
  core/domButton.bindButtonActivation(同設定頁模式),保留 stopPropagation 殼層守衛
- e2e 補純鍵盤案:設定頁轉入按鈕配置後 Enter 觸發縮放(100%→105%)與取消收頁
- 002 補 neutral 更正條目:尾聚合誤載 t7 e2e 11 案、實為 9 案(歷史條目不刪改)

測試:t7 e2e 10 案(新案紅→綠)+v5 配置指標案回歸 7 案全過;全量 921 案綠;typecheck 通過

Co-authored-by: Cursor <cursoragent@cursor.com>
@s123104
s123104 force-pushed the feat/starpuff-t7a-runtime branch from dc13147 to 8ee7443 Compare July 26, 2026 00:47
- persistSave 拆為兩段獨立 try/catch:備援 setItem 配額失敗只吞自身錯誤,主檔覆寫照常執行
- parseSaveStrict 改以 'checksum' in data 判定:屬性存在但非字串一律判損毀走備援恢復
- 002 補兩筆 reward 並更新記分行(+2、累計 +242)

測試:save.test.ts 新增 2 案紅→綠;starpuff 全量 932 案綠;pnpm typecheck 全 workspace 綠

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b8ff789bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

> 版本:outline-v2-ultra
> 原則:每筆只保留日期、ID、原因、解法。
> 本次分數變化:+1(reward 1、penalty 0、neutral 0)|累計總分:+227
> 本次分數變化:+2(reward 2、penalty 0、neutral 0)|累計總分:+242

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 將本批分數變化更新為 +15

相較既有的 +13 評論,新證據是目標差異再包含 reward-starpuff-t7a-review-backup-rotation-nonblockingreward-starpuff-t7a-review-checksum-nonstring-corrupt,因此相對父提交共新增 15 筆 reward、0 筆 penalty、5 筆 neutral;本次變化應為 +15(reward 15、penalty 0、neutral 5)。累計由 +227 增至 +242 已正確,但目前摘要的 +2 仍與條目及累計值矛盾。請同步更正本批計數。

AGENTS.md reference: AGENTS.md:L184-L191

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已開 issue #889 追蹤

已合併 PR 的 002 檔頭摘要與新增條目數不一致(本 PR 應 +15)。issue #889 為 follow-up 修正卡。監控席保留 thread 至 main 修正 PR 合併。

Comment on lines +233 to 235
label: '設定',
menuId: 'settings',
onPress: () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 同步更新 v14-e 配置驗證流程

當執行 node scripts/v14-e-verify.mjs 時,腳本第 40 行仍直接操作 [data-menu="config"],但此處已將 Title 唯一入口改成 [data-menu="settings"],所以驗證會在第一個情境等待不存在的元素後逾時;即使修正入口,第 57、89 行仍讀取已遷移並刪除的 sp-key-layout,後者會在 JSON.parse(null).scale 崩潰。請讓腳本先經設定頁開啟按鈕配置,並改查 sp-settings.keyLayout

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已追蹤 → issue #879

v14-e 選擇器 [data-menu="config"] 失效屬 T7-A(#864)後既有結構漂移,與 #877 無關。

issue #879 已列為驗收 SSOT(v14-e/v14-f 重寫選擇器 + v14-b cw 根因)。監控席不 resolve 至腳本修復 PR 合併為止。

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