feat(welfare): 首页可见活跃信号定名 event=show + page=home(替换 home_view 占位)

前端确定"首页可见"埋点为 event=show + page=home(组合,非单一 event 名),故活跃口径
不能只改一个常量:

- activity.active_event_condition():首页可见(event=show & page=home)∪ 比价 ∪ 领券,
  worker 子查询(last_active_subqueries)与 admin _attach_last_active 共用(单一真源);
  ACTIVE_EVENTS 收窄为仅两个纯 event 名,HOME_VIEW_EVENT="show" + 新增 HOME_VIEW_PAGE="home"
- 测试:新增 show/home 算活跃、show/其他页不算的用例;_add_event 支持 page;口径常量断言更新
- seed 脚本 / spec / plan 同步 home_view → show+page=home

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
guke
2026-07-18 18:04:29 +08:00
parent 69a79f9852
commit b4fe20aaca
6 changed files with 64 additions and 19 deletions
+2 -2
View File
@@ -86,8 +86,8 @@ def seed(db) -> None:
acc.coin_balance, acc.cash_balance_cents, acc.invite_cash_balance_cents = coin, cash, invite
acc.total_coin_earned = coin
if ev_days is not None:
db.add(AnalyticsEvent(
event="home_view", device_id=MARK, user_id=u.id,
db.add(AnalyticsEvent( # 首页可见 = event=show + page=home
event="show", page="home", device_id=MARK, user_id=u.id,
client_ts=0, created_at=now - timedelta(days=ev_days),
))
db.flush()