Fix onboarding orphan prospect query#349
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughIn ChangesParameterize contact_type ILIKE filter
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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.
Pull request overview
Fixes a psycopg placeholder parsing error in the dashboard onboarding “orphan intake submissions” query by parameterizing the prospect ILIKE pattern instead of embedding a %prospect% literal in the SQL. This aligns with the repo’s existing DB access pattern (cursor.execute(trusted_sql(sql), params)) and prevents ProgrammingError triggered by stray % sequences in query strings.
Changes:
- Replace
people.contact_type ILIKE '%prospect%'withpeople.contact_type ILIKE %sand bind"%prospect%"via query parameters. - Update the unit regression test to assert the SQL placeholder and the bound parameter value.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/api/src/five08/backend/api.py | Parameterizes the prospect ILIKE filter to avoid psycopg placeholder parsing errors. |
| tests/unit/test_backend_api.py | Adjusts regression assertions to validate placeholder usage and bound params. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
%prospect%SQL literal.Root Cause
The onboarding queue always runs the orphan-intake query. That query included
people.contact_type ILIKE '%prospect%'inside a psycopg parameterized statement, so psycopg parsed%pas an invalid placeholder and raisedProgrammingError: only '%s', '%b', '%t' are allowed as placeholders, got '%p'.\n\n## Validation\n-uv run --package api pytest tests/unit/test_backend_api.py -q\n- pre-commit hooks on commit: ruff, ruff format, Pyrefly\nSummary by CodeRabbit