SearchAdd Detail Overview

快速結論

search_add 的 migration 對照要分段看,不要用單一 response 判斷全部流程是否一致。

同步主線:

  1. request normalize
  2. actor resolution / signup
  3. pre-create guards
  4. request create
  5. request-side writers
  6. auto quote / narrow match
  7. bid finalize
  8. special flows
  9. reload result
  10. response

async / downstream:

  • newQuoteRequest
  • task_event_queue
  • event queue / notification
  • downstream request close / call / archive 類流程

新舊程式對應

主題Legacy PHP 5.6Current PHP 8.2Detail
request normalizationQuoteRequestsController::search_add() raw request handlingSearchAddRequestNormalizer / SearchAddInput01_request_normalization.md
actor resolutionQuoteRequestsController::search_add() login / signup branchesActorResolver / CredentialActorResolver / AutoSignupService02_actor_resolution.md
pre-create guardsQuoteRequestsController::search_add() early return guardsCategoryQuery / FormCategoryValidator / guards03_pre_create_guards.md
request createQuoteRequestsController::search_add() 建單區段QuoteRequestCreator::create()04_request_create.md
request side writersQuoteRequestsController::search_add() request-side writeswriter classes under Lib/SearchAdd05_request_side_writers.md
auto quote matchQuoteService::_handleAutoQuoteMatch()AutoQuoteDispatcher::dispatch() / AutoQuoteMatcher::match()06_auto_quote_match.md
auto quote filtersQuoteService::_handleAutoQuoteMatch() filters / narrow additionalAutoQuoteMatcher / NarrowMatchBuilder filter helpers06_auto_quote_filters.md
bid finalizeQuoteService::handleAutoQuote()QuoteBidFinalizer / BidPricingResolver07_bid_finalize.md
special flowsQuoteRequestsController::search_add() special branchesSpecialFlowDispatcher + processors08_special_flows.md
async fallbackscheckR1ManualMatchStartNoAutoQuote() / _handleNewQuoteRequest()QuoteRequest::checkR1ManualMatchStartNoAutoQuote() / NewQuoteRequestHandler09_async_fallbacks.md
response contractQuoteRequestsController::search_add() responseSearchAddResult + Endpoint/V1/SearchAdd.php10_response_contract.md

完整狀態表仍以 legacy_alignment.mdlegacy_alignment_map.md 為準。

行號對照

new 行號對應 legacy職責
Endpoint/V1/SearchAdd.php:52-117QuoteRequestsController.php:1805-3405endpoint 入口、handler 執行、response 輸出。
SearchAddHandler.php:137-155QuoteRequestsController.php:1863-1911category / form validation early return。
SearchAddHandler.php:157-193QuoteRequestsController.php:1999-2333actor resolution、credential login、auto signup。
SearchAddHandler.php:195-214QuoteRequestsController.php:2336-2437建單前風控與 same-category service conflict。
SearchAddHandler.php:216-218QuoteRequestsController.php:2455-2638建立 quote_requests 主表。
SearchAddHandler.php:220-287QuoteRequestsController.php:2639-3219request-side writers 與 abnormal scan。
SearchAddHandler.php:289-304QuoteRequestsController.php:3222-3337special pre-flow。
SearchAddHandler.php:306-315QuoteService.php:2557-3185auto quote / narrow match。
SearchAddHandler.php:317-320QuoteService.php:1567-1956bid finalize。
SearchAddHandler.php:322-336QuoteRequestsController.php:3278-3310special post-flow。
SearchAddHandler.php:338-350QuoteRequest.php:2199-2237reload request、second-link / R1 fallback。
SearchAddHandler.php:353QuoteRequestsController.php:3389-3405success response。

不可改變的契約

  • search_add 成功 response 只代表同步主線完成。
  • manual / related fallback 不保證已反映在當次 QuoteBid response。
  • 新舊比對先看 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 的 待確認 / 風險,再決定補程式或補測試。