fix(ratewise): RW-6 moneybox 首爾掛牌日跨日刷新(#514 拆分 6/7)#520
Conversation
- 加 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>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1568401338
ℹ️ 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".
| if (oldSnapshotDate && newSnapshotDate && oldSnapshotDate !== newSnapshotDate) { | ||
| return { | ||
| shouldUpdate: true, | ||
| reason: 'date-rollover', |
There was a problem hiding this comment.
Align rollover refresh with the history file date
When a scheduled run lands after Seoul midnight but before Taipei midnight (15:00–15:59 UTC), this new date-rollover path marks latest.json dirty even if rates are unchanged; I checked .github/workflows/update-moneybox-rates.yml, and the save-history step still computes CURRENT_DATE with TZ=Asia/Taipei and copies the current fetch whenever latest is dirty. That means a Seoul 2026-06-01 snapshot can be written to providers/moneybox/history/2026-05-31.json, corrupting the public daily history and history-30d dates; please derive the history filename from the Seoul snapshot date or hold this rollover update until the workflow uses the same date basis.
Useful? React with 👍 / 👎.
- 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>
|
已加入 RW-6b(本 PR 現為完整 MoneyBox 收尾):① workflow history 檔名改用首爾掛牌日(extractSeoulSnapshotDate + fallback)② aggregate 缺失補 changed=true ③ sw.ts history-30d 路由加 providers/moneybox(離線趨勢圖)。typecheck/lint/2516 測試/build 全綠。 |
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b43012454a
ℹ️ 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".
| registerRoute( | ||
| ({ url }: { url: URL }) => | ||
| url.pathname.includes('/public/rates/history-30d.json') || | ||
| url.pathname.includes('/public/rates/providers/moneybox/history-30d.json') || |
There was a problem hiding this comment.
這裡把 MoneyBox aggregate 加進既有的 history-aggregate-cache,但同一個 route 下面的 ExpirationPlugin 仍是 maxEntries: 1;當使用者在線先載入台銀 /public/rates/history-30d.json 再載入 MoneyBox /providers/moneybox/history-30d.json(或反過來)時,後載入的項目會把前一個 aggregate 從同一個 Cache Storage 驅逐,離線切回另一種趨勢圖就沒有 aggregate 可用。請把容量調到至少 2 或拆成不同 cache,否則新增的離線趨勢快取只會保留最後載入的 provider。
Useful? React with 👍 / 👎.
|
內容已 squash 合併至 #523(08e27f43),關閉重複 PR。 |
摘要
#514 拆分第 6 支(獨立、零視覺風險)。換錢所(MoneyBox)匯率以首爾掛牌日為準,但牌價不變卻跨日時,
latest.json未刷新 → 與每日 history 日期不對齊,趨勢圖天數/日期可能不準。變更
scripts/fetch-moneybox-rates.js:新增extractSeoulSnapshotDate(updateTime 首爾日曆 / UTC timestamp 換算)+shouldRefreshLatestSnapshot(rate-changed 或 date-rollover 才刷新),整合進hasRateChanges。needsSchemaMigration/enrichExchangeShopRatesPayload(schema 遷移)完全不動,新邏輯疊加非取代。scripts/__tests__/fetch-moneybox-rates.test.ts(新):date-rollover / unchanged / rate-changed 三案例,並納入test:root。範圍說明
history-30d.json離線快取路由列 RW-6b(避免本支過大)。Test plan
Refs #514(6/7)。獨立可合。
🤖 Generated with Claude Code
via Happy