feat(report): close v2 headline and coverage gaps
This commit is contained in:
143
docs/plans/2026-05-14-daily-report-v2-closeout-plan.md
Normal file
143
docs/plans/2026-05-14-daily-report-v2-closeout-plan.md
Normal file
@@ -0,0 +1,143 @@
|
||||
# Daily Report V2 Closeout Implementation Plan
|
||||
|
||||
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
|
||||
|
||||
**Goal:** 补齐日报 V2 情报版剩余 3 个收口项,让事件流覆盖营销活动、头条显式展示影响对象,并新增可重复执行的历史日报事件覆盖率验收脚本。
|
||||
|
||||
**Architecture:** 继续复用 `scripts/generate_daily_report.go` 作为唯一日报语义层入口,不改数据库结构。`promo_campaign` 先以最小本地活动源接入,再复用现有 `ModelEvent -> HeadlineItem` 链路;头条影响对象通过扩展 `HeadlineItem` 数据结构和模板完成;覆盖率验收通过单独脚本直接查询数据库并调用现有历史重建入口完成。
|
||||
|
||||
**Tech Stack:** Go 1.22、html/template、PostgreSQL、Bash
|
||||
|
||||
---
|
||||
|
||||
### Task 1: 为 V2 收口项补失败测试
|
||||
|
||||
**Files:**
|
||||
- Modify: `scripts/generate_daily_report_test.go`
|
||||
|
||||
**Step 1: 写失败测试**
|
||||
|
||||
补 3 组测试:
|
||||
- `promo_campaign` 头条测试:验证会生成 `活动/营销` 类型头条,并保留来源、证据、基线
|
||||
- 头条影响对象测试:验证 `HeadlineItem` 有 `Audience`,HTML/Markdown 都会渲染
|
||||
- 覆盖率汇总测试:如果批量验收逻辑抽成辅助函数,则为通过率计算补单测
|
||||
|
||||
**Step 2: 运行失败测试**
|
||||
|
||||
Run: `go test -tags llm_script scripts/generate_daily_report.go scripts/generate_daily_report_test.go`
|
||||
|
||||
Expected:
|
||||
- 新增断言失败
|
||||
- 失败原因是缺少 `promo_campaign` / `Audience` 相关实现
|
||||
|
||||
**Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add scripts/generate_daily_report_test.go
|
||||
git commit -m "test(report): cover v2 closeout requirements"
|
||||
```
|
||||
|
||||
### Task 2: 接入 promo_campaign 事件流并渲染头条影响对象
|
||||
|
||||
**Files:**
|
||||
- Modify: `scripts/generate_daily_report.go`
|
||||
- Modify: `scripts/generate_daily_report_test.go`
|
||||
|
||||
**Step 1: 最小实现 promo 活动源**
|
||||
|
||||
在 `scripts/generate_daily_report.go` 中新增本地活动源定义,至少包含:
|
||||
- 活动日期
|
||||
- 模型名或匹配键
|
||||
- 标题 / 摘要
|
||||
- 主来源
|
||||
- 证据说明
|
||||
- 影响对象
|
||||
- 优先级
|
||||
|
||||
首批只接入最小样本,够覆盖 V2 能力:
|
||||
- `DeepSeek` 价格活动或发布期活动
|
||||
- 允许未来继续追加
|
||||
|
||||
**Step 2: 把活动源并入事件流**
|
||||
|
||||
在 `loadModelEvents` 中新增:
|
||||
- `loadPromoCampaignEvents(date string)` 或等价辅助函数
|
||||
- 统一走 `ModelEvent`
|
||||
- `EventType = "promo_campaign"`
|
||||
|
||||
**Step 3: 扩 HeadlineItem 影响对象**
|
||||
|
||||
新增:
|
||||
- `HeadlineItem.Audience`
|
||||
- `ModelEvent.Audience`
|
||||
|
||||
并在:
|
||||
- `headlineItemFromModelEvent`
|
||||
- Markdown 头条输出
|
||||
- HTML 头条卡输出
|
||||
|
||||
中渲染“影响对象”。
|
||||
|
||||
**Step 4: 重新运行测试**
|
||||
|
||||
Run: `go test -tags llm_script scripts/generate_daily_report.go scripts/generate_daily_report_test.go`
|
||||
|
||||
Expected:
|
||||
- `promo_campaign`、`Audience` 相关测试通过
|
||||
|
||||
**Step 5: Commit**
|
||||
|
||||
```bash
|
||||
git add scripts/generate_daily_report.go scripts/generate_daily_report_test.go
|
||||
git commit -m "feat(report): close v2 event and audience gaps"
|
||||
```
|
||||
|
||||
### Task 3: 新增 V2 历史日报事件覆盖率验收脚本
|
||||
|
||||
**Files:**
|
||||
- Create: `scripts/verify_v2_event_coverage.sh`
|
||||
- Create or Modify: `scripts/report_event_coverage.go`
|
||||
- Modify: `scripts/generate_daily_report_test.go` 或新增脚本测试文件(仅在有价值时)
|
||||
|
||||
**Step 1: 实现覆盖率统计脚本**
|
||||
|
||||
目标:
|
||||
- 输入日期范围
|
||||
- 统计每个日期是否命中真正变化事件
|
||||
- 统计命中率
|
||||
- 失败阈值:小于 80%
|
||||
|
||||
“真正变化事件”至少包括:
|
||||
- `official_release`
|
||||
- `promo_campaign`
|
||||
- `new_model`
|
||||
- `price_cut`
|
||||
- `price_increase`
|
||||
|
||||
**Step 2: 使用历史日报入口做一次真实验收**
|
||||
|
||||
Run:
|
||||
- `bash scripts/verify_v2_event_coverage.sh 2024-06-01 2026-05-14`
|
||||
|
||||
Expected:
|
||||
- 输出总天数、命中天数、覆盖率
|
||||
- 覆盖率满足或明确暴露当前缺口
|
||||
|
||||
**Step 3: 运行全量验证**
|
||||
|
||||
Run:
|
||||
- `go test ./...`
|
||||
- `go run -tags llm_script scripts/generate_daily_report.go --date=2025-08-07`
|
||||
- `bash scripts/verify_v2_event_coverage.sh 2024-06-01 2026-05-14`
|
||||
|
||||
Expected:
|
||||
- Go 测试通过
|
||||
- 历史日报仍可生成
|
||||
- 覆盖率脚本输出稳定
|
||||
|
||||
**Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add scripts/verify_v2_event_coverage.sh scripts/report_event_coverage.go scripts/generate_daily_report.go scripts/generate_daily_report_test.go
|
||||
git commit -m "feat(report): add v2 event coverage verification"
|
||||
```
|
||||
Reference in New Issue
Block a user