Skip to content

fix(ratewise): P0 PWA precache-first 與 CDN ETag 收斂#425

Merged
s123104 merged 9 commits into
mainfrom
fix/ratewise-pwa-etag
Jun 26, 2026
Merged

fix(ratewise): P0 PWA precache-first 與 CDN ETag 收斂#425
s123104 merged 9 commits into
mainfrom
fix/ratewise-pwa-etag

Conversation

@s123104

@s123104 s123104 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

自 PR #411 拆分 P0 修復,僅 cherry-pick 三個 commit 至 origin/main

  • 86c77b4a — iOS PWA precache-first 導覽(移除 3s timeout 假離線)
  • 6790b179 — 移除 exchangeRate If-None-Match(避免 jsDelivr preflight 失敗)
  • cbd116c1 — 移除 moneybox CDN ETag 請求,更新 OpenData / SeoTech 說明

刻意排除:split-meow、ci.yml revert、AppLayout 移除 PwaInstallGuide 等無關變更。

Changeset(patch):離線導覽更快、匯率不再因 ETag 304 卡住。

Cherry-pick 衝突處理

  • offline.html:採 cherry-pick 版(主題感知 + viewport-fit)
  • exchangeRateService.ts / OpenData.tsx:採 ETag 修復文案
  • AGENTS.md:保留 main,不納入 PR411 治理段落漂移

Test plan

  • pnpm --filter @app/ratewise test(pre-push 全 suite pass)
  • focused:pwaOfflineFallback / exchangeRateService / moneyboxRateService(53 passed)
  • pnpm build:ratewise
  • sw.test.ts + pwa-offline.test.ts 對齊 precache-first 守門測試

Made with Cursor

haotool and others added 5 commits June 26, 2026 02:42
- 移除 NAVIGATION_NETWORK_TIMEOUT_MS + Promise.race:iOS eviction 後 3s timeout
  會將 offline.html 回傳給在線用戶(假離線症狀,看起來像未更新至最新版本)
- Cold start 改用 matchPrecache('index.html') 立即回傳,等同 createHandlerBoundToURL
  行為且無需等待;背景同步更新 html-cache 供暖啟動使用
- ensureOfflineHtmlCached:同時備份 index.html 至 html-cache,使 index 與
  offline.html 具有同等 iOS eviction 存活率
- resolveOfflineDocumentFallback 新增 matchIndexHtmlInAnyCache 第二層 fallback

測試:pwaOfflineFallback.test.ts 補齊 matchIndexHtmlInAnyCache 路徑;154 ratewise tests pass

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>
- 停止對 jsDelivr/GitHub Raw 發送 If-None-Match 條件式請求
- 移除 304 分支,保留 ETag 寫入快取供未來 Worker proxy 路徑
- 同步更新 exchangeRateService 單元測試

測試:pnpm --filter @app/ratewise test -- exchangeRateService(32 passed)

Co-authored-by: Cursor <cursoragent@cursor.com>
- fetchFromCDN 不再傳入 cachedEtag,不發送 If-None-Match 標頭
- 移除 304 Not Modified 分支,改由 HTTP cache 管理重複請求
- 更新測試:驗證即使快取有 ETag 也不附帶 If-None-Match
- 更新 OpenData.tsx、SeoTech.tsx、seo-metadata.ts FAQ 說明文字
- 同步更新 open-data.md Markdown mirror
- AGENTS.md 補充 UI/UX 治理知識點

測試:pnpm --filter @app/ratewise test -- moneyboxRateService(passed)

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>
- 合併三個 cherry-pick changeset 為單一 patch 條目
- 更新 002 紀錄 P0 收斂策略與累計分數

測試:focused sw/exchangeRate/moneybox 53 passed;pnpm build:ratewise

Co-authored-by: Cursor <cursoragent@cursor.com>
- 移除 3s timeout 舊斷言,改驗證 matchPrecache index.html
- 防回歸 NAVIGATION_NETWORK_TIMEOUT_MS 重新引入

測試:sw.test.ts + pwa-offline.test.ts 65 passed

Co-authored-by: Cursor <cursoragent@cursor.com>
@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 結構化數據
  • ✅ 內部連結結構

@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: f9921d724a

ℹ️ 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/ratewise/src/services/exchangeRateService.ts
haotool and others added 2 commits June 26, 2026 08:21
- 寫入 Learned Preferences/Facts(PR 合併批准、銀行賣出價定位、SSOT 路徑、Zen 主色)
- 002 新增 neutral-agents-continual-learning-sync 條目

測試:未執行(僅文件變更)

Co-authored-by: Cursor <cursoragent@cursor.com>
- Codex P1:localStorage TTL 到期後避免 HTTP cache 回傳過期 body
- 補 exchangeRateService 測試斷言 cache: 'no-cache'
- 更新 changeset 描述納入 CDN 重新驗證

測試:pnpm --filter @app/ratewise test -- exchangeRateService(32 passed)

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

Copy link
Copy Markdown
Contributor

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

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

@s123104

s123104 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

已於 4822b84 修復 Codex P1:fetchFromCDN 加入 cache: 'no-cache',localStorage TTL 到期後強制 CDN 重新驗證,避免 HTTP cache 回傳過期 body。測試已補 expect(capturedInit?.cache).toBe('no-cache') 斷言(32 passed)。

@github-actions

Copy link
Copy Markdown
Contributor

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

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

@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: 4822b84401

ℹ️ 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/ratewise/src/services/moneyboxRateService.ts Outdated
- Codex P2:換錢所 TTL 到期後避免 HTTP cache 回傳過期報價
- fetchFromCDN 加 cache: 'no-cache' 並補 moneyboxRateService 測試斷言
- 更新 changeset 與 002 獎懲記錄

測試:pnpm --filter @app/ratewise test -- moneyboxRateService/exchangeRateService(48 passed)

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

Copy link
Copy Markdown
Contributor

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

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

@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: d4a3f87781

ℹ️ 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
@s123104

s123104 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

QA 複核摘要(E2E Runner / 2026-06-26)

測試 SHAd4a3f877814445986ef69246c33c0db573833437
本地 Previewhttp://127.0.0.1:4173/ratewise/(最新 build)


整體判定:QA FAIL(未合併)

項目 結果
本地 build pnpm build:ratewise 成功
功能(首頁 / 離線模擬) ✅ 正常
Console errors 1 pageerrorMinified React error #418(hydration mismatch)
正式站 baseline ⚠️ 同樣存在 #418(非 PR425 引入)

Console 證據

乾淨 Playwright context 首屏仍觸發 React #418 hydration pageerror
console.error 層級訊息含 SW 註冊與 GA 載入失敗(測試環境預期),但 pageerror #418 為阻擋項

截圖路徑(本機 QA 產物,未提交)

  • screenshots/pr425-qa-homepage.png
  • screenshots/pr425-qa-homepage-clean.png
  • screenshots/pr425-qa-homepage-fresh.png
  • screenshots/pr425-qa-offline.png
  • screenshots/pr425-qa-production-baseline.png

CI 狀態(HEAD commit check-runs)

非 paths filter 問題ci.ymlquality job 對所有 PR 無條件執行;E2E 僅在 apps/ratewise/** 等路徑命中時觸發(本 PR 已命中)。

實際根因:短時間內多次 push 造成 CI run churn + runner 卡住:

Run ID 狀態 說明
28209039722 in_progress(殭屍) Quality Checks ✅;E2E Smoke 卡在 Setup Playwright Chromium
28209127857 cancelled 後續 push 取消
28209403391 pending(空 jobs) 最新 run 未分配 runner

HEAD commit 目前僅關聯 CodeQL + SEO Audit(7/7 可見綠燈),缺主 CI workflow 的 Quality / E2E / Lighthouse checks

建議修復:對 PR425 重新觸發 CI(gh workflow run ci.yml 或 empty commit / re-run failed jobs),待 Quality + E2E Smoke 全綠後再評估合併。


合併建議

選項 A(推薦,需 maintainer 明確 waiver)
在確認 P0 修復(precache-first / CDN no-cache)功能正確的前提下,以已知 baseline waiver 合併——#418 為全站 pre-existing P1(見 docs/superpowers/specs/2026-06-26-ratewise-mobile-pwa-qa-audit-spec.md P1-001),正式站已存在,非本 PR regression。

選項 B
先修 #418 根因(SSR/Client 文字 diff)再合併——時程較長,不阻擋 P0 hotfix 價值但不符合 strict console=0 gate。


本輪動作:依指示 未執行 merge。待 maintainer 選 A/B 並確認 CI 重新跑完。

- header 由 +1 更正為 +3(reward 3、penalty 0),累計 +62 不變
- 新增 neutral-002-score-header-correction-pr425 條目

測試:未執行(僅 002 稽核欄位修正)

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

s123104 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

QA / 合併建議

請勿在未收到明確「合併 #425」指示前自動 squash merge。

@github-actions

Copy link
Copy Markdown
Contributor

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

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

@s123104

s123104 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up(ab66580d 後續)

已推送 commit

SHA 說明
4822b844 exchangeRateService:TTL 到期後 fetchFromCDNcache: 'no-cache',避免 HTTP cache 回傳過期 body;補 32 項單元測試
d4a3f877 moneyboxRateService:同策略加 cache: 'no-cache';補測試
f20d84fd 002 分數 header 更正為 +3

CI 處置

  • 先前 E2E Smoke (PR) CANCELLED(連續 push 取代 run)→ 已取消 stale run、重跑 28210096191
  • 首次 Quality Checks 因 Vitest worker teardown flake(AppLayout.logo.test.tsx)失敗 → gh run rerun --failed 已綠
  • 目前僅 E2E Smoke (PR) 執行中;Quality / Lighthouse / CodeQL / SEO Audit 均已 PASS

合併

依 AGENTS.md 未自動 merge,待 maintainer 明確批准。

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