Skip to content

実験 rails7.0#9299

Closed
machida wants to merge 14 commits intomainfrom
rails_update
Closed

実験 rails7.0#9299
machida wants to merge 14 commits intomainfrom
rails_update

Conversation

@machida
Copy link
Copy Markdown
Member

@machida machida commented Nov 6, 2025

Summary by CodeRabbit

  • New Features

    • ペアワーク/スケジュール管理機能を追加しました(ペアセッション作成・管理、スケジュール提案)。
  • Chores

    • Rails 7 へ移行し依存関係とアプリ設定を更新しました。
    • データベーススキーマとマイグレーションを更新しました。
  • UI

    • ランディングページのトップカバーをレスポンシブに改良しました。
    • アセット解決の調整を行いました。
  • Tests

    • システム/テストのストレージ設定とクリーンアップ処理を新仕様向けに更新しました。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 6, 2025

Walkthrough

Rails を 6.1 から 7.0 にアップグレードし、ActiveStorage のホスト設定を url_options 方式へ移行。Gem 依存・初期化設定・テストの ActiveStorage 周り・Webpacker/webpack 実行スクリプト・Sass アセット参照・スキーマ(pair_worksschedules の追加)および checksum を NULL 許容にするマイグレーションを追加しました。

Changes

コホート / ファイル(s) 変更内容
Gemfile / Rails バージョン
Gemfile
rails~> 6.1.7.10~> 7.0.0 に更新。sprockets-rails を追加。rails-i18n~> 7.0.0 に更新。development の spring 系をコメントアウト(ロードされない形に変更)。net-smtp の inline TODO を削除(gem 宣言は require: false のまま)。
フレームワーク初期化
config/application.rb, config/initializers/new_framework_defaults_7_0.rb
config.load_defaults6.17.0 に更新。Rails 7.0 用の new_framework_defaults_7_0.rb イニシャライザを追加(大半コメントアウト、デフォルトは有効化されていない)。
ActiveStorage 設定の移行
app/controllers/application_controller.rb, test/application_system_test_case.rb, test/test_helper.rb
ActiveStorage::Current.host = ...ActiveStorage::Current.url_options = { host:, port:, protocol: } へ置換。テストの setup/teardown も同様に更新。テストの ActiveStorage::Blob クリーンアップに例外無視の防御処理を追加。parallelize 周りで storage root の取得/設定を instance_variable_get を使う実装に変更。
Webpacker / bin スクリプト
config/webpacker.yml, bin/webpack, bin/webpack-dev-server
config/webpacker.yml の test セクションからコメント化された public_output_path: packs-test 行を削除(テストは共通出力パスを継承する形に戻る)。bin/webpackbin/webpack-dev-server に `ENV["NODE_OPTIONS"]
Sass / アセット参照 & JS パック
app/javascript/stylesheets/lp/blocks/lp/_lp-top-cover.sass, app/javascript/packs/lp.js
Sass の background-image を image-url('background/people.png')url('~images/background/people.png') に変更(Webpack モジュール解決向け)。レスポンシブ用ブレークポイントとスタイル調整を追加。JS パック内の画像 import パスを相対パスで修正(../../assets/images/...../images/...)。
マイグレーションとスキーマ
db/migrate/20251106114043_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb, db/schema.rb
新規マイグレーションを追加し active_storage_blobs.checksum を NULL 許容に変更。schema.rbActiveRecord::Schema[7.0].define(...) 形式へ更新し、pair_worksschedules テーブルを追加、timestamp カラムの precision を nil に統一。
テスト補助
test/application_system_test_case.rb, test/test_helper.rb
ActiveStorage の URL オプション移行に伴う置換、テスト後の Blob purge を例外無視で安全化、parallelize のストレージルート管理を動的取得に変更。

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Browser
  participant AppController as ApplicationController
  participant ActiveStorage as ActiveStorage::Current

  Browser->>AppController: HTTP リクエスト
  AppController->>ActiveStorage: set_host_for_disk_storage(request)
  note right of ActiveStorage `#D6EAF8`: Rails 7 互換の\nurl_options を設定
  AppController-->>ActiveStorage: ActiveStorage::Current.url_options = {host, port, protocol}
  ActiveStorage-->>AppController: 設定反映
  AppController-->>Browser: レスポンス
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

追加で注意すべき点:

  • ActiveStorage の url_options に設定する host/port/protocol がリバースプロキシや本番環境で期待通りになるか確認すること。
  • test/test_helper.rb の parallelize 周りで storage root の動的操作が並列実行時に安全か、およびクリーンアップ漏れがないか検証すること。
  • db/schema.rb の timestamp precision 変更と新規テーブル追加が既存マイグレーション・モデルと整合しているか確認すること。
  • Sass の tilde パス(~images/...)が現在の Webpack/webpacker 設定で正しく解決されるか確認すること。

Possibly related PRs

Suggested reviewers

  • komagata

Poem

🐰 七へ跳ねる小さな足取り、
ホストは箱からハッシュへ変わるよ。
テーブル増えてタイムスタンプ整い、
ビルドはそっと鍵を緩める。
にんじんもって祝おう、ぴょん! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning PRの説明が完全に記入されていません。テンプレートで要求されている「Issue番号」「概要」「変更確認方法」「Screenshot」セクションが全て不足しています。 リポジトリのテンプレートに従い、Issue番号、変更内容の概要、変更確認方法、変更前後のスクリーンショットを記入してください。
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive プルリクエストのタイトル「実験 rails7.0」は、Rails 6.1 から Rails 7.0 へのアップグレードという実質的な変更内容を反映していますが、「実験」という曖昧で説明的でない用語が含まれており、具体的な変更を十分に伝えていません。 タイトルをより具体的で明確なものに変更してください。例えば「Rails 7.0 へのアップグレード」や「Rails 7.0 移行準備」など、変更の主な目的を直接的に表すタイトルが推奨されます。
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rails_update

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@machida machida removed the request for review from okuramasafumi November 6, 2025 16:27
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.claude/rails_7_upgrade_tasks.md (1)

151-153: (任意)Markdownのリンク記法の使用を検討

URLが直接記載されていますが、Markdownのリンク記法を使用するとより適切です。ただし、これは軽微な問題であり、修正は任意です。

例:

- [Rails 7.0 リリースノート](https://guides.rubyonrails.org/7_0_release_notes.html)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c42e0d and f9d9744.

⛔ Files ignored due to path filters (1)
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • .claude/rails_7_upgrade_tasks.md (1 hunks)
  • .claude/settings.local.json (1 hunks)
  • .claude/work_rules.md (1 hunks)
  • Gemfile (4 hunks)
  • app/controllers/application_controller.rb (1 hunks)
  • config/application.rb (1 hunks)
  • config/initializers/new_framework_defaults_7_0.rb (1 hunks)
  • config/webpacker.yml (1 hunks)
  • db/migrate/20251106114043_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb (1 hunks)
  • db/schema.rb (50 hunks)
  • test/application_system_test_case.rb (1 hunks)
  • test/test_helper.rb (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • test/test_helper.rb
  • config/application.rb
  • db/migrate/20251106114043_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb
  • test/application_system_test_case.rb
  • app/controllers/application_controller.rb
  • db/schema.rb
  • config/initializers/new_framework_defaults_7_0.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/test_helper.rb
  • test/application_system_test_case.rb
🧠 Learnings (20)
📓 Common learnings
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:19-23
Timestamp: 2025-09-12T21:17:26.029Z
Learning: Rails アップグレードPRにおいて、config_for(:secrets) を使った webhook URL 設定の shared セクション未参照問題は、設定システム全体の変更として別PRで対応すべきである。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:52-56
Timestamp: 2025-09-12T21:17:45.295Z
Learning: Rails upgrade PRにおいて、configuration systemの改善提案(shared configuration fallback等)も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: db/migrate/20250831234516_remove_unique_index_from_buzzes_title.rb:1-5
Timestamp: 2025-09-04T01:50:47.773Z
Learning: fjordllc/bootcampプロジェクトでは、マイグレーションにおいてdisable_ddl_transaction!やalgorithm: :concurrentlyは使用せず、標準的なRailsのchangeメソッド内でremove_indexを実行する慣例がある。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 8977
File: app/controllers/reports_controller.rb:63-63
Timestamp: 2025-07-23T20:31:13.856Z
Learning: fjordllc/bootcampプロジェクトの`app/controllers/reports_controller.rb`において、`create`と`update`アクションは両方とも`report.save_uniquely`を使用し、同じ`:report_save`イベントと`'report.save'`イベントを発行する。これは両方とも本質的に「レポートの保存」操作であり、作成と更新を区別する必要がないためである。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: config/initializers/sorcery.rb:0-0
Timestamp: 2025-09-11T16:02:24.782Z
Learning: Rails アップグレードPRにおいて、JWT設定の改善では複数のソース(secrets, credentials, ENV)を優先順位付きで検索し、本番環境では未設定時に起動を停止させる実装が推奨される。開発・テスト環境でのみsecret_key_baseフォールバックを許可する構成が安全である。
Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: db/migrate/20250830033535_add_default_to_pair_works_wip.rb:1-5
Timestamp: 2025-08-31T03:17:44.812Z
Learning: 新機能のマイグレーションで、まだ本番環境にリリースされていない場合は、既存レコードのバックフィル処理は不要。開発環境でrails db:resetが可能な状況では特に、デフォルト値の変更のみで十分。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: db/migrate/20250828192202_add_missing_columns_to_good_jobs.rb:4-10
Timestamp: 2025-09-11T14:18:20.194Z
Learning: GoodJobやその他の外部gemが生成するマイグレーションファイルは、gem内部のロジックと密接に連携しているため、null制約やデフォルト値の追加などの変更を行うべきではない。gemのアップグレードパスに従い、生成されたマイグレーションをそのまま使用することが適切。
📚 Learning: 2025-07-30T07:26:36.599Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 8992
File: app/models/correct_answer_notifier.rb:23-23
Timestamp: 2025-07-30T07:26:36.599Z
Learning: Railsの標準的なヘルパーメソッド(例:`question_url`、`user_path`など)が通常の方法で使用されている場合、それらの動作テストは不要である。これらのメソッドはRailsフレームワーク自体でテストされており、アプリケーション固有のロジックではないため。

Applied to files:

  • test/test_helper.rb
📚 Learning: 2025-08-27T03:06:37.725Z
Learnt from: sekito1107
Repo: fjordllc/bootcamp PR: 9081
File: app/models/transcoder/client.rb:103-107
Timestamp: 2025-08-27T03:06:37.725Z
Learning: In Ruby on Rails ActiveStorage code, when using safe navigation operators (&.) for validation, maintain consistency by using the validated variable in subsequent operations rather than re-dereferencing the same chain directly.

Applied to files:

  • test/test_helper.rb
📚 Learning: 2025-08-24T16:19:17.661Z
Learnt from: sekito1107
Repo: fjordllc/bootcamp PR: 9081
File: app/models/transcoder/client.rb:98-102
Timestamp: 2025-08-24T16:19:17.661Z
Learning: In Ruby on Rails ActiveStorage code, when accessing the same attachment property multiple times within a method, it's better to use consistent syntax (e.g., always use `.blob.key` rather than mixing `.key` and `.blob.key`) for better readability and maintainability.

Applied to files:

  • test/test_helper.rb
📚 Learning: 2025-08-26T07:31:10.235Z
Learnt from: sekito1107
Repo: fjordllc/bootcamp PR: 9081
File: test/models/transcoder/movie_test.rb:0-0
Timestamp: 2025-08-26T07:31:10.235Z
Learning: Transcoder::Movie クラス(app/models/transcoder/movie.rb)では、Google::Cloud::Storage::FileVerificationError(Storage固有の例外)とGoogle::Cloud::Storage.new(メインクラス)の両方を使用しているため、テストファイルでは完全な google/cloud/storage gem の require が必要。google/cloud/errors gem だけでは不十分。

Applied to files:

  • test/test_helper.rb
📚 Learning: 2025-09-11T16:02:24.782Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: config/initializers/sorcery.rb:0-0
Timestamp: 2025-09-11T16:02:24.782Z
Learning: Rails アップグレードPRにおいて、JWT設定の改善では複数のソース(secrets, credentials, ENV)を優先順位付きで検索し、本番環境では未設定時に起動を停止させる実装が推奨される。開発・テスト環境でのみsecret_key_baseフォールバックを許可する構成が安全である。

Applied to files:

  • test/test_helper.rb
  • .claude/rails_7_upgrade_tasks.md
  • Gemfile
  • config/initializers/new_framework_defaults_7_0.rb
📚 Learning: 2025-09-04T01:50:47.773Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: db/migrate/20250831234516_remove_unique_index_from_buzzes_title.rb:1-5
Timestamp: 2025-09-04T01:50:47.773Z
Learning: fjordllc/bootcampプロジェクトでは、マイグレーションにおいてdisable_ddl_transaction!やalgorithm: :concurrentlyは使用せず、標準的なRailsのchangeメソッド内でremove_indexを実行する慣例がある。

Applied to files:

  • db/migrate/20251106114043_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb
  • db/schema.rb
📚 Learning: 2025-09-12T21:16:47.639Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • .claude/work_rules.md
  • .claude/rails_7_upgrade_tasks.md
📚 Learning: 2025-09-11T14:47:53.256Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。

Applied to files:

  • .claude/rails_7_upgrade_tasks.md
📚 Learning: 2025-09-12T21:17:45.295Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:52-56
Timestamp: 2025-09-12T21:17:45.295Z
Learning: Rails upgrade PRにおいて、configuration systemの改善提案(shared configuration fallback等)も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Applied to files:

  • .claude/rails_7_upgrade_tasks.md
  • config/initializers/new_framework_defaults_7_0.rb
📚 Learning: 2025-09-12T21:17:26.029Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:19-23
Timestamp: 2025-09-12T21:17:26.029Z
Learning: Rails アップグレードPRにおいて、config_for(:secrets) を使った webhook URL 設定の shared セクション未参照問題は、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • .claude/rails_7_upgrade_tasks.md
  • Gemfile
  • config/initializers/new_framework_defaults_7_0.rb
📚 Learning: 2025-09-12T21:18:00.834Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • .claude/rails_7_upgrade_tasks.md
📚 Learning: 2025-08-31T03:17:44.812Z
Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: db/migrate/20250830033535_add_default_to_pair_works_wip.rb:1-5
Timestamp: 2025-08-31T03:17:44.812Z
Learning: 新機能のマイグレーションで、まだ本番環境にリリースされていない場合は、既存レコードのバックフィル処理は不要。開発環境でrails db:resetが可能な状況では特に、デフォルト値の変更のみで十分。

Applied to files:

  • .claude/rails_7_upgrade_tasks.md
📚 Learning: 2025-09-08T04:55:46.649Z
Learnt from: sharoa119
Repo: fjordllc/bootcamp PR: 8711
File: db/schema.rb:0-0
Timestamp: 2025-09-08T04:55:46.649Z
Learning: In this PR, the removal of length limits from companies.name and companies.website columns in db/schema.rb was unintentional - it was a case of accidentally lost constraints that needed to be restored to their original limits, not a deliberate design change.

Applied to files:

  • db/schema.rb
📚 Learning: 2025-08-24T16:17:12.056Z
Learnt from: sekito1107
Repo: fjordllc/bootcamp PR: 9081
File: app/models/transcoder/client.rb:98-102
Timestamp: 2025-08-24T16:17:12.056Z
Learning: ActiveStorage::Attached::One delegates the `key` method to its associated blob, so `attachment.key` works the same as `attachment.blob.key` in Rails applications.

Applied to files:

  • db/schema.rb
📚 Learning: 2025-09-04T01:27:23.422Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: db/fixtures/buzzes.yml:0-0
Timestamp: 2025-09-04T01:27:23.422Z
Learning: The buzz_controller.rb was indeed deleted, but there are still two remaining items from the old buzz single page implementation that need cleanup: the data migration file db/data/20230726024528_create_buzz.rb and the old buzz route in config/routes.rb line 136. These should be updated/removed to complete the buzz page redesign migration.

Applied to files:

  • db/schema.rb
📚 Learning: 2025-09-04T01:27:23.422Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: db/fixtures/buzzes.yml:0-0
Timestamp: 2025-09-04T01:27:23.422Z
Learning: The buzz_controller.rb and related data migration files were deleted as part of the Buzz page redesign, not just modified. The old single buzz page was completely replaced with a new buzzes (plural) listing page with year-based navigation and metadata structure.

Applied to files:

  • db/schema.rb
📚 Learning: 2025-09-11T14:18:20.194Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: db/migrate/20250828192202_add_missing_columns_to_good_jobs.rb:4-10
Timestamp: 2025-09-11T14:18:20.194Z
Learning: GoodJobやその他の外部gemが生成するマイグレーションファイルは、gem内部のロジックと密接に連携しているため、null制約やデフォルト値の追加などの変更を行うべきではない。gemのアップグレードパスに従い、生成されたマイグレーションをそのまま使用することが適切。

Applied to files:

  • db/schema.rb
📚 Learning: 2025-07-15T12:33:04.885Z
Learnt from: reckyy
Repo: fjordllc/bootcamp PR: 8356
File: db/fixtures/users.yml:823-826
Timestamp: 2025-07-15T12:33:04.885Z
Learning: fjordllc/bootcampプロジェクトでは、`trainee: true`は「研修に所属していたユーザー」全体を示すフラグであり、研修中のユーザーと研修を終了したユーザーの両方を含む。そのため、`trainee: true`と`training_completed_at`の併存は意図された仕様であり、排他的な関係ではない。

Applied to files:

  • db/schema.rb
📚 Learning: 2025-08-22T01:55:06.329Z
Learnt from: sekito1107
Repo: fjordllc/bootcamp PR: 9081
File: app/models/transcoder/client.rb:8-13
Timestamp: 2025-08-22T01:55:06.329Z
Learning: In app/models/transcoder/client.rb, when adding nil guards for configuration access, it's better to place the validation in the default_storage_config method rather than in initialize, to centralize configuration validation and maintain readability.

Applied to files:

  • config/initializers/new_framework_defaults_7_0.rb
🧬 Code graph analysis (1)
test/application_system_test_case.rb (1)
test/system/notification/assigned_as_checker_test.rb (1)
  • deliveries (15-17)
🪛 markdownlint-cli2 (0.18.1)
.claude/rails_7_upgrade_tasks.md

151-151: Bare URL used

(MD034, no-bare-urls)


152-152: Bare URL used

(MD034, no-bare-urls)


153-153: Bare URL used

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (10)
config/webpacker.yml (1)

84-85: テスト環境のアセット出力分離は適切です

開発環境とテスト環境のwebpackerビルド出力を分離することで、並列実行時の競合を回避できます。Rails 7アップグレードに伴うテスト環境の改善として妥当な変更です。

Gemfile (4)

13-13: Rails 7.0へのアップグレードを確認

Rails 7.0.0へのアップグレードは適切です。本PRの主要な変更として妥当です。


14-14: sprockets-railsの追加は適切です

Rails 7ではsprockets-railsがデフォルトgemから外れたため、明示的な追加が必要です。適切な対応です。


66-66: rails-i18nのバージョンアップは適切です

Rails 7に対応したrails-i18n 7.0.0への更新は妥当です。


96-97: Springの削除は適切です

Rails 7ではSpringが非推奨となったため、削除は正しい対応です。理由がコメントで明記されており、将来の参考として有用です。

.claude/rails_7_upgrade_tasks.md (1)

1-164: 残りの重要タスクの確認をお願いします

タスクリストを確認したところ、以下の重要な項目が未完了となっています:

  • セクション6: Rails 7.0の新しい設定オプションの有効化(cache_format_version、cookies_serializerなど)
  • セクション7: 一部のdeprecation警告への対応(update_attributes、redirect_toなど)
  • セクション8-17: ルーティング、テスト、セキュリティ、パフォーマンス最適化など

このPRでどこまで対応する予定か、残りのタスクは別PRで対応するのか、方針を確認させてください。特にセクション6の設定とセクション7のdeprecation対応は、Rails 7へのアップグレードとして重要な項目です。

Based on learnings: Rails upgrade PRではスコープの明確化が重要です。

config/application.rb (1)

12-12: Rails 7.0のデフォルト設定への更新は適切です

config.load_defaults 7.0への更新により、Rails 7.0のデフォルト設定が有効になります。これはRails 7アップグレードの中核的な変更であり、適切な対応です。

app/controllers/application_controller.rb (1)

44-49: ActiveStorage設定のRails 7対応は適切です

ActiveStorage::Current.hostからurl_optionsへの移行は、Rails 7の推奨方法に従った正しい変更です。protocol.delete_suffix(':')でコロンを削除する処理も適切です(request.protocolは"http:"の形式を返すため)。

test/application_system_test_case.rb (2)

44-50: テスト環境のActiveStorage設定更新は適切です

setup/teardownでのActiveStorage::Current.url_optionsの設定とクリーンアップは、Rails 7に対応した適切な変更です。テスト間の状態隔離も保たれています。


54-58: 防御的なエラーハンドリングは適切です

ActiveStorageのクリーンアップ処理にエラーハンドリングを追加することで、テスト環境でのクリーンアップ失敗がテスト結果に影響しないようにしています。テストの安定性向上に貢献する良い変更です。

@machida machida changed the title 実験 Rails update 実験 Nov 7, 2025
- Gemfile: Rails 6.1.7.10 → 7.0.10に更新
- rails-i18nを7.0.0に更新
- net-smtp のTODOコメントを削除
- bundle updateでRails 7.0.10をインストール
- config/application.rb: load_defaultsを7.0に更新
- config/environments/development.rb: config.assetsをコメントアウト
- config/environments/production.rb: config.assetsをコメントアウト
- config/initializers/assets.rb: Sprockets設定を全てコメントアウト

Rails 7ではSprocketsがデフォルトでは含まれないため、
sprockets-rails gemを追加しない限りconfig.assetsは使用できない。
テスト環境でWebpackerアセットが正しく読み込まれるよう、
config/webpacker.ymlのpublic_output_pathをpacks-testに設定。

これによりシステムテストでのアセット読み込みエラーが解消された。
Rails 7ではActiveStorageサービスのroot=セッターが存在しないため、
インスタンス変数を直接操作するように変更。

- parallelize_setupで元のrootを保存してからインスタンス変数を設定
- Minitest.after_runでもインスタンス変数から値を取得
- これによりparallel testingで各ワーカーが独自のストレージパスを使用可能
Sprocketsの`image-url()`ヘルパーをWebpackerの`~`パスに変更。
Rails 7 + Webpacker環境では、Sassファイル内でSprocketsヘルパーが
使えないため、Webpackerの機能を使って画像を参照する。

- image-url('background/people.png') → url('~background/people.png')
- これによりCIでの"No route matches [GET] /packs/media/..."エラーを解消
Node 20のOpenSSL 3.0でWebpackerをコンパイルする際のエラーを解決。

- bin/webpackとbin/webpack-dev-serverにNODE_OPTIONS環境変数を設定
- --openssl-legacy-providerを使用してレガシー暗号アルゴリズムをサポート
- これによりCI環境でのWebpackerコンパイルエラーを解消
- "/packs/js/..." のルーティングエラーも解決

参考: webpack/webpack#14532
test環境でpublic_output_path: packs-testを設定していたため、
ファイルはpublic/packs-test/に出力されるがアプリケーションは
/packs/から読み込もうとしてルーティングエラーが発生していた。

デフォルトのpacksディレクトリを使用するように修正。
app/assets/imagesからapp/javascript/imagesに画像を移動し、
Webpackerで直接管理するように変更。これによりCI環境でも
確実に画像がコンパイルされるようになる。

変更内容:
- 画像をapp/javascript/images/background/に配置
- lp.jsのimportパスを更新
- Sassのurl()を~images/background/people.pngに更新
@machida machida changed the title 実験 実験 rails7.0 Nov 10, 2025
@machida machida closed this Dec 17, 2025
@machida machida deleted the rails_update branch December 17, 2025 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant