thread-master/docs/product/demand-radar/tasks/T590-usage-radar-source-agg...

51 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# T590 — usage-radar-source-aggregation
> Status: `done`
> Milestone: `M5`
> Kind: `feat`
> Est. change: `~140 lines`
## Goal
完成後系統應:用量頁可依 `radar.` source 前綴聚出雷達耗用,供 P1 價格校準。
## Depends on
- T531
## Inputs
- Spec`../spec.md` §5.5、§9.5QT-03
- 既有:`apps/backend/internal/logic/usage/**`、`apps/web/src/pages/UsagePage.tsx`、`src/data/live/usageMapping.test.ts`
## Outputs
### 程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/backend/internal/logic/usage/**` | edit | 用量查詢支援 `source` 前綴分組(不新增 meter |
| `apps/backend/generate/api/usage.api` | edit | resp 增加 source 分組區塊 |
| `apps/web/src/pages/UsagePage.tsx` | edit | 顯示「雷達耗用」區塊sweepjudgereplyfollowupsuggest 分項) |
### 行為變更
- 聚合只是既有紀錄的分組呈現,**不改扣點邏輯、不新增 meter**RG-04
- 無 radar 用量時不顯示空區塊。
## Out of scope
- 調整方案價格P1
- 成本告警(不在本輪)
## Acceptance
- [x] QT-03用量頁可看出 `radar.*` 五種 source 的耗用
- [x] RG-04`soft_caps` 四分項加總仍等於 `monthly_credits`
- [x] 指令:
```bash
cd apps/backend && go test ./internal/logic/usage/... -count=1
cd apps/web && npm run test && npm run build
```