danger-swiftを3.23.0に更新してDangerfileの評価失敗を直す - #303
Merged
Merged
Conversation
Swift 6.2のCIでDangerfileの評価が `no such module 'Danger'` で失敗していた。 3.23.0で、danger-swift自体をビルドしたコンパイラに依存せず Danger.swiftmoduleの実体を探してモジュールを解決するよう修正されている。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011NkFuVWMJSeuaWUyHhqvrr
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
経緯
#295 で
dangerジョブが失敗した。ビルドは成功しているのに、Dangerfile の評価だけがモジュール解決で落ちていた。danger-swift 3.23.0 のリリースノートに、まさにこの症状の修正が入っている。
3.22.0 は「
danger-swift自身をビルドしたコンパイラ」からDanger.swiftmoduleの置き場所を推測するため、danger-swift のビルドとDangerfileのコンパイルで Swift のバージョンが食い違うとモジュールを見つけられない。3.23.0 はDanger.swiftmoduleの実体を探すようになったので、この食い違いに影響されない。バージョンが食い違った理由
ci_danger.ymlの Swift ツールチェーンのキャッシュキーが、要求バージョンの文字列(swift-toolchain-Linux-6.2)だけで組まれており、実際に入ったバージョンを含んでいない。失敗した実行と、その後キャッシュが切れて成功した実行で、同じキーから別のバージョンが復元されていた。swift --versionswift-toolchain-Linux-6.2)6.4 (swift-6.4-RELEASE)6.2.1 (swift-6.2.1-RELEASE)DangerTools/.build側のキャッシュキーもdanger-tools-Linux-6.2-<Package.resolvedのhash>で Swift の実バージョンを含まないため、6.2.1 でビルドした.buildを 6.4 のツールチェーンで再利用する組み合わせが成立してしまう。これが 3.22.0 の弱点を踏んだ。そのため現時点では #295 の
dangerは通っているが、キャッシュの状態次第でいつでも再発する。本PRでその再発を止める。実装内容
DangerTools/Package.swiftの danger-swift をexact: "3.22.0"→exact: "3.23.0"に更新し、Package.resolvedを追従させた。差分は danger-swift のピンだけで、他の依存(OctoKit / RequestKit / Logger / Version / danger-swift-coverage)のバージョンは変わっていない。exact指定は維持した。Dangerfile の評価が danger-swift の内部挙動(モジュール解決・SwiftLintの呼び出しパス)に依存していて、マイナー更新でも今回のように壊れ方が変わるため、意図したタイミングでだけ上げたい。キャッシュキーに Swift の実バージョンを含める修正は、ツールチェーン更新時のキャッシュ戦略という別の論点なので本PRには含めていない。3.23.0 にすればバージョンの食い違い自体が無害になるため、まずこちらだけを入れる。
確認内容
手元(macOS / Swift 6.4)で、Dangerfile の評価が成功することと、3.22.0 では同じ手順が失敗することの両方を確認した。GitHubへ書き込まない
danger-swift localを使用。Danger: ✓ passed review, received no feedback.ERROR: Dangerfile eval failed at Dangerfile.swift(CIと同じ失敗を再現)swift build --package-path DangerTools通過dangerジョブが通る(run 36204326452)🤖 Generated with Claude Code
https://claude.ai/code/session_011NkFuVWMJSeuaWUyHhqvrr