58 lines
1.8 KiB
Markdown
58 lines
1.8 KiB
Markdown
|
|
# T041 — 候選判定與品質計數
|
|||
|
|
|
|||
|
|
> Status: `done`
|
|||
|
|
> Milestone: `M4`
|
|||
|
|
> Est. change: `~190 lines`
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
完成後,每個 raw candidate 都只經一條可測管線產生 eligible/duplicate/irrelevant 等判定與 match reason。
|
|||
|
|
|
|||
|
|
## Depends on
|
|||
|
|
|
|||
|
|
- T040
|
|||
|
|
|
|||
|
|
## Inputs
|
|||
|
|
|
|||
|
|
- 讀取 / 依賴:
|
|||
|
|
- 檔案:`apps/backend/internal/module/scout/usecase/service.go`、`planner.go`
|
|||
|
|
- 既有能力 / API:canonicalPermalink、classifyPost、stale rules、TopicSignature
|
|||
|
|
- Spec 段落:§4 流程 B/C、§2.1
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
### 程式變更(預期路徑)
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/backend/internal/module/scout/usecase/candidate.go` | add | 定義 evaluator、decision reason 與 run counters accumulator。 |
|
|||
|
|
| `apps/backend/internal/module/scout/usecase/service.go` | edit | persist 前改用 evaluator,移除重複散落的 eligibility 判定。 |
|
|||
|
|
| `apps/backend/internal/module/scout/usecase/candidate_test.go` | add | 覆蓋 URL、空文、stale、signature、classification 與 reason。 |
|
|||
|
|
|
|||
|
|
### 行為變更
|
|||
|
|
|
|||
|
|
- score/track 只能補充 reason 與排序權重,不得繞過 topic signature。
|
|||
|
|
|
|||
|
|
### API / 契約(若有)
|
|||
|
|
|
|||
|
|
- searched/duplicate/irrelevant/eligible 的計數定義固定且互斥可解釋。
|
|||
|
|
|
|||
|
|
## Out of scope
|
|||
|
|
|
|||
|
|
- 不做歷史 identity 查詢或多輪補量。
|
|||
|
|
|
|||
|
|
## Acceptance
|
|||
|
|
|
|||
|
|
- [x] 每個 candidate 有唯一終局 decision,eligible reason 含核心命中。
|
|||
|
|
- [x] 指令:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd apps/backend && go test ./internal/module/scout/usecase -run Candidate -count=1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
驗收結果:CandidateEvaluator 統一 canonical URL/時效/TopicSignature/分類 gate,產生 eligible、duplicate、irrelevant 與可解釋 reason;既有 product/provider/demand/activity 回歸通過。
|
|||
|
|
|
|||
|
|
## Notes
|
|||
|
|
|
|||
|
|
provider/demand 模式既有分類行為必須回歸,不因 activity 改造被放寬。
|