Update @bazel/bazelisk and @types/node - #57
Conversation
Both CI jobs currently fail two seconds after starting, before any build
step runs:
##[error]This request has been automatically failed because it uses a
deprecated version of `actions/cache: v2`.
GitHub has closed down actions/cache v1 and v2 and now auto-fails runs
that reference them at action-download time, so the workflow cannot get
as far as `make test` or the bazel e2e target.
Bump actions/cache to v4 to unblock that, and bump the remaining actions
still on the Node 12 runtime at the same time:
- actions/checkout v2 -> v4
- actions/setup-node v2.1.4 -> v4
- haskell/actions/setup v1 -> haskell-actions/setup v2 (repository moved)
Tool versions are left as they are (GHC 8.8.3, stack 2.5.1, Node 12.x) so
this change is limited to action versions. haskell-actions/setup v2 still
exposes the stack-path output the cache step depends on.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
With the deprecated actions bumped, the Haskell job now reaches `make test` and fails there instead: `make test` depends on the `schema` target, which fetches the EDItEUR archives, and editeur.org now answers bazel's request with `202 Accepted` instead of the zip. The test suite does not need those archives. Everything under test/ reads fixtures/test_*.xsd; the only reader of ./schema is schemaRoot in src/Lib.hs, which is the code-generation path. The dependency was an over-specification that tied the whole feedback loop for the parser to the availability of an external service. Drop it from `test` and keep it on `build`, where generating code really does need the schema. This does not fix the 202 itself: generation and tracking new schema releases still need the download. Also introduce docs/adr/ to record decisions like this one, with a template, an index, and the two decisions made here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
- @bazel/bazelisk 1.7.3 -> 1.28.1 - @types/node 14.14.25 -> 22.20.2 fast-xml-parser is deliberately left at 3.17.6 here. It has two open advisories (GHSA-x3cc-x39p-42qx, GHSA-gh4j-gqv2-49f6) that are only fixed in 5.6.1+, and that major bump changes the parser API the TypeScript reader template uses, so it needs its own change with the template migration. The lockfile is regenerated with --lockfile-version 1 rather than being allowed to move to v3. rules_nodejs 3.1.0 runs npm_install with its own bundled npm, and the CI job still runs Node 12.x; neither reads a v3 lockfile's `packages` key, so they would silently re-resolve instead of honouring the lock. The lockfile version can move once the Node toolchain and rules_nodejs are updated. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
The previous commit dropped the `schema` prerequisite from `make test` on the claim that nothing under test/ reads schema/. That claim was wrong, and review caught it: fixtures/test_mixed_html.xsd included ../schema/v2/ONIX_XHTML_Subset.xsd directly. Xsd.getSchema follows includes recursively and resolves that relative path with readFile, which throws when the file is absent, and schema/ is gitignored — so on a clean checkout the suite would have failed instead of running. Commit 9352123 confirms the dependency was deliberate: it added `test: schema` in the same change that deleted the vendored 2_1_rev03_schema/ tree and repointed this fixture at ../schema/v2/. Rather than restore the prerequisite, move what the fixture needs into the repository. test_mixed_html_xhtml_subset.xsd declares the 40 element names the fixture refers to, each as a mixed complex type. That is the property the assertions actually rest on: TestModel expects Model.collectElements to come back empty, and that filter keeps only elements with complexMixed = False, so the test means "XHTML elements do not leak into models". Deleting the include instead would have made the assertion vacuous. The stand-in is written here rather than copied from the EDItEUR distribution, so it raises no redistribution question. ADR-0002 is rewritten around what is actually true, including why the dependency was real and why a stand-in is enough. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
レビュー結果: Approve (軽微な指摘あり)差分そのもの ( 指摘一覧1. 【推奨】commit message / PR 本文の「Bazel 側も silently re-resolve する」は誤り。実際は hard fail する
2. 【推奨】
|
| 主張 | 結果 | 方法 |
|---|---|---|
| lockfileVersion が 1 のまま | ✅ 正しい | package-lock.json を直読み → "lockfileVersion": 1 |
lockfile のバージョンが package.json と一致 |
✅ 一致 | bazelisk 1.28.1 / @types/node 22.20.2 / fast-xml-parser 3.17.6、undici-types 6.21.0 は @types/node 22 の唯一の推移依存 (registry で確認) |
| integrity が正しい | ✅ 4/4 一致 | 各パッケージの registry.npmjs.org/<name>/<version> の dist.integrity と突合 |
| lockfile が再現可能 | ✅ バイト一致 | npm install --package-lock-only --lockfile-version 1 → diff -u で差分 0 |
| rules_nodejs 3.1.0 が自前の npm を使う | ✅ 正しい | npm_install.bzl の get_npm_label() → @nodejs_<platform>//:bin/npm。node_repositories.bzl:171-174 の node_version default は 12.13.0 (= npm 6 系) |
| npm 6 が v3 lockfile を尊重しない | npm@6.14.18 を実際に入れて実験。npm ci → exit 1 で失敗、npm install → exit 0 でロックを無視し v1 に書き戻し。v3 lockfile に dependencies キーが無いことも確認 (キーは name/version/lockfileVersion/requires/packages) |
|
| bazelisk 1.28.1 が Bazel 3.7.0 を扱える | ✅ 正しい | bazelisk v1.28.1 の repositories/gcs.go:198 が https://releases.bazel.build/{version}/release/{file} を組み立てる。最低バージョンのゲートは core/core.go に無し。決定的な証拠として、この PR の e2e ジョブのログに Downloading https://releases.bazel.build/3.7.0/release/bazel-3.7.0-linux-x86_64... → //e2e/go:snapshot_test PASSED が出ています |
npx bazel が解決するか |
✅ する (node_modules がある場合) | registry の 1.7.3 / 1.28.1 双方で bin: {"bazel": "bazelisk.js", "bazelisk": "bazelisk.js"}、node_modules/.bin/bazel の存在も確認 |
| CI で tsc が走らないこと | ✅ 走らない | .github/workflows/test.yml は make test と npx bazelisk test のみ。typescript は依存に無し |
| @types/node 22 が型チェックを壊さないか | ✅ 壊さない | npx -p typescript@5.9 tsc -p tsconfig.json --noEmit → エラー 0。--listFiles で対象 4 ファイルを確認 |
| fast-xml-parser の advisory | ✅ 2 件 moderate | npm audit --json で GHSA-x3cc-x39p-42qx / GHSA-gh4j-gqv2-49f6、range <=5.6.0、fixAvailable: 5.11.1 (major)。CI ログの「found 2 moderate severity vulnerabilities」とも一致 |
なお bazelisk 1.28.1 は platforms/platforms.go:131-152 に「Bazel 4.1.0 未満では darwin/arm64 → x86_64 にフォールバックする」処理を持っています。1.7.3 にはこれが無いので、Apple Silicon で Bazel 3.7.0 を使う開発者にとってはむしろ改善です。
検証できなかったこと
releases.bazel.buildが egress ポリシーでブロックされているため、この環境で bazelisk を実行して Bazel 3.7.0 を取得することはできませんでした。→ 代わりに bazelisk のソース (URL 組み立てとバージョンゲートの有無) を読み、この PR の CI ログで実際のダウンロードと成功を確認しています。- 同じ理由で
rules_nodejsのnpm_installを Bazel 経由で実際に走らせることはできていません。→ 代わりにnpm@6.14.18を直接入れてnpm ci/npm installの挙動を再現しました。 editeur.orgがブロックされているためmake schemaは未検証です (指摘 6 のBZL_BIN空文字の実害も、コード読解による推論です)。haskell.orgがブロックされているためmake test(stack) はローカル実行できていません。- レビュー時点で
Test haskell codesジョブはin_progress(ログ取得は 404) でした。Test e2eは success です。この PR は Haskell コードに触れていないので影響は無いはずですが、マージ前に緑を確認してください。
Generated by Claude Code
Keeps this stacked branch's CI running the corrected test suite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
Review pointed out that nothing actually enforced keeping the lockfile at version 1: the previous commit produced it by passing --lockfile-version 1 by hand, so the next plain `npm install` on a modern npm would have quietly rewritten it to v3. An .npmrc makes the format a property of the repository instead of of whoever ran the command. Verified: with this file, `npm install` on npm 10.9.7 leaves package-lock.json unchanged at v1; without it the same command rewrites it to v3. node_modules/ was never listed in .gitignore, which makes committing it by accident easy once anyone runs npm install in a checkout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
|
レビューありがとうございます。推奨 2 件を反映しました (d3394d7)。 推奨 1:
|
Both .gitignore additions are kept: node_modules/ from the npm work on main, /third_party/distdir/ from this branch's ADR. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
npm の devDependencies を更新します。ライブラリ更新の一連の作業のうち、npm 側の安全に上げられる分です。
この PR は #56 の上に積んでいます (base =
claude/bump-deprecated-github-actions)。#56 の CI 修正が入っていないと、そもそも CI がテストを実行できないためです。#56 がマージされたら base は自動的にmainになります。変更内容
@bazel/bazelisk@types/nodeあわせて
.npmrc(lockfile-version=1) と.gitignoreへのnode_modules/追加。fast-xml-parserを含めていない理由3.17.6 には未修正の脆弱性が 2 件あります (
GHSA-x3cc-x39p-42qxprototype pollution、GHSA-gh4j-gqv2-49f6comment/CDATA injection)。影響範囲は<=5.6.0で、最初の修正版は 5.7.0 です。メジャーをまたぐとxml.parse()からnew XMLParser().parse()へ API が変わり、template/typescript/v2/reader.mustacheの書き換えを伴うため、テンプレート移行とセットで別 PR にします。lockfile を v1 のまま維持している理由
(レビューを受けて理由を訂正しました。当初「npm がロックを無視して再解決する」と書いていましたが、実際にはより厳しい失敗です。)
npm_installはnpm_commandの既定が"ci"(internal/npm_install/npm_install.bzl) で、WORKSPACEはこれを上書きしていません。npm 6 のnpm ciを v3 lockfile に対して実行すると exit 1 で落ちます (Cannot read properties of undefined)。静かな再解決ではなくハード失敗です。npm installを実行しており、こちらは exit 0 ですがロックを無視して v1 に書き戻します。なお現状
@npmを参照している BUILD ターゲットが無いため、Bazel 側の失敗は今のところ顕在化しません。それでも v1 に据え置くのは、npm_installを使い始めた瞬間に壊れる地雷を埋めないためです。lockfile のバージョンは、Node ツールチェーンと rules_nodejs を更新する PR で一緒に上げます。--lockfile-version 1を手で渡すだけでは、次に素のnpm installを実行した人が v3 に書き換えてしまうので、.npmrcで固定しました。確認
.npmrcあり + 素のnpm install(npm 10.9.7) → lockfileVersion1のまま、package-lock.jsonに差分なし。.npmrcなし → v3 に書き換わるv1.28.1、@types/node22.20.2Downloading .../bazel-3.7.0-linux-x86_64→//e2e/go:snapshot_test PASSED)releases.bazel.buildが egress ポリシーでブロック)🤖 Generated with Claude Code
https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z