-
Notifications
You must be signed in to change notification settings - Fork 75
お問い合わせを対応済にする機能のリファクタリングと軽微なバグ修正・仕様変更 #9423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughCheckに保持されていた「対応済」フラグと完了者/完了日時をInquiryへ移行するため、モデル・マイグレーション・データ移行・ルーティング・管理API/ビューを更新し、チェック依存の処理をInquiry側で完結させる変更を導入した。 Changes
Sequence Diagram(s)sequenceDiagram
participant AdminUI as 管理画面 (Client)
participant API as API::Admin::InquiriesController
participant InquiryModel as Inquiry model
participant DB as Database
AdminUI->>API: PATCH /api/admin/inquiries/:id { inquiry: { action_completed: true/false } }
API->>DB: SELECT inquiries WHERE id = :id FOR UPDATE
API->>InquiryModel: assign/clear action_completed, completed_by_user, completed_at
InquiryModel->>DB: UPDATE inquiries SET ...
alt 保存成功
API-->>AdminUI: 204 No Content
else 状態不整合または保存失敗
API-->>AdminUI: 422 Unprocessable Entity
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
ポエム
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
9fee326 to
b558794
Compare
b558794 to
417de05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
app/views/admin/inquiries/show.html.slim (1)
30-38: 対応済スタンプの表示ロジックは適切です。削除されたユーザーのフォールバック処理(Line 38)は良い対応です。ただし、Line 35の
@inquiry.completed_at.to_dateについて、action_completed?が true でもcompleted_atが nil の場合(データ不整合時)、NoMethodErrorが発生する可能性があります。既存データはマイグレーションで整合性が取れていますが、防御的に
&.to_dateの使用を検討してください。🔎 防御的コーディングの提案
time.stamp__content.is-created-at - = l @inquiry.completed_at.to_date, format: :short + = l @inquiry.completed_at&.to_date, format: :shortapp/views/admin/inquiries/_inquiries_item.html.slim (1)
3-11: 対応済スタンプの表示は適切ですが、DRYの観点で改善の余地があります。
show.html.slimと同じスタンプ表示ロジックが重複しています。将来的にpartialへの抽出を検討してください。また、Line 8の
completed_at.to_dateもshow.html.slimと同様に、防御的に&.to_dateの使用を検討してください。🔎 nil安全性の改善
time.stamp__content.is-created-at - = l inquiry.completed_at.to_date, format: :short + = l inquiry.completed_at&.to_date, format: :short
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
app/controllers/admin/inquiries_controller.rbapp/controllers/api/admin/inquiries_controller.rbapp/controllers/api/inquiries_controller.rbapp/models/check.rbapp/models/check_callbacks.rbapp/models/inquiry.rbapp/views/admin/inquiries/_inquiries_item.html.slimapp/views/admin/inquiries/show.html.slimconfig/routes/api.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rbdb/data_schema.rbdb/migrate/20251221040419_add_columns_to_inquiries.rbdb/migrate/20251222063312_remove_index_from_inquiries.rbdb/schema.rb
💤 Files with no reviewable changes (1)
- app/controllers/api/inquiries_controller.rb
🧰 Additional context used
📓 Path-based instructions (5)
db/**
📄 CodeRabbit inference engine (AGENTS.md)
Database migrations and schema should be stored in
db/directory; app-specific utilities inlib/; static assets inpublic/
Files:
db/migrate/20251222063312_remove_index_from_inquiries.rbdb/migrate/20251221040419_add_columns_to_inquiries.rbdb/schema.rbdb/data_schema.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
**/*.rb
📄 CodeRabbit inference engine (AGENTS.md)
Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (
.rubocop.yml)
Files:
db/migrate/20251222063312_remove_index_from_inquiries.rbapp/models/check.rbdb/migrate/20251221040419_add_columns_to_inquiries.rbapp/controllers/api/admin/inquiries_controller.rbdb/schema.rbapp/controllers/admin/inquiries_controller.rbdb/data_schema.rbapp/models/check_callbacks.rbconfig/routes/api.rbapp/models/inquiry.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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:
db/migrate/20251222063312_remove_index_from_inquiries.rbapp/models/check.rbdb/migrate/20251221040419_add_columns_to_inquiries.rbapp/controllers/api/admin/inquiries_controller.rbdb/schema.rbapp/controllers/admin/inquiries_controller.rbdb/data_schema.rbapp/models/check_callbacks.rbconfig/routes/api.rbapp/models/inquiry.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
app/**/*.{rb,js,ts,jsx,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Rails app code should be organized in
app/directory with subdirectories:models/,controllers/,views/,jobs/,helpers/, and frontend code underjavascript/(Shakapacker)
Files:
app/models/check.rbapp/controllers/api/admin/inquiries_controller.rbapp/controllers/admin/inquiries_controller.rbapp/models/check_callbacks.rbapp/models/inquiry.rb
**/*.slim
📄 CodeRabbit inference engine (AGENTS.md)
Slim templates should be linted according to
config/slim_lint.yml
Files:
app/views/admin/inquiries/show.html.slimapp/views/admin/inquiries/_inquiries_item.html.slim
config/**
📄 CodeRabbit inference engine (AGENTS.md)
Configuration files in
config/should include environment settings, routes, and lints (.rubocop.yml,config/slim_lint.yml)
Files:
config/routes/api.rb
🧠 Learnings (8)
📓 Common learnings
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: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/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T06:04:36.036Z
Learning: ChecksController#createおよび#destroyでは、Checkの作成・削除とActiveSupport::Notifications.instrumentによるイベント発行(プラクティスのステータス更新)を同一トランザクション内で実行し、いずれかが失敗した場合は両方をロールバックする。これによりWebUI表示とDB状態の整合性を保証している。
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: ryufuta
Repo: fjordllc/bootcamp PR: 8992
File: app/models/correct_answer_notifier.rb:23-23
Timestamp: 2025-07-30T07:26:36.599Z
Learning: PRのスコープを維持することが重要であり、バグ修正PRにおいて、修正対象以外の機能(例:ルーティングテスト)の追加提案は適切ではない。そのような改善が必要な場合は別PRで対応すべきである。
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Pull requests should include clear description, linked issues, screenshots for UI changes, migration notes, and rollback plan if relevant
📚 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/20251222063312_remove_index_from_inquiries.rb
📚 Learning: 2025-09-15T07:39:39.350Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9155
File: app/controllers/api/correct_answers_controller.rb:20-22
Timestamp: 2025-09-15T07:39:39.350Z
Learning: API::CorrectAnswersController#update では、ベストアンサー取り下げという単純な状態変更のため、update! を使用して DB エラー時に 500 を返し、成功時はデフォルトレスポンスを使用するのが適切。クライアント側のバリデーションエラーは発生しにくく、明示的なエラーハンドリングは不要。
Applied to files:
app/controllers/api/admin/inquiries_controller.rb
📚 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-11-13T09:20:36.030Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9115
File: db/migrate/20250902024949_add_unique_index_to_correct_answers.rb:1-5
Timestamp: 2025-11-13T09:20:36.030Z
Learning: fjordllc/bootcamp プロジェクトでは、データの整合性を保つためのデータ修正には data-migrate gem を使用し、db/data/ ディレクトリ配下にデータマイグレーションファイルを作成する運用を採用している。スキーマ変更(db/migrate/)とデータ変更(db/data/)を分離することで、より安全で管理しやすい構成を実現している。
Applied to files:
db/data_schema.rb
📚 Learning: 2025-10-22T12:22:33.168Z
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T12:22:33.168Z
Learning: CheckCallbacks内のメール通知・サイト内通知で例外が発生した場合、例外を握りつぶさず上位に伝搬させる。これにより通知失敗を検知し、運用上の混乱を防ぐ。CheckCallbacksはafter_create_commitで実行されるため、例外発生時にはCheckとステータス更新はすでにコミット済みであり、ユーザーにはエラーメッセージが表示されるが、DBには変更が残る状態になる。
Applied to files:
app/models/check_callbacks.rb
📚 Learning: 2025-10-22T06:04:36.036Z
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T06:04:36.036Z
Learning: ChecksController#createおよび#destroyでは、Checkの作成・削除とActiveSupport::Notifications.instrumentによるイベント発行(プラクティスのステータス更新)を同一トランザクション内で実行し、いずれかが失敗した場合は両方をロールバックする。これによりWebUI表示とDB状態の整合性を保証している。
Applied to files:
app/models/check_callbacks.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:
config/routes/api.rb
🧬 Code graph analysis (3)
app/models/check.rb (1)
app/controllers/api/checks_controller.rb (1)
checkable(42-44)
app/models/check_callbacks.rb (1)
app/models/check.rb (1)
receiver(12-14)
app/models/inquiry.rb (1)
app/models/check.rb (1)
belongs_to(3-15)
🔇 Additional comments (10)
db/migrate/20251222063312_remove_index_from_inquiries.rb (1)
1-5: LGTM: インデックス削除のマイグレーション未使用のインデックスを削除する標準的なマイグレーションです。PRの目的(インデックス作成コストの削減)に沿っており、プロジェクトの慣例に従った実装になっています。
config/routes/api.rb (1)
8-8: LGTM: セキュリティ修正のためのルート移動お問い合わせの対応・未対応切替APIを
admin名前空間に移動することで、管理者以外がAPIを叩ける問題を修正しています。PRの目的に沿った適切な変更です。app/controllers/admin/inquiries_controller.rb (1)
8-8: LGTM: N+1クエリ防止のための適切な更新
checks経由からcompleted_by_userへの直接の関連付けに変更されており、新しいスキーマに対応した正しいeager loadingになっています。db/data_schema.rb (1)
1-1: LGTM: データマイグレーションバージョンの更新データマイグレーションの実行を反映した標準的なバージョン更新です。
db/schema.rb (1)
485-487: LGTM: 対応者削除時のバグを修正するスキーマ設計
completed_by_user_idとcompleted_atカラムの追加により、対応済情報を直接保持するようになっています。特に
on_delete: nullifyの設定により、対応者アカウントが削除されてもcompleted_atは保持されるため、「対応者アカウントを削除すると対応が未対応になる」というバグが修正されます。PRの目的に沿った適切な設計です。Also applies to: 1068-1068
db/migrate/20251221040419_add_columns_to_inquiries.rb (1)
1-6: LGTM: 対応済情報を保持する適切なマイグレーション新しいカラム追加のマイグレーションで、以下の点が適切です:
completed_by_user_idの外部キー制約にon_delete: nullifyを指定し、ユーザー削除時も対応済状態を保持completed_atで対応日時を記録し、新しいUI要件に対応- スキーマ変更→データ移行の順序も正しい
app/models/check_callbacks.rb (1)
5-11: ReportとProduct、Workモデルではuserが必須のため、check.receiverがnilになることはありません元のレビューコメントの懸念点は実装を考慮していません。以下の理由により、
nilreceiverのシナリオは実際には発生しません:
- Product:
belongs_to :user, touch: true(必須)- Report:
belongs_to :user, touch: true(必須)- Work:
validates :user, presence: true(必須)- Check#receiver:
checkable.userを返し、checkableは常に有効なユーザーを持つまた、ユーザー削除時に
dependent: :destroyが設定されているため、関連するチェックは削除されます。check.receiver &&条件の削除は、これらのデータ制約に基づいた安全な意図的なリファクタリングです。app/views/admin/inquiries/show.html.slim (1)
57-62: APIパス変更とReactコンポーネントのprops設定は適切です。
isInitialActionCompleted: @inquiry.action_completed? || falseにより確実にboolean値が渡され、APIパスも管理者専用エンドポイントに正しく更新されています。app/controllers/api/admin/inquiries_controller.rb (1)
14-17: 対応取り消し時のロジックは適切です。
action_completedがfalsyの場合に全ての完了情報をクリアする処理は、PR目的の仕様に沿っています。update!の使用も、単純な状態変更では適切なアプローチです(Based on learnings)。app/models/inquiry.rb (1)
3-7: 変更は適切です。
belongs_to :completed_by_userの追加とCheckable削除により、checks テーブル依存からの脱却を実現しています。optional: trueにより未対応の場合も正しく動作します。データベース側でもaction_completedカラム(boolean、デフォルト: false)、completed_by_user_id外部キー(on_delete: nullify)、completed_atdatetime カラムが適切に追加されており、ビュー内での@inquiry.action_completed?の使用も正しく機能します。
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
Show resolved
Hide resolved
CodeRabbitの指摘に対応:#9423 (comment)
CodeRabbitの指摘への対応を含む: #9423 (comment)
417de05 to
404608d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb (1)
5-6: コメントと実装ロジックの関係が分かりにくいです。コメントでは「最初の対応情報を残す」と記載されていますが、
created_at: :desc(新しい順)でソートしているため、処理の流れが直感的ではありません。実装としては正しく動作します(新しいものから処理して古いもので最後に上書きするため、最終的に最も古い対応情報が残ります)が、コードの意図が読み取りにくくなっています。より明確なアプローチとして、以下を検討してみてください:
created_at: :ascでソートし、処理済みのinquiry_idを記録して2回目以降はスキップする- または、コメントに実装の意図(「新しい順に処理し、最後に最も古いもので上書きする」)を補足する
🔎 より直感的な実装例(オプション1)
- # 対応情報が誤って重複登録され得るバグがあった。どちらでも良いが最初の対応情報を残すようにする - checks = Check.where(checkable_type: 'Inquiry').order(created_at: :desc) + # 対応情報が誤って重複登録され得るバグがあった。どちらでも良いが最初の対応情報を残すようにする + checks = Check.where(checkable_type: 'Inquiry').order(created_at: :asc) + processed_inquiry_ids = Set.new + checks.find_each do |check| + next if processed_inquiry_ids.include?(check.checkable_id) + inquiry = Inquiry.find_by(id: check.checkable_id) next unless inquiry inquiry.update!(action_completed: true, completed_by_user_id: check.user_id, completed_at: check.created_at) + processed_inquiry_ids.add(check.checkable_id) endapp/controllers/api/admin/inquiries_controller.rb (1)
4-17: 管理者限定APIと同時操作対策が適切に実装されています。Line 8-9で既に対応済の場合に422を返すことで、PRの目的である「異なるユーザーが同時に未対応ページを表示して対応済ボタンを押すと対応者が重複登録される不具合」が修正されています。また、
API::Admin::BaseControllerを継承することで管理者のみのアクセス制限が実現されています。Line 6の
params.dig使用により、過去のレビューコメントで指摘された安全性の問題も解決されています。💡 オプション: より明示的なブール値ハンドリング
Line 7のブール値チェックをより明示的にすることで、予期しない値の扱いを厳密化できます。ただし、JSON APIでは通常適切なブール値が渡されるため、現在の実装でも実用上は問題ありません。
- action_completed = params.dig(:inquiry, :action_completed) - if action_completed + action_completed = ActiveModel::Type::Boolean.new.cast(params.dig(:inquiry, :action_completed)) + if action_completed == trueapp/views/admin/inquiries/show.html.slim (1)
30-38: 対応済み表示が適切に実装されています。対応日時と対応者名の表示が追加され、Line 38で対応者が削除された場合の表示も適切に処理されています。これによりPRの目的である「対応済スタンプに対応日時と対応者名を表示」が実現されています。
💡 オプション: データ不整合時の防御的コーディング
Line 35で
completed_at.to_dateを呼び出していますが、データ不整合(例: マイグレーション時の問題)によりcompleted_atがnilの場合、NoMethodErrorが発生する可能性があります。コントローラーロジックではcompleted_atが必ず設定されるため実用上は問題ありませんが、より防御的にするには以下のようにできます。- if @inquiry.action_completed? && @inquiry.completed_at .stamp.stamp-approve .stamp__content.is-title | 対応済 time.stamp__content.is-created-at = l @inquiry.completed_at.to_date, format: :short
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
app/controllers/admin/inquiries_controller.rbapp/controllers/api/admin/inquiries_controller.rbapp/controllers/api/inquiries_controller.rbapp/models/check.rbapp/models/check_callbacks.rbapp/models/inquiry.rbapp/views/admin/inquiries/_inquiries_item.html.slimapp/views/admin/inquiries/show.html.slimconfig/routes/api.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rbdb/data_schema.rbdb/migrate/20251221040419_add_columns_to_inquiries.rbdb/migrate/20251222063312_remove_index_from_inquiries.rbdb/schema.rb
💤 Files with no reviewable changes (1)
- app/controllers/api/inquiries_controller.rb
🚧 Files skipped from review as they are similar to previous changes (8)
- db/migrate/20251222063312_remove_index_from_inquiries.rb
- db/data_schema.rb
- app/controllers/admin/inquiries_controller.rb
- app/views/admin/inquiries/_inquiries_item.html.slim
- db/migrate/20251221040419_add_columns_to_inquiries.rb
- config/routes/api.rb
- app/models/check_callbacks.rb
- app/models/check.rb
🧰 Additional context used
📓 Path-based instructions (4)
app/**/*.{rb,js,ts,jsx,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Rails app code should be organized in
app/directory with subdirectories:models/,controllers/,views/,jobs/,helpers/, and frontend code underjavascript/(Shakapacker)
Files:
app/controllers/api/admin/inquiries_controller.rbapp/models/inquiry.rb
**/*.rb
📄 CodeRabbit inference engine (AGENTS.md)
Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (
.rubocop.yml)
Files:
app/controllers/api/admin/inquiries_controller.rbapp/models/inquiry.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rbdb/schema.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:
app/controllers/api/admin/inquiries_controller.rbapp/models/inquiry.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rbdb/schema.rb
db/**
📄 CodeRabbit inference engine (AGENTS.md)
Database migrations and schema should be stored in
db/directory; app-specific utilities inlib/; static assets inpublic/
Files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rbdb/schema.rb
**/*.slim
📄 CodeRabbit inference engine (AGENTS.md)
Slim templates should be linted according to
config/slim_lint.yml
Files:
app/views/admin/inquiries/show.html.slim
🧠 Learnings (17)
📓 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/models/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T06:04:36.036Z
Learning: ChecksController#createおよび#destroyでは、Checkの作成・削除とActiveSupport::Notifications.instrumentによるイベント発行(プラクティスのステータス更新)を同一トランザクション内で実行し、いずれかが失敗した場合は両方をロールバックする。これによりWebUI表示とDB状態の整合性を保証している。
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: 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のスコープ維持が重要。
📚 Learning: 2025-09-15T07:39:39.350Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9155
File: app/controllers/api/correct_answers_controller.rb:20-22
Timestamp: 2025-09-15T07:39:39.350Z
Learning: API::CorrectAnswersController#update では、ベストアンサー取り下げという単純な状態変更のため、update! を使用して DB エラー時に 500 を返し、成功時はデフォルトレスポンスを使用するのが適切。クライアント側のバリデーションエラーは発生しにくく、明示的なエラーハンドリングは不要。
Applied to files:
app/controllers/api/admin/inquiries_controller.rb
📚 Learning: 2025-07-23T21:11:21.826Z
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-23T21:11:21.826Z
Learning: fjordllc/bootcampプロジェクトの`app/models/inquiry_notifier.rb`において、`NOTIFICATION_SENDER_NAME`で指定される管理者ユーザーは必ず存在することがシステムの前提条件として保証されているため、senderがnilになることは想定されておらず、エラーハンドリングは不要である。
Applied to files:
app/controllers/api/admin/inquiries_controller.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:
app/controllers/api/admin/inquiries_controller.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-10-22T06:04:36.036Z
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T06:04:36.036Z
Learning: ChecksController#createおよび#destroyでは、Checkの作成・削除とActiveSupport::Notifications.instrumentによるイベント発行(プラクティスのステータス更新)を同一トランザクション内で実行し、いずれかが失敗した場合は両方をロールバックする。これによりWebUI表示とDB状態の整合性を保証している。
Applied to files:
app/controllers/api/admin/inquiries_controller.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-10-22T12:22:33.168Z
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T12:22:33.168Z
Learning: CheckCallbacks内のメール通知・サイト内通知で例外が発生した場合、例外を握りつぶさず上位に伝搬させる。これにより通知失敗を検知し、運用上の混乱を防ぐ。CheckCallbacksはafter_create_commitで実行されるため、例外発生時にはCheckとステータス更新はすでにコミット済みであり、ユーザーにはエラーメッセージが表示されるが、DBには変更が残る状態になる。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-09-02T19:01:08.804Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:43-45
Timestamp: 2025-09-02T19:01:08.804Z
Learning: fjordllc/bootcampプロジェクトの`app/models/card.rb`は、ActiveRecordモデルではなくStripe APIをラップしたカスタムクラスである。`Card.destroy_all(customer_id)`メソッドは、指定されたcustomer_idに関連付けられたカードのみを削除するカスタム実装で、ActiveRecordの`destroy_all`とは動作が異なり安全である。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-11-13T09:20:36.030Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9115
File: db/migrate/20250902024949_add_unique_index_to_correct_answers.rb:1-5
Timestamp: 2025-11-13T09:20:36.030Z
Learning: fjordllc/bootcamp プロジェクトでは、データの整合性を保つためのデータ修正には data-migrate gem を使用し、db/data/ ディレクトリ配下にデータマイグレーションファイルを作成する運用を採用している。スキーマ変更(db/migrate/)とデータ変更(db/data/)を分離することで、より安全で管理しやすい構成を実現している。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-06-27T14:06:44.472Z
Learnt from: thmz337
Repo: fjordllc/bootcamp PR: 8857
File: db/migrate/20250624141527_remove_experience_from_users.rb:6-8
Timestamp: 2025-06-27T14:06:44.472Z
Learning: Railsのマイグレーションのdownメソッドでは、元のスキーマの正確な定義を確認してから制約を追加する必要がある。元のカラムに制約がない場合、ロールバック時に制約を追加すると元の状態と異なってしまう。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-09-01T22:31:57.345Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:0-0
Timestamp: 2025-09-01T22:31:57.345Z
Learning: fjordllc/bootcampプロジェクトにおいて、`Newspaper.publish(:retirement_create, { user: user })`はUnfinishedDataDestroyer(未チェックProduct・WIP Report削除、career_pathリセット)とTimesChannelDestroyer(Discord分報チャンネル削除)による重要なデータクリーンアップ処理を実行するため、退会のトリガーが何であろうと(admin、hibernation、user)必ず実行する必要がある。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Pull requests should include clear description, linked issues, screenshots for UI changes, migration notes, and rollback plan if relevant
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 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
⏰ 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 (4)
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb (1)
6-14: マイグレーションロジックは適切に実装されています。以前のフィードバックが正しく反映されています:
find_byを使用して孤立レコードに対応delete_allを使用してコールバック実行を回避- べき等性を考慮した設計
同一の
Inquiryに対して複数回update!が実行される可能性がありますが、一度限りのデータマイグレーションとしては許容範囲です。db/schema.rb (1)
485-487: スキーマ変更は適切です。inquiriesテーブルに
completed_by_user_idとcompleted_atカラムが追加され、usersテーブルへの外部キー制約がon_delete: nullifyで設定されています。これにより、対応者が削除されても対応済み状態が保持され、PRの目的である「対応者アカウントを削除するとその対応が未対応になる不具合」が修正されています。Also applies to: 1068-1068
app/models/inquiry.rb (1)
5-6: リファクタリングが適切に実施されています。Checkableモジュールの依存を削除し、
completed_by_userの直接的な関連に変更されています。optional: trueの指定により、未対応のお問い合わせが存在できる設計になっています。app/views/admin/inquiries/show.html.slim (1)
58-61: ActionCompletedButtonの更新が正しく実装されています。
action_completed?メソッドの使用とAPIパスの/api/admin/inquiriesへの変更により、新しい管理者専用APIへの移行が完了しています。
404608d to
acb2c07
Compare
CodeRabbitの指摘への対応を含む #9423 (comment) #9423 (review) のNitpick comments
There was a problem hiding this 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
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
🧰 Additional context used
📓 Path-based instructions (2)
db/**
📄 CodeRabbit inference engine (AGENTS.md)
Database migrations and schema should be stored in
db/directory; app-specific utilities inlib/; static assets inpublic/
Files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
**/*.rb
📄 CodeRabbit inference engine (AGENTS.md)
Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (
.rubocop.yml)
Files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
🧠 Learnings (14)
📓 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: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T06:04:36.036Z
Learning: ChecksController#createおよび#destroyでは、Checkの作成・削除とActiveSupport::Notifications.instrumentによるイベント発行(プラクティスのステータス更新)を同一トランザクション内で実行し、いずれかが失敗した場合は両方をロールバックする。これによりWebUI表示とDB状態の整合性を保証している。
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で対応すべきである。
📚 Learning: 2025-10-22T06:04:36.036Z
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T06:04:36.036Z
Learning: ChecksController#createおよび#destroyでは、Checkの作成・削除とActiveSupport::Notifications.instrumentによるイベント発行(プラクティスのステータス更新)を同一トランザクション内で実行し、いずれかが失敗した場合は両方をロールバックする。これによりWebUI表示とDB状態の整合性を保証している。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-10-22T12:22:33.168Z
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T12:22:33.168Z
Learning: CheckCallbacks内のメール通知・サイト内通知で例外が発生した場合、例外を握りつぶさず上位に伝搬させる。これにより通知失敗を検知し、運用上の混乱を防ぐ。CheckCallbacksはafter_create_commitで実行されるため、例外発生時にはCheckとステータス更新はすでにコミット済みであり、ユーザーにはエラーメッセージが表示されるが、DBには変更が残る状態になる。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-09-02T19:01:08.804Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:43-45
Timestamp: 2025-09-02T19:01:08.804Z
Learning: fjordllc/bootcampプロジェクトの`app/models/card.rb`は、ActiveRecordモデルではなくStripe APIをラップしたカスタムクラスである。`Card.destroy_all(customer_id)`メソッドは、指定されたcustomer_idに関連付けられたカードのみを削除するカスタム実装で、ActiveRecordの`destroy_all`とは動作が異なり安全である。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-11-13T09:20:36.030Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9115
File: db/migrate/20250902024949_add_unique_index_to_correct_answers.rb:1-5
Timestamp: 2025-11-13T09:20:36.030Z
Learning: fjordllc/bootcamp プロジェクトでは、データの整合性を保つためのデータ修正には data-migrate gem を使用し、db/data/ ディレクトリ配下にデータマイグレーションファイルを作成する運用を採用している。スキーマ変更(db/migrate/)とデータ変更(db/data/)を分離することで、より安全で管理しやすい構成を実現している。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-06-27T14:06:44.472Z
Learnt from: thmz337
Repo: fjordllc/bootcamp PR: 8857
File: db/migrate/20250624141527_remove_experience_from_users.rb:6-8
Timestamp: 2025-06-27T14:06:44.472Z
Learning: Railsのマイグレーションのdownメソッドでは、元のスキーマの正確な定義を確認してから制約を追加する必要がある。元のカラムに制約がない場合、ロールバック時に制約を追加すると元の状態と異なってしまう。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-09-01T22:31:57.345Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:0-0
Timestamp: 2025-09-01T22:31:57.345Z
Learning: fjordllc/bootcampプロジェクトにおいて、`Newspaper.publish(:retirement_create, { user: user })`はUnfinishedDataDestroyer(未チェックProduct・WIP Report削除、career_pathリセット)とTimesChannelDestroyer(Discord分報チャンネル削除)による重要なデータクリーンアップ処理を実行するため、退会のトリガーが何であろうと(admin、hibernation、user)必ず実行する必要がある。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Pull requests should include clear description, linked issues, screenshots for UI changes, migration notes, and rollback plan if relevant
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
⏰ 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 (2)
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb (2)
8-9: 安全な実装です。
find_byとnext unlessの組み合わせにより、孤立したCheckレコードが存在する場合でも安全に処理できます。
14-14:delete_allの使用は適切です。
CheckのコールバックにInquiry関連の処理がないため、効率的なdelete_allの使用が正しい選択です。
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
Outdated
Show resolved
Hide resolved
CodeRabbitの指摘への対応 #9423 (comment) #9423 (comment)
acb2c07 to
d4d5424
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb (1)
5-6: コメントが現在の実装と一致していません。過去のスレッドで合意された通り、
order句は削除されており、重複データの処理順序は重要ではないという結論になっています。Line 6のコメント「最後に最も新しいもので上書きする」は現在の実装と一致しないため、修正が必要です。🔎 コメント修正案
# 対応情報が誤って重複登録され得るバグがあった - # 稀ではあるが重複がある場合`find_each`の仕様上idの古い順に処理し、最後に最も新しいもので上書きする + # 稀ではあるが重複がある場合、`find_each`によりid昇順で処理される checks = Check.where(checkable_type: 'Inquiry')または、重複の扱いが重要でないことを明示する場合:
# 対応情報が誤って重複登録され得るバグがあった - # 稀ではあるが重複がある場合`find_each`の仕様上idの古い順に処理し、最後に最も新しいもので上書きする + # 重複データは極めて稀であり、どちらを保持しても問題ない checks = Check.where(checkable_type: 'Inquiry')
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
🧰 Additional context used
📓 Path-based instructions (2)
db/**
📄 CodeRabbit inference engine (AGENTS.md)
Database migrations and schema should be stored in
db/directory; app-specific utilities inlib/; static assets inpublic/
Files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
**/*.rb
📄 CodeRabbit inference engine (AGENTS.md)
Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (
.rubocop.yml)
Files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
🧠 Learnings (18)
📓 Common learnings
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: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/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。
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: 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のスコープ維持が重要。
📚 Learning: 2025-10-22T06:04:36.036Z
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T06:04:36.036Z
Learning: ChecksController#createおよび#destroyでは、Checkの作成・削除とActiveSupport::Notifications.instrumentによるイベント発行(プラクティスのステータス更新)を同一トランザクション内で実行し、いずれかが失敗した場合は両方をロールバックする。これによりWebUI表示とDB状態の整合性を保証している。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-10-22T12:22:33.168Z
Learnt from: sjabcdefin
Repo: fjordllc/bootcamp PR: 9247
File: app/controllers/checks_controller.rb:0-0
Timestamp: 2025-10-22T12:22:33.168Z
Learning: CheckCallbacks内のメール通知・サイト内通知で例外が発生した場合、例外を握りつぶさず上位に伝搬させる。これにより通知失敗を検知し、運用上の混乱を防ぐ。CheckCallbacksはafter_create_commitで実行されるため、例外発生時にはCheckとステータス更新はすでにコミット済みであり、ユーザーにはエラーメッセージが表示されるが、DBには変更が残る状態になる。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-09-02T19:01:08.804Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:43-45
Timestamp: 2025-09-02T19:01:08.804Z
Learning: fjordllc/bootcampプロジェクトの`app/models/card.rb`は、ActiveRecordモデルではなくStripe APIをラップしたカスタムクラスである。`Card.destroy_all(customer_id)`メソッドは、指定されたcustomer_idに関連付けられたカードのみを削除するカスタム実装で、ActiveRecordの`destroy_all`とは動作が異なり安全である。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-11-13T09:20:36.030Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9115
File: db/migrate/20250902024949_add_unique_index_to_correct_answers.rb:1-5
Timestamp: 2025-11-13T09:20:36.030Z
Learning: fjordllc/bootcamp プロジェクトでは、データの整合性を保つためのデータ修正には data-migrate gem を使用し、db/data/ ディレクトリ配下にデータマイグレーションファイルを作成する運用を採用している。スキーマ変更(db/migrate/)とデータ変更(db/data/)を分離することで、より安全で管理しやすい構成を実現している。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-06-27T14:06:44.472Z
Learnt from: thmz337
Repo: fjordllc/bootcamp PR: 8857
File: db/migrate/20250624141527_remove_experience_from_users.rb:6-8
Timestamp: 2025-06-27T14:06:44.472Z
Learning: Railsのマイグレーションのdownメソッドでは、元のスキーマの正確な定義を確認してから制約を追加する必要がある。元のカラムに制約がない場合、ロールバック時に制約を追加すると元の状態と異なってしまう。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-09-01T22:31:57.345Z
Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:0-0
Timestamp: 2025-09-01T22:31:57.345Z
Learning: fjordllc/bootcampプロジェクトにおいて、`Newspaper.publish(:retirement_create, { user: user })`はUnfinishedDataDestroyer(未チェックProduct・WIP Report削除、career_pathリセット)とTimesChannelDestroyer(Discord分報チャンネル削除)による重要なデータクリーンアップ処理を実行するため、退会のトリガーが何であろうと(admin、hibernation、user)必ず実行する必要がある。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Pull requests should include clear description, linked issues, screenshots for UI changes, migration notes, and rollback plan if relevant
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-07-23T20:31:13.856Z
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'`イベントを発行する。これは両方とも本質的に「レポートの保存」操作であり、作成と更新を区別する必要がないためである。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.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:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-07-23T21:11:21.826Z
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-23T21:11:21.826Z
Learning: fjordllc/bootcampプロジェクトの`app/models/inquiry_notifier.rb`において、`NOTIFICATION_SENDER_NAME`で指定される管理者ユーザーは必ず存在することがシステムの前提条件として保証されているため、senderがnilになることは想定されておらず、エラーハンドリングは不要である。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
📚 Learning: 2025-09-15T07:39:39.350Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9155
File: app/controllers/api/correct_answers_controller.rb:20-22
Timestamp: 2025-09-15T07:39:39.350Z
Learning: API::CorrectAnswersController#update では、ベストアンサー取り下げという単純な状態変更のため、update! を使用して DB エラー時に 500 を返し、成功時はデフォルトレスポンスを使用するのが適切。クライアント側のバリデーションエラーは発生しにくく、明示的なエラーハンドリングは不要。
Applied to files:
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb
⏰ 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 (1)
db/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rb (1)
7-16: 実装は適切です。過去のレビューで議論された改善点がすべて反映されています:
find_byによる安全な取得で孤立レコードに対応delete_allでコールバックを回避(Checkにコールバックは不要)- べき等性を保つ設計で再実行可能
|
@machida 現状は私の方で暫定的に日報などの確認済スタンプと同じデザインをあてています。(本PRのScreenshot参照) よろしくお願いします🙏 |
|
@ryufuta 了解です!連絡ありがとうございます!! |
|
@machida |
対応者と対応した日時はchecksテーブルにも記録しているためデータマイグレーション後にchecksテーブルとの関連を削除する 以下変更理由 対応済であることはinquiriesテーブルのaction_completedカラム値がtrueであることとchecksテーブルにレコードが存在することで判定していたが冗長でロジックが不必要に複雑になっていた そのため - inquiriesテーブルからaction_completedカラムを削除 - inquiriesテーブルにchecksテーブルで管理していた対応者と対応した日時のデータを移行してchecksテーブルとの関連を削除 のいずれかの対応が必要 以下の理由で今回は後者を採用した - お問い合わせに最後に誰が対応したかという情報のみ必要(未対応に戻しても変更履歴を残す必要はない)なため別テーブルで管理するメリットがない - checksテーブルは日報と提出物の確認済で利用されているがこれらとテーブル、モデル、コントローラを共通化するのはメリットが小さく複雑化するデメリットの方が大きい - お問い合わせは作成者がbootcampアプリの非ユーザー、対応者はメンターではなく管理者に限定、bootcampアプリ内で作成者と対応者の間で対応したことを通知するなどのやり取りが発生しないなど、日報や提出物とは別物なので共通点が少ない - お問い合わせを対応済みにするコンポーネントを相談部屋を対応済みにするコンポーネントで置き換え予定のため相談部屋と同様に対応と未対応の切り替えをupdateアクションで実行したい - 現状のお問い合わせの対応と未対応の切り替えはInquiriesコントローラのupdateアクションで実行しているがchecksテーブルを利用するのであればChecksコントローラのcreate/destroyアクションで実行するよう変更する
inquiriesに追加したカラムに対応済情報を記録できるようにしたためchecksテーブルを使わないようにした Inquiry.lockの部分は元々トランザクション内で実行しなければ意味がなく悲観的ロックの必要もないため削除 同時に以下のバグも修正 - 異なるユーザーが未対応のお問い合わせページを同時に表示している場合にいずれのユーザーも対応済ボタンをクリックできchecksテーブルに対応者が重複登録される - 対応者のアカウントを削除するとその対応者が対応したお問い合わせが未対応になる
checksテーブルに依存していたときとは異なり対応者アカウントが削除されても対応済のままになる
これによりcheckableに対してuserを必ず呼び出せるようになったためCheck#receiverの実装も変更
対応済みにするボタンが表示されるページには管理者しかアクセスできないが、APIは管理者以外も叩けるようになっていた
CodeRabbitの指摘に対応:#9423 (comment)
CodeRabbitの指摘への対応 #9423 (comment) #9423 (comment)
d4d5424 to
82b7e5d
Compare
Issue
概要
お問い合わせを対応済にする機能について以下を実施した。
inquiriesテーブルにカラム追加・checksテーブルとのポリモーフィック関連削除Issueにも記載している通り対応済コンポーネント(
ActionCompletedButton.jsx)は非React化する(削除して別の実装に置き換える)ためこのPRでは意図的に修正していない。変更確認方法
1. データマイグレーションが正しく実行されること・対応済スタンプの表示が変更されていることを確認する
本PRによる変更前の環境で対応済のお問い合わせを複数作成しておき、本PRによる変更後の環境でデータマイグレーションを実行する。
これによりお問い合わせの対応済データが適切に移行することを確認する。
対応済スタンプの表示を変更したためその確認も同時に行う。
chore/refactor-action-completion-for-inquiryをローカルに取り込むbin/rails db:migrateを実行してDBスキーマを更新するbin/rails db:migrate:with_data VERSION=20251221131416を実行してデータを移行するbin/rails cでRailsコンソールを起動してchecksテーブルからお問い合わせの対応済データが削除されていることを確認する※本番環境ではビルド時に
bin/rails db:migrate:with_dataが実行されます。このコマンドでは未適用のデータマイグレーションとスキーママイグレーションをタイムスタンプが古い順に実行します。
今回の場合だと
db/migrate/20251221040419_add_columns_to_inquiries.rbdb/data/20251221131416_migrate_action_completion_details_to_inquiries_from_checks.rbの順に実行されることになります。
(先にカラム追加を実行する必要があるためこの順番で実行されることが重要です。もう一つインデックス削除のマイグレーションファイルがありますが、その実行順は不問です。)
既存の一部のデータマイグレーションがDBスキーマと矛盾して実行できなくなっているためローカルではこのコマンドを実行できず、上の手順6, 7の順に別のコマンドを実行するようにしています。
2. お問い合わせを未対応・対応済にできることを確認する
1の確認後にお問い合わせを対応済にする機能がデグレしていないことを確認する。
※対応済スタンプはJavaScriptで操作していないためボタンクリック後にブラウザをリロードしないとスタンプの表示は切り替わらない。
※修正したバグについてはいずれもコーナーケースなので確認項目から省略しているが、実装者により動作確認済み。
3. 提出物を合格にしたときに通知が飛ぶことを確認する
InquiryとCheckとのポリモーフィック関連を削除した際にCheckとCheckCallbacksからInquiryに特有のコードを削除したため、デグレしていないことを確認する。Screenshot
変更前
変更後
Summary by CodeRabbit
新機能
改善
データ移行
破壊的変更
✏️ Tip: You can customize this high-level summary in your review settings.