feat(breeze_buddy): normalize lead_call_tracker outcomes to UPPERCASE#739
feat(breeze_buddy): normalize lead_call_tracker outcomes to UPPERCASE#739MonishJuspay wants to merge 1 commit into
Conversation
- Apply .upper() on outcome at insert/update in lead_call_tracker.py - Add migration 026 to backfill any existing lowercase rows
WalkthroughThis 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. ChangesOutcome Normalization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
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
outcomebefore inserting newlead_call_trackerrows. - Uppercase
outcomebefore updating lead completion details. - Add migration
026to 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()) |
There was a problem hiding this comment.
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 winOutcome filter not normalized — will silently return empty results for lowercase inputs.
Both
get_all_lead_call_trackers_queryandget_lead_call_trackers_count_querypass caller-suppliedoutcomevalues 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
📒 Files selected for processing (2)
app/database/migrations/026_normalize_outcomes_to_uppercase.sqlapp/database/queries/breeze_buddy/lead_call_tracker.py
Summary by CodeRabbit