-
-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor missing worklogs to read credentials from env #111
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
|
""" WalkthroughThe changes refactor the handling of service account credentials for workspace messaging. Credentials are now sourced from an environment variable rather than a file. This involves updating the sender utility, the notification implementation, and the missing work logs use case to pass and use credentials as a string from the environment. Changes
Sequence Diagram(s)sequenceDiagram
participant Env as Environment
participant UseCase as NotifyMissingWorkLogs
participant Notify as NotifyWorkspaceDm
participant Sender as SendMessageToWorkspace
Env->>UseCase: Provides SERVICE_ACCOUNT_CREDENTIALS_JSON
UseCase->>Notify: Calls process with credentials in options
Notify->>Sender: Initializes with service_account_credentials
Sender->>Sender: Authenticates using credentials string
Sender->>Notify: Sends message
Notify->>UseCase: Returns result
Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/implementations/notify_workspace_dm.rb(1 hunks)src/use_cases_execution/missing_work_logs/config.rb(0 hunks)src/use_cases_execution/missing_work_logs/notify_missing_work_logs.rb(2 hunks)src/utils/send_message_to_workspace.rb(2 hunks)
💤 Files with no reviewable changes (1)
- src/use_cases_execution/missing_work_logs/config.rb
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Tests
🔇 Additional comments (5)
src/use_cases_execution/missing_work_logs/notify_missing_work_logs.rb (1)
5-5: LGTM: Environment variable loading added appropriately.The addition of
dotenv/loadis correct for loading environment variables from.envfiles during development.src/implementations/notify_workspace_dm.rb (2)
44-45: LGTM: Good refactoring to extract notification logic.The extraction of message sending into a separate method improves code organization and readability.
55-59: LGTM: Appropriate error handling pattern.The error handling correctly catches StandardError and returns a consistent error response format.
src/utils/send_message_to_workspace.rb (2)
42-42: LGTM: Correct use of StringIO for credentials.Using
StringIO.new(@service_account_credentials)is the appropriate way to convert the credentials string to an IO object that the Google Auth library expects.
16-25:Details
✅ Verification successful
Verify all callers have been updated for the breaking change.
The constructor signature has changed from
credentials_path:toservice_account_credentials:, which is a breaking change. Ensure all usage of this class has been updated.
🏁 Script executed:
#!/bin/bash # Description: Verify all instantiations of SendMessageToWorkspace use the new parameter name # Expected: Only find usage of service_account_credentials parameter, no credentials_path # Search for any remaining usage of the old parameter name rg -A 5 -B 5 'credentials_path:' # Search for all instantiations of SendMessageToWorkspace rg -A 10 'SendMessageToWorkspace\.new'Length of output: 853
No remaining usage of
credentials_path:inSendMessageToWorkspaceinstantiations
All callers now useservice_account_credentials:. No further action required.
Description
Changes required in the use case to read credentials from a secret
Fixes #110
Type of change
Checklist
Summary by CodeRabbit
Refactor
Chores