SearchAdd Detail Overview
快速結論
search_add 的 migration 對照要分段看,不要用單一 response 判斷全部流程是否一致。
同步主線:
- request normalize
- actor resolution / signup
- pre-create guards
- request create
- request-side writers
- auto quote / narrow match
- bid finalize
- special flows
- reload result
- response
async / downstream:
newQuoteRequesttask_event_queue- event queue / notification
- downstream request close / call / archive 類流程
新舊程式對應
| 主題 | Legacy PHP 5.6 | Current PHP 8.2 | Detail |
|---|---|---|---|
| request normalization | QuoteRequestsController::search_add() raw request handling | SearchAddRequestNormalizer / SearchAddInput | 01_request_normalization.md |
| actor resolution | QuoteRequestsController::search_add() login / signup branches | ActorResolver / CredentialActorResolver / AutoSignupService | 02_actor_resolution.md |
| pre-create guards | QuoteRequestsController::search_add() early return guards | CategoryQuery / FormCategoryValidator / guards | 03_pre_create_guards.md |
| request create | QuoteRequestsController::search_add() 建單區段 | QuoteRequestCreator::create() | 04_request_create.md |
| request side writers | QuoteRequestsController::search_add() request-side writes | writer classes under Lib/SearchAdd | 05_request_side_writers.md |
| auto quote match | QuoteService::_handleAutoQuoteMatch() | AutoQuoteDispatcher::dispatch() / AutoQuoteMatcher::match() | 06_auto_quote_match.md |
| auto quote filters | QuoteService::_handleAutoQuoteMatch() filters / narrow additional | AutoQuoteMatcher / NarrowMatchBuilder filter helpers | 06_auto_quote_filters.md |
| bid finalize | QuoteService::handleAutoQuote() | QuoteBidFinalizer / BidPricingResolver | 07_bid_finalize.md |
| special flows | QuoteRequestsController::search_add() special branches | SpecialFlowDispatcher + processors | 08_special_flows.md |
| async fallbacks | checkR1ManualMatchStartNoAutoQuote() / _handleNewQuoteRequest() | QuoteRequest::checkR1ManualMatchStartNoAutoQuote() / NewQuoteRequestHandler | 09_async_fallbacks.md |
| response contract | QuoteRequestsController::search_add() response | SearchAddResult + Endpoint/V1/SearchAdd.php | 10_response_contract.md |
完整狀態表仍以 legacy_alignment.md 和 legacy_alignment_map.md 為準。
行號對照
| new 行號 | 對應 legacy | 職責 |
|---|---|---|
Endpoint/V1/SearchAdd.php:52-117 | QuoteRequestsController.php:1805-3405 | endpoint 入口、handler 執行、response 輸出。 |
SearchAddHandler.php:137-155 | QuoteRequestsController.php:1863-1911 | category / form validation early return。 |
SearchAddHandler.php:157-193 | QuoteRequestsController.php:1999-2333 | actor resolution、credential login、auto signup。 |
SearchAddHandler.php:195-214 | QuoteRequestsController.php:2336-2437 | 建單前風控與 same-category service conflict。 |
SearchAddHandler.php:216-218 | QuoteRequestsController.php:2455-2638 | 建立 quote_requests 主表。 |
SearchAddHandler.php:220-287 | QuoteRequestsController.php:2639-3219 | request-side writers 與 abnormal scan。 |
SearchAddHandler.php:289-304 | QuoteRequestsController.php:3222-3337 | special pre-flow。 |
SearchAddHandler.php:306-315 | QuoteService.php:2557-3185 | auto quote / narrow match。 |
SearchAddHandler.php:317-320 | QuoteService.php:1567-1956 | bid finalize。 |
SearchAddHandler.php:322-336 | QuoteRequestsController.php:3278-3310 | special post-flow。 |
SearchAddHandler.php:338-350 | QuoteRequest.php:2199-2237 | reload request、second-link / R1 fallback。 |
SearchAddHandler.php:353 | QuoteRequestsController.php:3389-3405 | success response。 |
不可改變的契約
search_add成功 response 只代表同步主線完成。- manual / related fallback 不保證已反映在當次
QuoteBidresponse。 - 新舊比對先看 request materialization,再看 bid,再看 async / downstream。
- downstream notification 要查 queue 與 log,不可只查原 queue table。
待確認 / 風險
- 目前 11 個 detail topic 都已有 legacy / current 行號對照;
06_auto_quote_filters.md已先拆出 auto quote filter / narrow 補位第二層。 06_auto_quote_filters.md已補 travel preference、job preference、additional narrow helper-level 行號;related category 二次補位已在 current 補齊並由SearchAddStep5IntegrationTest覆蓋。- 若後續補行號時發現 legacy 與 current 不一致,應回填到對應 detail 的
待確認 / 風險,再決定補程式或補測試。