chore(valuation): remove legacy client-side lead-capture ping (chat#1885) - #53
Conversation
…885) Lead-capture (Attio upsert + team Telegram alert) now fires server-side from POST /api/valuation for every caller (api#785), so the marketing funnel's client-side path is redundant and would double-fire (two Attio notes + two pings per funnel valuation). Remove the browser ping and the whole now-orphaned chain: - the `captureRunLead` call in useCatalogValuation (+ the unused `user`); - captureRunLead / captureValuationLead; - the `/api/valuation/lead` route and its Attio/Telegram helpers (upsertValuationLead, leadAttributes, leadNoteContent, valuationLeadInput); - lib/attio/* (valuation-lead-only primitives), lib/telegram, lib/format/usd. Kept: lib/attio.ts (the subscribe/CRM contact integration) and the valuation display helpers (formatUsd, formatCompact, runValuation, toArtist). A funnel valuation now captures exactly one lead, from the shared api. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (24)
💤 Files with no reviewable changes (23)
📝 WalkthroughWalkthroughValuation lead capture was removed from the client hook and server route, along with its Attio, Telegram, formatting, input, and test modules. The hook now runs valuations and updates state without initiating lead-capture side effects. ChangesValuation lead-capture removal
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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 |
Preview verification — funnel valuation, no client-side lead pingAlso removed a stray screenshot ( Tested the live funnel on the preview ( The core change — client no longer pings
|
| Request | Count |
|---|---|
POST …/api/valuation (the valuation) |
1 |
POST …/api/valuation/lead (the removed client ping) |
0 |
GET /api/spotify/search (typeahead) + Privy auth |
(expected) |
/api/valuation/leadroute → 404 on the preview (GET + POST) — the route + its helpers are deleted.- Funnel valuation still works end-to-end: $3.6M (range $2.5M–$5.0M), 207 tracks, "Get the full report" CTA.
On the "exactly one lead" end-state
This preview's funnel calls test-recoup-api (per lib/config.ts, non-prod → test api), which doesn't yet carry api#785's server-side lead-capture — so no lead fired here (confirmed: no Attio Person for the test email). That's expected for the preview, not a regression from this PR.
The prod end-state is: funnel → recoup-api (has api#785, merged 96959eb1) → the api captures exactly one Attio lead + one Telegram ping, and this PR removes the second (client) fire. api#785's server-side capture was verified directly against Attio (api#785 results). So: api#785 fires one + marketing#53 removes the client one = exactly one, no double-send.
pnpm build + TS pass (Vercel CI green). Ready to merge (completes the api#785 → marketing#53 pair).

What
Follow-up to recoupable/api#785, which moved valuation lead-capture (Attio upsert + team Telegram alert) server-side into
POST /api/valuationso every caller captures a lead. With that in place the marketing funnel's client-side ping is redundant — and worse, it would double-fire (two Attio notes + two Telegram pings) for every funnel valuation.This removes the browser ping so a funnel valuation captures exactly one lead, from the shared api. Closes the de-dupe half of the "Valuation lead-capture + Telegram parity" item in recoupable/chat#1885.
Removed
captureRunLead(...)call inhooks/useCatalogValuation.ts(and the now-unuseduserfromusePrivy).lib/valuation/captureRunLead.ts,lib/valuation/captureValuationLead.ts.app/api/valuation/leadroute + its Attio/Telegram helpers:upsertValuationLead,leadAttributes,leadNoteContent,valuationLeadInput.lib/attio/*(the valuation-lead-only Attio primitives),lib/telegram.ts,lib/format/usd.ts— each confirmed used only by the lead chain.23 files deleted; no dangling imports (
Running TypeScriptpasses inpnpm build).Kept (deliberately)
lib/attio.ts— the separate subscribe/CRMcreateAttioContactintegration (used byapp/api/subscribe), unrelated to valuation leads.lib/valuation/formatUsd.ts,formatCompact.ts,runValuation.ts,toArtist.ts.Verification
lib/valuationtests green (6 tests).pnpm build: ✓ Compiled successfully + TypeScript pass. Full static export needs a realNEXT_PUBLIC_PRIVY_APP_ID(a placeholder trips Privy's ID validation prerendering/advisory/book) — a known local-export limitation; the Vercel preview completes the build.ATTIO_API_KEYis set on the api project — results to follow in a comment.Merge order
Merge api#785 first, then this, back-to-back. The brief window between them (funnel valuations double-firing) is cosmetic — one extra Attio note + one extra ping.
🤖 Generated with Claude Code
Summary by cubic
Remove the legacy client-side valuation lead-capture ping and the
/api/valuation/leadroute now that capture runs server-side inPOST /api/valuation(recoupable/api#785). Prevents duplicate Attio notes and Telegram alerts so each funnel valuation captures exactly one lead; merge after recoupable/api#785 (chat#1885).Bug Fixes
Refactors
captureRunLeadcall and unuseduserfromuseCatalogValuation./api/valuation/leadchain and helpers:lib/valuation/*,lib/attio/*,lib/telegram,lib/format/usd; keptlib/attio.ts(subscribe/CRM) and valuation display helpers. Also removed a straypr24-option-b-valuation-54M.pngscreenshot.Written for commit 0927c4b. Summary will update on new commits.
Summary by CodeRabbit
Changes
Tests