Lead Funnel 与 Task
Status boundary:Funnel 与 Task lifecycle 分离已经进入 Task V3 selected Target;这不表示 projection 已在目标环境部署或通过验收。
当前 contract 见 Task V3 Product / Domain Contract,实施与环境状态见 Task V3 Rollout 状态快照。Task V2+ 工程审计与设计建议 只保留为 historical context。
1. 三个维度不要再混
关键规则:
leadStatus不是 Task status。- Task
open/closed不是客户的完整历史。 - Funnel stage 不能拿来表示员工是否开始处理。
- MVP 不新建 Journey/Milestone/provider system;它从当前真实 evidence 做 projection。
2. Current contacts.leadStatus
Source:callytics-infrastructure/packages/common/src/db/schema/contacts.ts。
当前它是 AI 可写的 mutable text snapshot,schema 注释列出:
它适合 Contact/Lead UI 的当前 label 和 compatibility filter,不适合单独承担 Funnel counting 或权威 customer history。
3. Current Funnel 的真实输入
Current /v3/leads/funnel 已经综合:
leads:Email Lead intake。tasks:Task V2 type/Outcome。calls与messages:RingCentral communication。contact_timeline:Task Activity 和事件。
Current implementation source:
callytics-infrastructure/apps/api/src/routes/v3/lead-funnel.tscallytics-infrastructure/apps/api/src/utils/lead-intake-events.tscallytics-infrastructure/apps/api/src/utils/lead-funnel-stage-counts.ts
它不是 authoritative CRM report。Contact snapshot、Task close result 和 communication evidence 的 strength 不同,不能只返回一个 stage 而隐藏来源。
4. Target projection contract
建议的最小 projection(不是强制线性 workflow):
如果未来需要 Showed/Trialed:
- 必须先定义当前可用 evidence。
- 没有 external attendance truth 时只能标 staff/communication/inferred。
- 不因预约时间已经过去就自动推断 attendance。
每个 projection row/aggregate 至少携带:
后续更正 Task Outcome 时,current Funnel projection 更新,但旧判断和 correction 留在 audit trail。
5. Lead Task 如何工作
Target 不再使用 lead_outreach Task → lead_follow_up Task → convert_after_intro Task relay。Backend 只有一个 stable taskKind=lead_conversion;员工仍看到三个可筛选的 current displayType:
booked_not_converted 是兼容性的 UI category;精确进展必须看 businessProgress=intro_booked / intro_attended。Current taxonomy 里的同名 legacy value 实际偏向“已 attended/completed Intro”,migration 不能按名字直接当 booking evidence。
示例:
如果客户在线下预约而系统没有 communication evidence,员工用 staff_confirmed 记录 intro_booked progress;这不需要 Close Task。人工入口是 data boundary 的组成部分,不是失败模式。
Lead follow-up 不一定是推销 Intro:客户可能需要答疑,也可能直接购买 Membership。因此 converted 可以从三种 displayType 中任何一种直接发生;系统不知道 attendance 时也不能凭时间自动猜。Booking 被取消或纠正后,Task 仍 open,并回到 lead_follow_up。
6. Reporting integrity
Attempted来自 Activity,不来自 Task lifecycle。Booked / Converted必须显示 evidence strength;前者是 non-terminal progress,后者是 terminal Outcome。- Task Outcome 可影响 Funnel,但不能反向把 Funnel label 当 closure evidence。
- Revenue 只能写 assisted/attributed/staff-confirmed;没有 authoritative source 时不能写 verified revenue。
- Definition 改变时发布新的
projectionDefinitionVersion,不静默重算历史 dashboard。 - 所有查询强制
store_id;同一手机号在不同 store 的 evidence 不得混用。