リファクタリング Phase 2: 設計改善(DI / ENV集約)#87
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the codebase to use dependency injection across use cases and repositories, moves environment variable resolution to startup in src/main.cr, and renames Github::Notifications to Github::Notification. Feedback focuses on performance improvements: first, instantiating repositories and use cases outside of the Lambda handler in src/main.cr to leverage warm starts; second, maintaining an HTTP::Client instance in Slack::PostRepository to enable connection reuse and keep-alive.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
f86ca5f to
819971c
Compare
de50b63 to
f704124
Compare
819971c to
bbc54ea
Compare
Address review feedback on PR #87: - main.cr: instantiate repositories and usecases once at cold start (module scope) instead of per-invocation, so they are reused across warm Lambda invocations - Slack::PostRepository: hold a persistent HTTP::Client and reuse it, enabling keep-alive connection reuse (matches the existing Github repository pattern) refs #84 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address review feedback on PR #87: - main.cr: instantiate repositories and usecases once at cold start (module scope) instead of per-invocation, so they are reused across warm Lambda invocations - Slack::PostRepository: hold a persistent HTTP::Client and reuse it, enabling keep-alive connection reuse (matches the existing Github repository pattern) refs #84 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
a697d1b to
7d39fb7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a697d1b8ad
ℹ️ 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".
- rename Github::Notifications -> Github::Notification (singular) - inject NotificationRepository into Github::Usecase to remove per-attachment HTTP::Client creation (N+1) - centralize ENV access in main.cr (composition root); usecases receive dependencies via constructor - Slack::PostRepository keeps only @uri; send_attachment delegates to send_attachments refs #84 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address review feedback on PR #87: - main.cr: instantiate repositories and usecases once at cold start (module scope) instead of per-invocation, so they are reused across warm Lambda invocations - Slack::PostRepository: hold a persistent HTTP::Client and reuse it, enabling keep-alive connection reuse (matches the existing Github repository pattern) refs #84 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7d39fb7 to
9c68868
Compare
Part of #84(3分割 PR の 2/3)
設計面の改善。挙動は不変。
Github::Notifications→Github::Notification(1件を表すため単数形)Github::UsecaseにNotificationRepositoryをコンストラクタ注入し、attachment 1件ごとにHTTP::Clientを生成していた N+1 を解消main.cr(composition root)に集約し起動時に解決。各 usecase は依存をコンストラクタで受け取るSlack::PostRepositoryは@uriのみ保持、send_attachmentはsend_attachmentsへ委譲検証:
crystal build成功。🤖 Generated with Claude Code