ci: Crystal を固定し ameba を Crystal 1.21 対応コミットに追従させる(#108) - #109
Merged
Conversation
crystal: latest が 1.21.0 に上がったことで、shards install の ameba postinstall がコンパイルできず CI が常に落ちる状態になっていた。 (undefined method 'next_string_array_token' for Crystal::Lexer) - ci.yml の Crystal を 1.21.0 に固定し、Crystal 側の更新で不意に壊れないようにする - ameba を Crystal 1.21 対応が入った master のコミットに固定する 安定版(1.7 系)がリリースされたら version 指定に戻す Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MoGxJDiZa8c2E3PVAnxbK8
This was referenced Aug 5, 2026
追従先の ameba(1.7 系)は shard.yml から postinstall が外れており、 shards install だけでは bin/ameba が作られず ./bin/ameba が 127 で落ちる。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MoGxJDiZa8c2E3PVAnxbK8
bin/ が存在せずリンクに失敗していた。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MoGxJDiZa8c2E3PVAnxbK8
追従先の ameba は Style/RedundantNilInControlExpression の追加と Style/RedundantBegin / Style/HeredocIndent の検出範囲拡大により、 既存コード 8 箇所を指摘する。いずれも Correctable な機械的修正。 - 戻り値が nilable なメソッドの `return nil` を `return` に - ブロック直下の begin/rescue をブロックの rescue に - ヒアドキュメント本文を 2 スペースインデントに(文字列の内容は不変) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MoGxJDiZa8c2E3PVAnxbK8
limit7412
marked this pull request as ready for review
August 9, 2026 15:16
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c580bf82fc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
serverless.yml のビルドは crystallang/crystal:latest-alpine を使っており、 CI だけ 1.21.0 に固定しても本番成果物は latest でコンパイルされていた。 Crystal が更新されると検証済みと違うコンパイラで成果物が作られ、互換性が 壊れていれば deploy も突然落ちる。ci.yml と同じ 1.21.0 に固定する。 PR #109 のレビュー指摘対応。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MoGxJDiZa8c2E3PVAnxbK8
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.
close #108
課題
crystal: latestが 1.21.0 に上がったことで、shards installの ameba postinstall がコンパイルできず CI が常に落ちる状態だった。差分の内容によらず、いま出す PR はすべて赤になる。Crystal 1.21 で
Crystal::Lexer#next_string_array_tokenが削除されたが、~> 1.6で解決される最新の安定版 ameba 1.6.4 はこのメソッドに依存している。変更内容
方針は「Crystal 固定 + ameba 追従」の併用。
.github/workflows/ci.ymlcrystal: latest→crystal: 1.21.0。Crystal 側の更新でいきなり CI が壊れるのを防ぐ(今回は master への push が 3 週間無かったため気付くのが遅れた)shard.ymlから postinstall が外れており、shards installだけではbin/amebaが作られないserverless.yml: ビルドイメージをcrystallang/crystal:latest-alpine→1.21.0-alpineに固定(レビュー指摘対応 / 下記)shard.yml: ameba をversion: ~> 1.6→ 修正を含む master のコミットに固定lexer.responds_to?(:next_string_array_token)での分岐)は master に入っているが、タグはv1.6.4の次がv1.7.0-devのみで安定版のリリースがまだ無いshard.lock: 上記に合わせて更新デプロイ用ビルドイメージの固定
CI だけを固定しても、
serverless.ymlのbefore:package:createDeploymentArtifactsはcrystallang/crystal:latest-alpineでアプリをコンパイルするため、本番成果物は検証済みのコンパイラとは別のもので作られていた。Crystal が更新されれば互換性が壊れた瞬間に deploy も落ちる。本 PR の趣旨がデプロイ側で達成できていなかったので、同じ1.21.0に揃えた。次に上げるときに両方揃えられるよう、
ci.ymlとserverless.ymlに相互参照のコメントを入れている。ameba 1.7 系で新たに検出された指摘
ameba 側で
Style/RedundantNilInControlExpressionが追加され、Style/RedundantBegin/Style/HeredocIndentの検出範囲も広がったため、master 由来の既存コードが 8 箇所引っかかった。いずれも ameba が[Correctable]と判定する機械的な修正で、挙動は変わらない。ameba を上げた本 PR の責任範囲として同梱した。return nil→return(src/discord/models.cr×4、src/github/models.cr、src/github/usecase.cr)begin/rescue→ ブロックのrescue(src/main.cr)spec/github/models_spec.cr)<<-なので生成される文字列の内容は変わらない今後
ameba 1.7 系がリリースされたら
shard.ymlをversion:指定に戻す。その旨はshard.ymlのコメントにも残した。Crystal を上げるときは ameba 側の対応状況とserverless.ymlのビルドイメージのタグも合わせて確認する。影響
このブロッカーで CI が赤のままだった PR:
いずれも本ブランチを取り込んで CI green を確認済み。本 PR が master にマージされれば、各 PR の差分からはこのコミット群が消える。
検証
CI green。
shard.lockの解決はInstalling ameba (1.7.0-dev at cdd58b3)で確認、固定したビルドイメージは deploy ジョブが実際にそれでコンパイルして成功していることで確認している。実行環境から crystal-lang.org への到達がネットワークポリシーで遮断されており Crystal / shards をローカルにインストールできないため、検証は CI に依存している。
shard.lockのversion:は shards のGitResolverがコミット解決時に書き出す"#{spec.version.value}+git.commit.#{commit}"の形式に合わせた。