Service worker cache writes can be cut off; query strings add unread copies
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript
調査の方向性
sw.jsの95行目付近と116〜119行目を読み、次にtests/unit/service-worker.test.jsを調べて、fetchイベントとキャッシュへの書き込みがどのようにテストされているかを確認してください。既存のテストを確認するため、npm testを実行してください。fetchイベントによってキャッシュへの書き込みが継続され、?utm_source=xを含むリクエストがクエリパラメーターのないURLで保存されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
The service worker's fetch handler saves fresh responses to the cache without event.waitUntil, so the browser can stop the worker before the write finishes. It also stores each URL under its full query string, while reads ignore the query string, so every distinct query adds a copy that is never read.
Where
sw.js:116-119(cache.putoutsideevent.waitUntil)sw.js:95(reads usecaches.match(request, { ignoreSearch: true }))
Details
const copy = response.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(request, copy)); // not in event.waitUntil
- The write promise is not kept alive. The browser may terminate the worker once
respondWithhas settled, so the "next visit gets the new version" comment does not always hold. The offline copy can stay a release behind, file by file. - Every distinct query string (shared links with
?utm_...,?source=pwa) stores another copy ofindex.htmlunder its own key. Reads never use those keys, and they are only removed when the cache name changes.
Impact
The offline copy can be stale or mixed after an update, and storage grows slowly with shared links. This is low severity, because the network-first path still serves fresh files while online.
Suggested fix
- Wrap the write:
event.waitUntil(caches.open(CACHE_NAME).then((c) => c.put(key, copy))). - Store under the URL without its query string (
const url = new URL(request.url); url.search = '';), matching how reads look it up.
Acceptance criteria
-
tests/unit/service-worker.test.jschecks that the fetch event'swaitUntilreceives the cache write - A request with
?utm_source=xis stored under the bare URL
Getting started
- Relevant files:
sw.js,tests/unit/service-worker.test.js - How to run tests:
npm ci && npm test
Filed by repo-audit/full-audit at 73cd279. Severity: low. Effort: S. audit-key: reliability|sw.js|fetch
- 主要言語
- JavaScript
- スター
- 4
- フォーク
- 2
- 平均マージ
- 6時間 13分
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TMHSDigital/Static_Chess のほかの issue
-
enhancement good first issue severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TMHSDigital/Static_Chess#163 ·
メンテナーはふだん 1 日以内に返信
-
good first issue performance severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
TMHSDigital/Static_Chess#157 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue severity: low
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
TMHSDigital/Static_Chess#155 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
TMHSDigital/Static_Chess#148 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
TMHSDigital/Static_Chess#145 ·
メンテナーはふだん 1 日以内に返信
TMHSDigital/Static_Chess の issue をすべて見る
似ている issue
-
marketing
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
[Bug] Account menu (footer ⚙) doesn't dismiss on outside click — stays open and covers the Bot listオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Fei2411/DeepSeek-Bot#1693 ·
-
area-templates triage:bot-seen triage:needs-human
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoft/aspire#22356 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
HarperFast/skills#153 ·