thread-master/docs/product/scout-topic-quality/tasks/T043-eligible-target-search.md

58 lines
1.8 KiB
Markdown
Raw Normal View History

2026-08-13 02:22:24 +00:00
# T043 — 合格數驅動的分階段補量
> Status: `done`
> Milestone: `M4`
> Est. change: `~200 lines`
## Goal
完成後RunScan 以 eligible count 判斷 target按三階段有限補量且不會 raw hits 達標就提前停止。
## Depends on
- T042
## Inputs
- 讀取 / 依賴:
- 檔案:`apps/backend/internal/module/scout/usecase/service.go`
- 既有能力 / APIfanOutSearch、Provider、Crawler、Candidate evaluator
- Spec 段落§4 流程 B、§7 效能邊界
## Outputs
### 程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/backend/internal/module/scout/usecase/search_pipeline.go` | add | 實作 initial、same-source boost、secondary source 三階段 orchestration。 |
| `apps/backend/internal/module/scout/usecase/service.go` | edit | RunScanFromBrief 改呼叫 pipeline以 eligible target 停止。 |
| `apps/backend/internal/module/scout/usecase/search_pipeline_test.go` | add | 驗證 raw20/eligible7 仍補抓、達標停止與 320 cap。 |
### 行為變更
- 每輪立即 normalize/dedupe/evaluate單詞單來源單階段最多 20整批最多 320 raw。
### API / 契約(若有)
- 單來源失敗可降級並記原因;全部來源失敗回 error。
## Out of scope
- 不新增搜尋來源,不降低 signature 門檻,不無限 retry。
## Acceptance
- [x] 目標只由 eligible count 達成source 呼叫次數符合階段與上限。
- [x] 指令:
```bash
cd apps/backend && go test ./internal/module/scout/usecase -run SearchPipeline -count=1
```
驗收結果:新增三階段 SearchPipeline逐候選即時判定 eligibleduplicateirrelevanttarget 以 eligible 計算,單詞上限 20、整批 raw cap 320補量與停止條件測試通過。
## Notes
pipeline 回傳合格 draft 與 diagnostics保存由 T044 負責。