47 lines
1.2 KiB
Markdown
47 lines
1.2 KiB
Markdown
|
|
# T774 — product match race metering regression
|
|||
|
|
|
|||
|
|
> Status: `todo`
|
|||
|
|
> Milestone: `M7` · Phase D
|
|||
|
|
> Kind: `test` · Est. change: `~190 lines`
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
證明多 worker/重試不重複 ProductMatch 或 AI 計費,Sweep counters 與實際資料可對帳。
|
|||
|
|
|
|||
|
|
## Depends on
|
|||
|
|
|
|||
|
|
- T770–T773
|
|||
|
|
|
|||
|
|
## Inputs
|
|||
|
|
|
|||
|
|
- radar worker/sweep/repository/usage fake harness
|
|||
|
|
- `../spec.md` §4.2、§5.5、§8、驗收 #12
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/backend/internal/module/radar/usecase/product_race_meter_test.go` | add | same/different product worker race、retry |
|
|||
|
|
| `apps/backend/internal/module/radar/usecase/sweep_counter_test.go` | edit/add | evaluated/merged/rejected/truncated reconciliation |
|
|||
|
|
| usage integration tests | edit | `radar.product_fit` exactly-once semantics |
|
|||
|
|
|
|||
|
|
## Behavior
|
|||
|
|
|
|||
|
|
- 同 `(opportunity, product)` 最多一次適配計費。
|
|||
|
|
- 不同 Product 可各計一次但仍一 Opportunity。
|
|||
|
|
- job guarded update、Redis lock value=workerID 規則不變。
|
|||
|
|
|
|||
|
|
## Out of scope
|
|||
|
|
|
|||
|
|
- 真 AI/Threads 網路壓測
|
|||
|
|
- 新 usage meter
|
|||
|
|
|
|||
|
|
## Acceptance
|
|||
|
|
|
|||
|
|
- [ ] race detector 綠,資料筆數/counter/usage records 對帳。
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd apps/backend && go test ./internal/module/radar/... ./internal/module/usage/... -race -count=1
|
|||
|
|
```
|
|||
|
|
|