thread-master/docs/product/haixun-backend/tasks/T150-usage-events-summary-b...

63 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2026-07-10 12:54:45 +00:00
# T150 — usage-events-summary-byok-schema
> Status: `todo`
> Milestone: `M3`
> Kind: `feat`
> Est. change: `~180 lines` (target 100200)
## Goal
完成後系統應UsageEvent 含 key_modeSummary platform 點數與 byok 次數分欄
## Depends on
- T110
## Inputs
- 讀取 / 依賴:
- spec §4.7 USG-01 USG-0508
- Spec`docs/product/haixun-backend/spec.md`§9USG-01 USG-05 USG-06 USG-07 USG-08
- 對照:`docs/product/haixun-backend/fe-spec-alignment.md`**UI MUST**
- 後端根:**`apps/backend`**
- **Remove本 task 禁止實作):** 舊靈感 list/viral/bookmark/spark/searchTrendsgenerateFromFormulaScoutTopic CRUDlive 以 simulatecreateMock 當完成Insights 真管線P2
## Outputs
### 程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/backend/internal/**/usage/**` | add | models + getSummary + listEvents filter |
### 行為變更
- 禁止唯一 total_calls 混加 platform+byok
### API / 契約(若有)
-
### 測試交付(強制)
- `TestUSG_08_NoMergedTotalOnly`
## Out of scope
- meter 接入T151
## Acceptance
- [ ] SpecUI MUST 覆蓋:`USG-01 USG-05 USG-06 USG-07 USG-08`
- [ ] 每個相關 §9 ID 有可 grep 的 case 名(`TestXX_01_…` 或完整覆蓋在里程碑 test task
- [ ] 未實作不回 102000+空 data
- [ ] 指令:
```bash
cd apps/backend && go test ./internal/.../usage/... -count=1
```
## Notes