51 lines
1.5 KiB
Markdown
51 lines
1.5 KiB
Markdown
|
|
# T745 — fit stale concurrency tests
|
|||
|
|
|
|||
|
|
> Status: `done`
|
|||
|
|
> Milestone: `M4` · Phase C
|
|||
|
|
> Kind: `test` · Est. change: `~190 lines`
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
鎖定 stale 保存、產品更新快照、純同名排除與並行 merge 的端到端 domain 行為。
|
|||
|
|
|
|||
|
|
## Depends on
|
|||
|
|
|
|||
|
|
- T742、T743、T744
|
|||
|
|
|
|||
|
|
## Inputs
|
|||
|
|
|
|||
|
|
- `../spec.md` 驗收 #2–#8、#12
|
|||
|
|
- 代表性 CandidatePost 與 Product fixtures
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/backend/internal/module/radar/usecase/product_fit_integration_test.go` | add | scorer→merge→primary cases |
|
|||
|
|
| `apps/backend/internal/module/radar/repository/product_match_race_test.go` | add | concurrent same/different product merge |
|
|||
|
|
|
|||
|
|
## Behavior
|
|||
|
|
|
|||
|
|
- 20 天貼文 rejected/stale 但 match reasons 完整保存。
|
|||
|
|
- Product 更新不重寫同 Opportunity 舊 match。
|
|||
|
|
- race 結果無 duplicate,人工 primary 保留。
|
|||
|
|
|
|||
|
|
## Out of scope
|
|||
|
|
|
|||
|
|
- HTTP 與前端
|
|||
|
|
- 真平台抓取
|
|||
|
|
|
|||
|
|
## Acceptance
|
|||
|
|
|
|||
|
|
- [x] 具名覆蓋 stale/snapshot/same-product/override/並行 merge;普通測試通過。
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd apps/backend && go test ./internal/module/radar/... -race -count=1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Implementation result (2026-08-10): added stale-candidate evidence retention,
|
|||
|
|
immutable product snapshot, and concurrent same/different-product merge tests;
|
|||
|
|
the memory repository keeps one match per product and preserves human primary
|
|||
|
|
overrides. The requested race command was attempted, but this environment has
|
|||
|
|
CGO enabled without a `gcc` compiler, so the race binary cannot be built here.
|