fix(ratewise): 移植導覽 case-3 有界網路 fallback 至 main#456
Merged
Conversation
- precache miss 時以 8 秒 Promise.race 限制網路等待,逾時回 offline shell - 逾時後以 event.waitUntil 保留 in-flight fetch,成功仍寫入 html-cache - 僅在 precache miss 後套用,不重新引入全域 3 秒逾時 - 補 case-2/case-3 行為測試與防回歸斷言 測試:vitest sw.test.ts 36 項通過、tsc --noEmit 通過
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0bc7e4c18d
ℹ️ 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 on lines
+1
to
+3
| --- | ||
| '@app/ratewise': patch | ||
| --- |
There was a problem hiding this comment.
- 網路先成功時 clearTimeout,避免逾時計時器稍後 reject 成 unhandled rejection - 補網路成功回傳 network response 與晚成功仍寫入 html-cache 的測試 測試:sw.test.ts 38 項通過、tsc 通過
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
- 將 mock 方法擷取為區域變數後再斷言,消除 @typescript-eslint/unbound-method 測試:sw.test.ts 通過、pnpm lint 通過、tsc 通過
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
This was referenced Jun 27, 2026
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.
摘要
回補生產缺口:PR #426「導覽 case-3 有界網路 fallback」當初合進
chore/ratewise-production-governance分支而非 main(已用git merge-base --is-ancestor驗證非 main 祖先;origin/main:sw.ts無NAVIGATION_FETCH_TIMEOUT_MS)。本 PR 將其意圖忠實移植至 main。由並行 Cursor 子代理(composer-2.5-fast,獨立 worktree)完成移植。
變更(apps/ratewise/src/sw.ts)
NAVIGATION_FETCH_TIMEOUT_MS = 8000。Promise.race([networkFetch, 8s timeout]),逾時改回resolveNavigationFallback()(offline shell),避免連線掛住造成無限白屏。event.waitUntil(networkFetch…)保留 in-flight fetch,成功仍寫入 html-cache(下次可命中)。Test plan
vitest run src/__tests__/sw.test.ts→ 36 passedtsc --noEmit→ exit 0🤖 Generated with Claude Code