Backend: feat - voice buddy lead and connect api integaration#1382
Backend: feat - voice buddy lead and connect api integaration#1382kavya-shree-s wants to merge 1 commit into
Conversation
WalkthroughAdds a new ChangesVoiceSdk BreezeBuddy Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/mobility-core/src/Kernel/External/VoiceSdk/BreezeBuddy/Flow.hs`:
- Around line 51-54: The issue is that callBreezeBuddyAPI re-exposes raw
ClientError details through InternalError, which can leak sensitive upstream
response/request data to callers. Update the error handling in
callBreezeBuddyAPI so it preserves the existing callAPI redaction behavior and
does not concatenate show err into the InternalError message; keep the returned
API error generic while still allowing internal logging to retain the detailed
error elsewhere.
In `@lib/mobility-core/src/Kernel/External/VoiceSdk/Interface.hs`:
- Around line 7-11: This Haskell module is missing the required Prelude import
under the repo’s NoImplicitPrelude convention. Add an explicit import of
Kernel.Prelude (or EulerHS.Prelude) to Kernel.External.VoiceSdk.Interface
alongside the existing imports, keeping the module consistent with the rest of
the codebase and ensuring standard Prelude symbols are available through the
project’s preferred prelude.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5a60ff77-a627-4ff0-b16a-8a9cd920ee5f
📒 Files selected for processing (7)
lib/mobility-core/mobility-core.caballib/mobility-core/src/Kernel/External/VoiceSdk/BreezeBuddy/Flow.hslib/mobility-core/src/Kernel/External/VoiceSdk/BreezeBuddy/Types.hslib/mobility-core/src/Kernel/External/VoiceSdk/Interface.hslib/mobility-core/src/Kernel/External/VoiceSdk/Interface/BreezeBuddy.hslib/mobility-core/src/Kernel/External/VoiceSdk/Interface/Types.hslib/mobility-core/src/Kernel/External/VoiceSdk/Types.hs
| callBreezeBuddyAPI :: (MonadFlow m, HasRequestId r, MonadReader r m) => CallAPI' m r api res res | ||
| callBreezeBuddyAPI url eulerClient description proxy = do | ||
| callAPI url eulerClient description proxy | ||
| >>= fromEitherM (\err -> InternalError $ "Failed to call " <> description <> " API: " <> show err) |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Don’t surface raw ClientError details via InternalError.
callAPI already redacts the underlying show err before logging, but Line 54 puts the raw error text back into InternalError. Since InternalError is exposed as the API error message, this can leak third-party response bodies or request details to callers.
Proposed fix
callBreezeBuddyAPI url eulerClient description proxy = do
callAPI url eulerClient description proxy
- >>= fromEitherM (\err -> InternalError $ "Failed to call " <> description <> " API: " <> show err)
+ >>= fromEitherM (\_ -> InternalError $ "Failed to call " <> description <> " API")📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| callBreezeBuddyAPI :: (MonadFlow m, HasRequestId r, MonadReader r m) => CallAPI' m r api res res | |
| callBreezeBuddyAPI url eulerClient description proxy = do | |
| callAPI url eulerClient description proxy | |
| >>= fromEitherM (\err -> InternalError $ "Failed to call " <> description <> " API: " <> show err) | |
| callBreezeBuddyAPI :: (MonadFlow m, HasRequestId r, MonadReader r m) => CallAPI' m r api res res | |
| callBreezeBuddyAPI url eulerClient description proxy = do | |
| callAPI url eulerClient description proxy | |
| >>= fromEitherM (\_ -> InternalError $ "Failed to call " <> description <> " API") |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@lib/mobility-core/src/Kernel/External/VoiceSdk/BreezeBuddy/Flow.hs` around
lines 51 - 54, The issue is that callBreezeBuddyAPI re-exposes raw ClientError
details through InternalError, which can leak sensitive upstream
response/request data to callers. Update the error handling in
callBreezeBuddyAPI so it preserves the existing callAPI redaction behavior and
does not concatenate show err into the InternalError message; keep the returned
API error generic while still allowing internal logging to retain the detailed
error elsewhere.
| import qualified Kernel.External.VoiceSdk.Interface.BreezeBuddy as BreezeBuddy | ||
| import Kernel.External.VoiceSdk.Interface.Types | ||
| import Kernel.External.VoiceSdk.Types as Reexport | ||
| import Kernel.Tools.Metrics.CoreMetrics (CoreMetrics) | ||
| import Kernel.Utils.Common |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Import Kernel.Prelude in this module.
This is the only new Haskell module here that skips the required Prelude import. Please add Kernel.Prelude (or EulerHS.Prelude) to stay aligned with the repo’s NoImplicitPrelude convention.
Proposed fix
import qualified Kernel.External.VoiceSdk.Interface.BreezeBuddy as BreezeBuddy
import Kernel.External.VoiceSdk.Interface.Types
import Kernel.External.VoiceSdk.Types as Reexport
+import Kernel.Prelude
import Kernel.Tools.Metrics.CoreMetrics (CoreMetrics)
import Kernel.Utils.CommonAs per coding guidelines, "**/*.hs: All modules must import Kernel.Prelude or EulerHS.Prelude instead of the standard Prelude due to NoImplicitPrelude language pragma`."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import qualified Kernel.External.VoiceSdk.Interface.BreezeBuddy as BreezeBuddy | |
| import Kernel.External.VoiceSdk.Interface.Types | |
| import Kernel.External.VoiceSdk.Types as Reexport | |
| import Kernel.Tools.Metrics.CoreMetrics (CoreMetrics) | |
| import Kernel.Utils.Common | |
| import qualified Kernel.External.VoiceSdk.Interface.BreezeBuddy as BreezeBuddy | |
| import Kernel.External.VoiceSdk.Interface.Types | |
| import Kernel.External.VoiceSdk.Types as Reexport | |
| import Kernel.Prelude | |
| import Kernel.Tools.Metrics.CoreMetrics (CoreMetrics) | |
| import Kernel.Utils.Common |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@lib/mobility-core/src/Kernel/External/VoiceSdk/Interface.hs` around lines 7 -
11, This Haskell module is missing the required Prelude import under the repo’s
NoImplicitPrelude convention. Add an explicit import of Kernel.Prelude (or
EulerHS.Prelude) to Kernel.External.VoiceSdk.Interface alongside the existing
imports, keeping the module consistent with the rest of the codebase and
ensuring standard Prelude symbols are available through the project’s preferred
prelude.
Source: Coding guidelines
Type of Change
Description
Additional Changes
Motivation and Context
How did you test it?
Checklist
./dev/format-all-files.shSummary by CodeRabbit