Files
pitchfast/backlog/tasks/task-51 - Replace-Google-Places-discovery-with-Local-Business-Data-and-manual-audit-starts.md

3.0 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, priority, ordinal
id title status assignee created_date updated_date labels dependencies priority ordinal
TASK-51 Replace Google Places discovery with Local Business Data and manual audit starts In Progress
2026-06-10 19:49 2026-06-10 20:26
high 53000

Description

Replace the campaign lead discovery provider with RapidAPI Local Business Data, stop automatic enrichment/audit chaining after discovery, and add an explicit user-triggered audit start from lead review.

Acceptance Criteria

  • #1 Campaign runs use Local Business Data via LOCAL_BUSINESS_DATA_API_KEY and no longer require Google Geocoding or Places keys.
  • #2 Campaign lead discovery persists direct contact emails from the provider and does not queue website enrichment.
  • #3 Website enrichment no longer auto-queues PageSpeed or audit generation.
  • #4 Operators can start an audit manually from a lead review row via an authenticated mutation.
  • #5 Operational readiness, env docs, usage providers, source assertions, and regression tests cover the new flow.

Implementation Plan

  1. Add tests for Local Business Data adapter, schema/provider changes, and removed auto-trigger source paths
  2. Implement provider adapter and swap Convex lead discovery to single Local Business Data search
  3. Entangle manual audit start from automatic discovery/enrichment chain
  4. Add Lead Review UI action and update campaign/ops copy and env docs
  5. Run focused tests, full pnpm test, and update acceptance criteria notes

Implementation Notes

Implemented Local Business Data lead discovery adapter and swapped campaign runs to LOCAL_BUSINESS_DATA_API_KEY/RapidAPI search. Removed automatic website enrichment queueing from discovery and automatic PageSpeed queueing from website enrichment. Added authenticated manual pageSpeed.requestLeadAudit mutation plus Lead Review Audit starten UI with disabled reasons. Updated schema/domain/source provider fields, Source Business ID blacklist matching, ops readiness/env docs/copy, and regression tests. Verification passed: pnpm test (407/407).

Bug follow-up: First Local Business Data campaign test showed no emails in Lead Review. Root cause investigation found provider emails under data[].emails_and_contacts.emails while the adapter only parsed top-level email fields. Planned fix: parse nested emails and update existing duplicate leads with missing email on campaign re-run, without automatic enrichment/audit queueing.

Bug fix implemented: Local Business Data adapter now parses data[].emails_and_contacts.emails, normalizes and dedupes email candidates, and campaign re-runs backfill missing email fields on duplicate leads when safe. Verified focused lead-discovery tests and full pnpm test (409/409). TASK-51 remains In Progress pending user confirmation.