Skip to content

Backend: feat - voice buddy lead and connect api integaration#1382

Open
kavya-shree-s wants to merge 1 commit into
mainfrom
Backend-feat-buddy-voice-api-integration
Open

Backend: feat - voice buddy lead and connect api integaration#1382
kavya-shree-s wants to merge 1 commit into
mainfrom
Backend-feat-buddy-voice-api-integration

Conversation

@kavya-shree-s

@kavya-shree-s kavya-shree-s commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates

Description

Additional Changes

  • This PR modifies the database schema (database migration added)
  • This PR modifies dhall configs/environment variables

Motivation and Context

How did you test it?

Checklist

  • I formatted the code and addressed linter errors ./dev/format-all-files.sh
  • I reviewed submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

Summary by CodeRabbit

  • New Features
    • Added a new Voice SDK integration with support for creating leads and connecting sessions.
    • Introduced shared request, response, and configuration types for Voice SDK usage.
    • Exposed a new service option for BreezeBuddy in the app’s public API.
  • Bug Fixes
    • Improved request/response mapping so internal and external Voice SDK formats align correctly.
    • Added JSON handling that omits empty optional fields and validates service values consistently.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds a new Kernel.External.VoiceSdk subsystem with six modules: a VoiceSdkService enum, internal interface types (CreateLeadReq/Resp, ConnectReq/Resp, VoiceSdkConfig), BreezeBuddy-specific SDK types, Servant API type specs and HTTP client functions for createLead and connect, and an interface adapter layer that decrypts API keys and maps between internal and BreezeBuddy-specific request/response types. All modules are registered in the cabal exposed-modules list.

Changes

VoiceSdk BreezeBuddy Integration

Layer / File(s) Summary
Service enum and interface types
lib/mobility-core/src/Kernel/External/VoiceSdk/Types.hs, lib/mobility-core/src/Kernel/External/VoiceSdk/Interface/Types.hs
VoiceSdkService enum with BreezeBuddy constructor, Beam/persistence/JSON instances, and public interface types CreateLeadReq/Resp, ConnectReq/Resp, VoiceSdkConfig.
BreezeBuddy SDK data types
lib/mobility-core/src/Kernel/External/VoiceSdk/BreezeBuddy/Types.hs
BreezeBuddySdkConfig with encrypted API key, lead/connect request and response records with JSON instances that omit Nothing fields.
Servant API specs and HTTP clients
lib/mobility-core/src/Kernel/External/VoiceSdk/BreezeBuddy/Flow.hs
CreateLeadAPI and ConnectAPI Servant type specs, createLead/connect HTTP client functions with Bearer auth, and callBreezeBuddyAPI error-mapping helper.
Interface adapter and dispatch
lib/mobility-core/src/Kernel/External/VoiceSdk/Interface/BreezeBuddy.hs, lib/mobility-core/src/Kernel/External/VoiceSdk/Interface.hs
Interface.BreezeBuddy decrypts the API key and maps internal types to/from BreezeBuddy types via conversion helpers; Interface.hs dispatches on VoiceSdkConfig to the BreezeBuddy implementation.
Cabal module registration
lib/mobility-core/mobility-core.cabal
Six new Kernel.External.VoiceSdk.* modules added to exposed-modules.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • khuzema786
  • Vignesh-772
  • bytedex

Poem

🐇 A new voice SDK hops into place,
BreezeBuddy leads with encrypted grace.
Servant specs and Bearer keys shine,
Mapping requests down the call-chain line.
The rabbit cheers — six modules, all fine! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is clearly related to the new Voice Buddy lead and connect API integration feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Backend-feat-buddy-voice-api-integration

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between b4dd2e4 and b9b0816.

📒 Files selected for processing (7)
  • lib/mobility-core/mobility-core.cabal
  • lib/mobility-core/src/Kernel/External/VoiceSdk/BreezeBuddy/Flow.hs
  • lib/mobility-core/src/Kernel/External/VoiceSdk/BreezeBuddy/Types.hs
  • lib/mobility-core/src/Kernel/External/VoiceSdk/Interface.hs
  • lib/mobility-core/src/Kernel/External/VoiceSdk/Interface/BreezeBuddy.hs
  • lib/mobility-core/src/Kernel/External/VoiceSdk/Interface/Types.hs
  • lib/mobility-core/src/Kernel/External/VoiceSdk/Types.hs

Comment on lines +51 to +54
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 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.

Suggested change
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.

Comment on lines +7 to +11
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 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.Common

As 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.

Suggested change
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

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