Retention matrix drops cohorts where nobody did the return event

未关闭
#656 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@officialasishkumar 已经在做这个了。

开始于 2026年11月7日。

  • #659 来自 @officialasishkumar —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
sql, typescript

调研方向

Start by reading packages/core/src/modules/chart/src/retention.sql.ts, especially retentionCohortQuery, and trace how cohorts and return events feed the matrix and Weighted Average. Check the tests for the retention query and its MCP and API consumers. Done means cohorts with no return events still appear with zero values and their users are included in the Weighted Average; an open linked pull request indicates work is already underway.

由索引模型根据 Issue 内容生成。

描述

Description

In a retention report, a cohort none of whose users ever did the return event has no row in the matrix. With different start and return events (for example app_open, then purchase), those periods are missing from the table. Their users are also left out of the Weighted Average, which pools only cohorts with at least one return, so retention is overstated. When nobody has done the return event yet, the whole report looks like it has no data.

The MCP and API retention endpoints read the same query, so they have the same gap.

Steps to reproduce

  1. Create a retention report with start event app_open and return event purchase, interval Day.
  2. Pick a range where users who opened the app on one day never purchased.
  3. That day is missing from the matrix, and the Weighted Average divides only by the other cohorts.

Root cause

retentionCohortQuery (packages/core/src/modules/chart/src/retention.sql.ts) selects FROM interval_users LEFT JOIN cohort_sizes. interval_users is built from the inner join of cohort members with their return events, so a cohort with no returning user has no row there and drops out of the result.

Expected behavior

Every cohort appears with its size and zeros for the periods where nobody returned, and the Weighted Average includes those users.

主要语言
TypeScript
星标
7.3k
派生
539
平均合并
1 天 20 小时
30 天内合并 PR
80

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Openpanel-dev/openpanel 的其他 Issue

查看 Openpanel-dev/openpanel 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。