Skip to content

fix(ratewise): offline.html 自我修復打破 SW 死亡迴圈#508

Merged
s123104 merged 1 commit into
mainfrom
fix/ratewise-offline-shell-self-heal
Jun 28, 2026
Merged

fix(ratewise): offline.html 自我修復打破 SW 死亡迴圈#508
s123104 merged 1 commit into
mainfrom
fix/ratewise-offline-shell-self-heal

Conversation

@s123104

@s123104 s123104 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 根因fix(ratewise): 強化壞 SW 使用者連網自我修復積極傳播 #505swHealth 僅在 React UpdatePrompt 掛載後執行;在線用戶若被壞 SW 誤服 offline.html,永遠載入不了主 app → 修復邏輯無法觸發。既有 reload() / online 重載仍走同一 SW navigation → 死亡迴圈
  • 正式站探測(2026-06-28):production SHA c5f08b8、API v2.25.10、live precache 全綠、sw.jsCHECK_SHELL_PRECACHEindex.html — 伺服器端正常,問題在 client 端舊/壞 SW 狀態。
  • 修法:在 offline.html 內嵌獨立自我修復腳本(無 React 依賴):連網時 CHECK_SHELL_PRECACHE 探針 → 壞 SW 則 update + SKIP_WAITING → 導向 app shell;重試按鈕改為同一流程,移除 reload() 循環。

Test plan

  • vitest pwa-offline / swHealth / sw.test(86 passed)
  • pnpm typecheck
  • pnpm build:ratewisedist/offline.html 含自我修復腳本
  • 合併發版後:手機在線開啟 /ratewise/,若曾卡離線頁應自動跳回主 app(或點「重新載入」一次即可)

手機驗證步驟(使用者)

  1. 確認已更新至含此 PR 的版本(合併 release 後)
  2. 在 Safari/Chrome 開啟 https://app.haotool.org/ratewise/
  3. 若仍見「網路連線中斷 / 您目前處於離線狀態」但 Wi‑Fi/行動數據正常:
    • 等待 1–2 秒(自動修復)
    • 或點「重新載入」
  4. 預期:跳轉至正常匯率首頁(非 offline.html)
  5. 若仍失敗:設定 → 清除網站資料 → 重新開啟(最後手段)

Made with Cursor

- 在線卻載入 offline.html 時探針 CHECK_SHELL_PRECACHE 並 SKIP_WAITING
- 重試按鈕改為導向 app shell,移除 reload 造成的 SW 循環
- 補 pwa-offline 防回歸測試與 patch changeset

測試:vitest pwa-offline/swHealth/sw.test、typecheck、build:ratewise

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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@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

@github-actions

Copy link
Copy Markdown
Contributor

✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。

  • ✅ Sitemap 2026 標準
  • ✅ Breadcrumb Schema
  • ✅ JSON-LD 結構化數據
  • ✅ 內部連結結構

@s123104 s123104 merged commit 13ebfa5 into main Jun 28, 2026
17 checks passed
@s123104 s123104 deleted the fix/ratewise-offline-shell-self-heal branch June 28, 2026 09:11
s123104 added a commit that referenced this pull request Jun 30, 2026
* fix(ratewise): RW-3 PWA manifest 主題色 SSOT 化

- manifest theme_color/background 改讀 STYLE_DEFINITIONS.zen(移除硬編 #8B5CF6/#E8ECF4)
- 同步 themes.ts zen primary 99 102 241→124 58 237,修 TS↔index.css 漂移
- 離線模板主題化(需保留 #508 自我修復的高風險合併)列 RW-3b

測試:typecheck、lint、test 2516 passed、build:ratewise、zen 截圖驗證、manifest #7C3AED

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* fix(ratewise): 軟化 seo 文案更新頻率承諾與新鮮度免責

- RW-5:seo-metadata core/currency-landing 與內容 generator 一致將「每 5 分鐘自動同步/更新」改為「約每 5 分鐘檢查更新」
- OpenData 更新頻率 FAQ 補新鮮度免責(依資料來源與 CDN 快取而定)
- regenerate public mirrors/llms/api 同步;品牌定位詞「最精準」屬產品決策本支不改

測試:typecheck、lint、test 2516 passed、build:ratewise、mirrors 同步無漂移

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* fix(ratewise): RW-6 moneybox 首爾掛牌日跨日刷新

- 加 extractSeoulSnapshotDate/shouldRefreshLatestSnapshot:rate-changed 或 date-rollover 才刷新
- 整合進 hasRateChanges;保留 main 的 needsSchemaMigration/enrichExchangeShop(紅線不取代)
- 補 3 個 vitest 案例並納入 test:root(date-rollover/unchanged/rate-changed)

測試:moneybox vitest 3 passed、腳本 import 5 exports 正常、needsSchemaMigration 保留

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* fix(ratewise): moneybox history 檔名首爾化與 sw 離線路由(rw-6b)

- workflow history 檔名改用 extractSeoulSnapshotDate(資料首爾掛牌日)+ fallback 首爾 wall-clock
- aggregate 首次缺失補 changed=true,避免 history-30d.json 遺失卻不開 PR
- sw.ts history-30d 路由加 providers/moneybox 路徑,離線可服務換錢所趨勢圖

測試:typecheck、lint、test 2516 passed、build:ratewise(sw 編進 worker)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* fix(ratewise): rw-3b 離線頁主題感知並保留自我修復

- 合併 PR 433 主題感知離線模板(per-theme CSS 變數 + theme-color + safe-area + viewport-fit)
- 植回 main 的 PR 508 CHECK_SHELL_PRECACHE 自我修復腳本與 id=retry-btn(不取整檔避免回退死亡迴圈)
- generate-offline-html 移除 prettier 並將 generated offline.html 加入 prettierignore(prebuild 禁 prettier)

測試:typecheck、lint、test 2516 passed、build、nitro 離線頁深色 020617 且 508 導回 app 驗證

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* fix(ratewise): 對齊離線頁與 manifest 主題色 SSOT

- regenerate offline.html zen violet-600
- index.html theme-color 對齊 #7C3AED
- 更新 PWA E2E/unit 期望色
- 新增 offline/manifest artifact 一致性 smoke test

測試:pnpm build:ratewise、index.html.test.ts、pwa-offline.test.ts、pwa E2E theme-color

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

---------

Co-authored-by: haotool <haotool.org@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Happy <yesreply@happy.engineering>
Co-authored-by: Cursor <cursoragent@cursor.com>
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