Skip to content

feat(breeze_buddy): normalize lead_call_tracker outcomes to UPPERCASE#739

Open
MonishJuspay wants to merge 1 commit into
juspay:releasefrom
MonishJuspay:feat-uppercase-outcomes
Open

feat(breeze_buddy): normalize lead_call_tracker outcomes to UPPERCASE#739
MonishJuspay wants to merge 1 commit into
juspay:releasefrom
MonishJuspay:feat-uppercase-outcomes

Conversation

@MonishJuspay
Copy link
Copy Markdown
Contributor

@MonishJuspay MonishJuspay commented May 5, 2026

  • Apply .upper() on outcome at insert/update in lead_call_tracker.py
  • Add migration 026 to backfill any existing lowercase rows

Summary by CodeRabbit

  • Improvements
    • Lead call tracker outcome values are now consistently normalized to uppercase across new entries and existing data for uniform formatting.

  - Apply .upper() on outcome at insert/update in lead_call_tracker.py
  - Add migration 026 to backfill any existing lowercase rows
Copilot AI review requested due to automatic review settings May 5, 2026 10:47
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Walkthrough

This PR normalizes lead call tracker outcomes to uppercase across the system. A database migration updates all existing non-null outcome values to uppercase, while two query functions are modified to store outcome values in uppercase when inserting or updating records.

Changes

Outcome Normalization

Layer / File(s) Summary
Query Functions
app/database/queries/breeze_buddy/lead_call_tracker.py
insert_lead_call_tracker_query and update_lead_call_completion_details_query now apply .upper() to outcome values before persisting them.
Data Migration
app/database/migrations/026_normalize_outcomes_to_uppercase.sql
One-time migration updates all existing non-null outcome values in lead_call_tracker to uppercase via a transactional update.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Outcomes now shine so bright and tall,
All uppercase, we normalize them all,
No more mixed case to cause a fuss,
The migration cleans what came before us!

🚥 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 accurately describes the main change: normalizing lead_call_tracker outcomes to uppercase. It directly corresponds to both the code modifications (applying .upper() in queries) and the database migration (backfilling existing data).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes Breeze Buddy lead_call_tracker.outcome values to uppercase at the DB write layer and adds a one-time migration to backfill existing rows, which helps keep downstream analytics and status handling consistent.

Changes:

  • Uppercase outcome before inserting new lead_call_tracker rows.
  • Uppercase outcome before updating lead completion details.
  • Add migration 026 to convert existing stored outcomes to uppercase.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/database/queries/breeze_buddy/lead_call_tracker.py Normalizes outcome values during insert/update query construction.
app/database/migrations/026_normalize_outcomes_to_uppercase.sql Backfills historical lead_call_tracker.outcome rows to uppercase.


if outcome is not None:
values.append(outcome)
values.append(outcome.upper())
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/database/queries/breeze_buddy/lead_call_tracker.py (1)

393-395: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Outcome filter not normalized — will silently return empty results for lowercase inputs.

Both get_all_lead_call_trackers_query and get_lead_call_trackers_count_query pass caller-supplied outcome values directly into equality filters. Since all stored outcomes are UPPERCASE (enforced by write-path normalization at lines 100 and 333), a caller passing "confirm" or "Confirm" will match zero rows with no error. The read path must normalize to match the write path.

Proposed fix – normalize `outcome` filter in both query builders
# get_all_lead_call_trackers_query (lines 393-395)
     if outcome:
-        values.append(outcome)
+        values.append(outcome.upper())
         conditions.append(f"outcome = ${len(values)}")

# get_lead_call_trackers_count_query (lines 463-465)
     if outcome:
-        values.append(outcome)
+        values.append(outcome.upper())
         conditions.append(f"outcome = ${len(values)}")

Note: This pattern also affects the analytics query at line 181 in app/database/queries/breeze_buddy/analytics.py, which similarly passes unormalized outcome filters to the database.

🤖 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 `@app/database/queries/breeze_buddy/lead_call_tracker.py` around lines 393 -
395, The outcome filter is compared case-sensitively while stored outcomes are
normalized to UPPERCASE, so callers like "confirm" return no rows; in
get_all_lead_call_trackers_query and get_lead_call_trackers_count_query
normalize the incoming outcome (e.g., outcome = outcome.upper()) before
appending it to values/conditions (the same normalization should be applied
wherever outcome is added to the query, e.g., the analytics query that builds
outcome filters) so read-path comparisons match the write-path normalization.
🤖 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.

Outside diff comments:
In `@app/database/queries/breeze_buddy/lead_call_tracker.py`:
- Around line 393-395: The outcome filter is compared case-sensitively while
stored outcomes are normalized to UPPERCASE, so callers like "confirm" return no
rows; in get_all_lead_call_trackers_query and get_lead_call_trackers_count_query
normalize the incoming outcome (e.g., outcome = outcome.upper()) before
appending it to values/conditions (the same normalization should be applied
wherever outcome is added to the query, e.g., the analytics query that builds
outcome filters) so read-path comparisons match the write-path normalization.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 744f438f-e048-44b2-b87c-ede685870a05

📥 Commits

Reviewing files that changed from the base of the PR and between e225f50 and b4ee082.

📒 Files selected for processing (2)
  • app/database/migrations/026_normalize_outcomes_to_uppercase.sql
  • app/database/queries/breeze_buddy/lead_call_tracker.py

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.

2 participants