Skip to content

[BF-024] PWA cache 策略和 service worker 更新机制 - #83

Merged
baixiangcpp merged 3 commits into
mainfrom
fix/BF-024-pwa-cache-sw-strategy
Jun 22, 2026
Merged

[BF-024] PWA cache 策略和 service worker 更新机制#83
baixiangcpp merged 3 commits into
mainfrom
fix/BF-024-pwa-cache-sw-strategy

Conversation

@baixiangcpp

@baixiangcpp baixiangcpp commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Issue

Closes #44

Scope

  • Updates the service worker cache strategy for BF-024 only.
  • Adds install-page controls for clearing Byteflow PWA CacheStorage buckets.
  • Updates Trust Center / Install copy for the PWA cache behavior across all locales.
  • Extends guards and smoke coverage for PWA cache buckets, offline behavior, external-request network-only behavior, and manual cache clear.

Implementation

  • Split service worker caches into versioned buckets: app shell, static assets, tool chunks, manifest/icons, runtime pages, and metadata.
  • Keeps non-GET, third-party, explicit network-only, API, and sensitive-query requests out of CacheStorage.
  • Preserves the existing build-id SW version injection and update prompt path.
  • Adds a localized install-page "Clear cached app files" control that deletes only byteflow-* caches and does not touch tool input/output storage.
  • Guards manual cache clearing against in-flight runtime cache writes so cleared byteflow-* buckets do not reappear during the clear window.
  • Documents the PWA cache strategy in Trust Center copy and Install page copy.

Validation

  • npm run lint
    • PASS
  • npm run test
    • PASS: 217 files / 1092 tests
  • npm run validate
    • PASS
  • npm run build
    • PASS: 1289 static pages, build:sw injected build id 14c3a03
  • npm run test:e2e:smoke
    • PASS via npm run test:e2e:smoke -- --port=4177
  • npm run test:e2e:pwa
    • PASS via npm run test:e2e:pwa -- --port=4178
  • npm run check:sw-version
    • PASS: APP_VERSION uses __BUILD_ID__

Acceptance Criteria

  • App shell 可离线加载。
  • 本地工具核心 UI 可离线打开。
  • 外部请求工具离线时显示明确网络提示。
  • Service worker 不缓存 POST 或外部 API 响应。
  • SW 版本更新可提示用户刷新。
  • npm run check:sw-version 通过。
  • npm run test:e2e:pwa 通过。

Cache Strategy

  • App shell: byteflow-app-shell-v<build-id>.
  • Static assets: byteflow-static-assets-v<build-id>.
  • Tool chunks: byteflow-tool-chunks-v<build-id>.
  • Manifest/icons: byteflow-manifest-icons-v<build-id>.
  • Runtime pages: byteflow-runtime-pages-v<build-id>.
  • Metadata: byteflow-meta-v<build-id>.
  • Network-only: non-GET, third-party origins, /api/*, sensitive query strings, and explicit x-byteflow-cache-mode: network-only / x-byteflow-external-request: 1 requests.

Manual Checks

  • Desktop install page cache-clear control screenshot captured.
  • Mobile install page cache-clear control screenshot captured.
  • PWA smoke verified local tool shell opens offline.
  • PWA smoke verified external request probe is not cached.
  • PWA smoke verified manual cache clear removes byteflow-* cache buckets.

Privacy Check

  • 不采集工具输入
  • 不采集工具输出
  • 不新增未披露的外部请求
  • 不持久化敏感 payload
  • 不缓存 external-request responses
  • 不新增 analytics payload/query/file-name collection

Screenshots / Evidence

  • output/playwright/BF-024-install-cache-desktop.png
  • output/playwright/BF-024-install-cache-mobile.png

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 21, 2026

Copy link
Copy Markdown

Deploying byteflow with  Cloudflare Pages  Cloudflare Pages

Latest commit: 14c3a03
Status: ✅  Deploy successful!
Preview URL: https://c221c1f8.byteflow-c58.pages.dev
Branch Preview URL: https://fix-bf-024-pwa-cache-sw-stra.byteflow-c58.pages.dev

View logs

@baixiangcpp
baixiangcpp merged commit 34f20cd into main Jun 22, 2026
2 checks passed
@baixiangcpp
baixiangcpp deleted the fix/BF-024-pwa-cache-sw-strategy branch June 22, 2026 15:46
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.

[BF-024] PWA cache 策略和 service worker 更新机制

1 participant