Ci cache fix - #30
Merged
Merged
Conversation
build ジョブが matrix 全本で `Use Node.js` ステップの `Cache service responded with 400` により失敗していた。GitHub が旧 Actions Cache サービスの API を停止したため、setup-node@v2 が同梱する古い @actions/cache クライアントが通らなくなったもので、テスト自体は無関係。 setup-node は v7.0.0 で @actions/cache 5.1.0 へ更新され、現行の Cache サービスに対応する。checkout も同時に上げるのは、v2 が Node 20 ランタイム 前提で runner から非推奨警告を受けており、放置すれば同じ形で落ちるため。 どちらも with に渡している入力の仕様は v2 から変わっていない。
Dependabot alert が 17 件 open だった。すべて devDependencies 経由の推移的 依存で、manifest は package-lock.json。 npm audit fix(--force なし)で 21 件中 11 件が解消したが、残りは eslint@5.16.0 と mocha@10.8.2 の配下にあり、宣言レンジが修正版に届かない。 --force は mocha@8.1.3 へのダウングレードを選ぶため採用していない。mocha は 最新の 11.8.0 でも serialize-javascript ^6.0.2 を宣言しており、上流を上げても 修正版の 7.0.5 以降には到達できない。 そこで devDependencies の宣言レンジは据え置き、overrides で修正版に固定する。 eslint 5 から 9 への移行は .eslintrc.json を flat config に置き換える必要が あり、教材として参加者が読む設定が変わるため選ばなかった。 minimatch だけ親スコープ付きなのは、mocha が 5.x 系の API を要求しており、 ツリー全体を 3.1.5 に落とすと壊れるため。 検証: npm audit 0 件。CI が使う npm 10.9.8 / 11.17.0 / 11.19.0 のいずれでも npm ci が成功する。override が実際に通る経路 — eslint --cache による flat-cache の書き込みと読み出し、mocha --parallel のワーカーシリアライズ、 external-editor のロード — を個別に実行して確認済み。
matrix の 26.x だけ npm test が `ReferenceError: require is not defined in ES module scope` で落ちていた。 mocha 10.8.2 が引く yargs 16.2.0 は拡張子の無い `yargs` ファイルで CJS を 読ませており、Node 26 がこれを ESM として解釈するため。CI が setup-node の cache エラーで止まっていた間は npm test まで到達せず、この失敗は表面化して いなかった。22.x と 24.x は影響を受けない。 mocha 11.8.0 が引く yargs 17.7.3 はこの構造を持たない。 mocha 11 は diff ^7.0.0 を要求するが、GHSA-73rr-hh4g-fpgx は 7 系に バックポートされておらず 8.0.3 以降でのみ解消する。そのため diff も overrides に加えて 8.0.4 に固定する。 検証: npm audit 0 件。CI が使う npm 10.9.8 / 11.17.0 / 11.19.0 のいずれでも npm ci が成功する。diff が実際に使われる経路 — 失敗テストでの actual/expected の描画 — と、--parallel のワーカー、eslint --cache を個別に実行して確認済み。
`branches: ["*"]` はスラッシュを含まないブランチ名にしかマッチしないため、 `fix/xxx` のような作業ブランチに push しても workflow が起動しなかった。 `"**"` はセグメント区切りを跨いでマッチする。 `pull_request` を追加するのは、トリガーが push だけだと fork からの PR で CI が一切走らないため。同一 repo のブランチに PR を立てた場合は push と pull_request の双方が発火し、同じコミットに対して run が 2 本になる。
「Node.js : 8以上」は CI matrix(22.x / 24.x / 26.x)と乖離していた。 加えて package.json の overrides は npm 8.3 以降でのみ解釈されるため、 それより古い npm では脆弱性の残る推移的依存が解決される。この前提が 書かれていないと、README のとおりに setup した参加者が気付かないまま 脆弱な依存木を使うことになる。 CI で検証している範囲と、未検証の下限(mocha 11 が要求する 18.18.0)を 書き分けている。
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.
No description provided.