54 lines
1.7 KiB
Markdown
54 lines
1.7 KiB
Markdown
|
|
# T755 — product delete pauses watches
|
|||
|
|
|
|||
|
|
> Status: `done`
|
|||
|
|
> Milestone: `M5` · Phase C
|
|||
|
|
> Kind: `feat` · Est. change: `~180 lines`
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
刪除 Product 前冪等暫停相關 active watch,保留歷史並在部分失敗時拒絕回成功。
|
|||
|
|
|
|||
|
|
## Depends on
|
|||
|
|
|
|||
|
|
- T730、T750
|
|||
|
|
|
|||
|
|
## Inputs
|
|||
|
|
|
|||
|
|
- Scout RemoveProduct logic/repository
|
|||
|
|
- RadarWatch guarded pause repository
|
|||
|
|
- `../spec.md` §3.5、§4.1、驗收 #9
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/backend/internal/module/scout/usecase/service.go` | edit | `RemoveProduct` 在 delete 前呼叫 radar lifecycle port |
|
|||
|
|
| `apps/backend/internal/logic/scout/remove_product_logic.go` | edit | 保持既有路由與誠實錯誤回應 |
|
|||
|
|
| `apps/backend/internal/module/radar/usecase/product_lifecycle.go` | add | count/pause active watches、notification payload |
|
|||
|
|
| service wiring | edit | 以小介面接兩個 module,不反向耦合 repository |
|
|||
|
|
| lifecycle tests | add | zero/many/retry/partial failure/history |
|
|||
|
|
|
|||
|
|
## Behavior
|
|||
|
|
|
|||
|
|
- 先 pause 成功才 delete;重試不重複通知或破壞 archived watch。
|
|||
|
|
- 失敗不回刪除成功;已暫停但產品尚在是安全可重試狀態。
|
|||
|
|
- 不自動改綁;舊 Opportunity/Contact/Outcome 不刪。
|
|||
|
|
|
|||
|
|
## Out of scope
|
|||
|
|
|
|||
|
|
- Brand 刪除規則改寫
|
|||
|
|
- 前端提示(T713/T761)
|
|||
|
|
|
|||
|
|
## Acceptance
|
|||
|
|
|
|||
|
|
- [x] spec #9 integration case 通過。
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd apps/backend && go test ./internal/module/scout/... ./internal/module/radar/... -count=1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Implementation result (2026-08-10): Scout product deletion now calls a narrow
|
|||
|
|
Radar lifecycle port first; active product watches are idempotently paused with
|
|||
|
|
`product_unavailable`, archived history is untouched, and any pause failure
|
|||
|
|
blocks deletion so retry remains safe.
|