Overlay-base cache restore misses on cache backends that only prefix-match restoreKeys
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 90/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- ci-cd
調査の方向性
src/overlay/caching.ts の290~302行あたりから始めます。ここでは downloadOverlayBaseDatabaseFromCache が actionsCache.restoreCache を呼び出し、キーのプレフィックスだけを引数として渡しています。そのすぐ上にある、codeql-overlay-base-database-<hash>-<sha>-<run_id> を書き込むアップロード処理と比較してください。修正では、同じプレフィックスを第3引数(restoreKeys)として渡します。その後、TypeScript スイートにある既存のオーバーレイキャッシュテストを実行し、現在の GitHub キャッシュの動作にリグレッションがないことを確認してください。PR の実行で、プレフィックスのみをサポートするバックエンドからキャッシュを復元でき、GitHub ホステッド環境での動作が現在と同じであれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
downloadOverlayBaseDatabaseFromCache restores the overlay-base database by passing the key prefix as the primary key, with no restoreKeys:
actionsCache.restoreCache(
[dbLocation],
cacheRestoreKeyPrefix,
undefined,
{ segmentTimeoutInMs: 3000 },
)
This depends on the primary key matching by prefix. GitHub's cache service does that, but some Actions-cache-compatible backends only prefix-match restoreKeys. One example is the transparent cache on Blacksmith runners. On those backends, PR runs can never restore the overlay-base database, even though default-branch runs upload it successfully. Every PR run then falls back to a full analysis.
What we see
Default-branch run, on the same runner type:
Setting overlay database mode to overlay-base with caching because we are analyzing the default branch.
Uploading overlay-base database to Actions cache with key codeql-overlay-base-database-1-<hash>-python-2.27.1-<sha>-<run_id>-1
Successfully uploaded overlay-base database from /home/runner/_work/_temp/codeql_databases
Pull request run:
Setting overlay database mode to overlay with caching because we are analyzing a pull request.
Looking in Actions cache for overlay-base database with restore key codeql-overlay-base-database-1-<hash>-python-2.27.1-
No overlay-base database found in Actions cache
No overlay-base database found in cache, reverting overlay database mode to none.
Minimal reproduction of the backend difference
A cache entry saved as probe-<run_id>-full, then restored in a later job on the same branch with actions/cache/restore@v4:
| Restore | GitHub-hosted runner | Blacksmith runner |
|---|---|---|
key: probe-<run_id>- (prefix as the primary key, like this action) |
hit | miss |
key: probe-<run_id>-nomatch, restore-keys: probe-<run_id>- |
hit | hit |
Suggested fix
Also pass the prefix as a restore key:
actionsCache.restoreCache(
[dbLocation],
cacheRestoreKeyPrefix,
[cacheRestoreKeyPrefix],
{ segmentTimeoutInMs: 3000 },
)
On GitHub's cache this matches exactly the same entries as today, since the prefix is tried first either way. On backends that only prefix-match restore keys, overlay analysis starts working.
Environment
github/codeql-action/initandanalyze@v4, CodeQL bundle 2.27.1build-mode: none, languagespythonandjavascript-typescript- Third-party hosted runners (Blacksmith) whose
actions/cachecalls go to their own cache backend
- 主要言語
- TypeScript
- スター
- 1.7k
- フォーク
- 494
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 52
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/codeql-action のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
github/codeql-action#4052 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
github/codeql-action#4199 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
github/codeql-action#4185 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
github/codeql-action#4173 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
github/codeql-action#4078 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
github/codeql-action の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
[Bug] remember() with special characters in namespace hangs until timeout instead of returning 400オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
MystenLabs/MemWal#1133 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug user-priority/P2
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Effect-TS/effect#8881 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信