# 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` - 既有能力 / API:fanOutSearch、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,逐候選即時判定 eligible/duplicate/irrelevant,target 以 eligible 計算,單詞上限 20、整批 raw cap 320,補量與停止條件測試通過。 ## Notes pipeline 回傳合格 draft 與 diagnostics,保存由 T044 負責。