From 9ada32477ceb175bfa05e71336eeac0e52e3a870 Mon Sep 17 00:00:00 2001 From: OoO Date: Thu, 21 May 2026 16:29:21 +0800 Subject: [PATCH] [V10.379] add market intel MCP runtime promotion gate --- TODO_NEXT_STEPS.txt | 1 + config.py | 2 +- .../code_modularization_inventory_20260430.md | 5 +- docs/memory/history_logs.md | 2 + routes/market_intel_routes.py | 20 + services/market_intel/deployment_readiness.py | 19 + .../market_intel/mcp_runtime_promotion.py | 222 +++++++++++ services/market_intel/phase.py | 2 +- templates/market_intel/disabled.html | 160 +++++++- tests/test_market_intel_skeleton.py | 356 ++++++++++++------ 10 files changed, 665 insertions(+), 124 deletions(-) create mode 100644 services/market_intel/mcp_runtime_promotion.py diff --git a/TODO_NEXT_STEPS.txt b/TODO_NEXT_STEPS.txt index 7370b76..75a2b55 100644 --- a/TODO_NEXT_STEPS.txt +++ b/TODO_NEXT_STEPS.txt @@ -4,6 +4,7 @@ ================================================================================ 【已完成】 + - V10.379 補市場情報 MCP runtime promotion gate:新增 `mcp_runtime_promotion` read-only builder、GET/POST endpoint、UI promotion package 審核面板與 deployment readiness smoke target,將 MCP activation evidence 與 runtime smoke receipt 合併成可審核的 runtime promotion package;API/UI 不保存 payload、不打 health、不開 DB、不抓外站、不掛 scheduler,也不會自動打開人工 fetch gate。 - V10.366 補市場情報 MCP runtime smoke 收據審核:新增 `mcp_runtime_smoke_receipt` read-only builder、GET/POST endpoint、UI receipt JSON 審核面板與 deployment readiness smoke target,讓操作員貼上 `/api/market_intel/mcp_readiness?execute=true&timeout=3` 的實際收據後,判斷 external/internal MCP runtime 是否可升級為已驗收;API/UI 不保存 payload、不打 health、不開 DB、不抓外站、不掛 scheduler,且會阻擋任何 DB write/commit/scheduler/writes 旗標或原始 readiness blocked reasons。 - V10.360 收斂瀏覽器自動開啟與 PChome 熱路徑:`tests/test_image_fetch.py` 改成 `RUN_MOMO_BROWSER_TESTS=1` 才會跑,預設 headless 且關閉 Chrome 密碼管理,避免一般 pytest 自動打開 MOMO 網站與觸發密碼允許提示;scheduler Selenium 同步關閉 password manager/autofill;PChome coverage/review queue 熱查詢改用 `JOIN LATERAL` 取 active 商品最新價,並補 Dashing Diva 品線召回搜尋詞。 - V10.359 導入 Browse.sh 可選爬蟲診斷與強化 MOMO/PChome 色號比對:新增 `BrowseShTool` wrapper、probe CLI 與操作手冊,讓 browse.sh 只作 selector/XHR/network trace 探勘、不進正式 scheduler;matcher 補護甲油/洗手慕斯/足膜精準搜尋詞,保留小數規格,並對唇釉、妝前乳、素顏霜等顯性色號/色系不一致候選做 hard veto,避免同系列不同色號污染正式價差。 diff --git a/config.py b/config.py index 27d6c46..3c03fc0 100644 --- a/config.py +++ b/config.py @@ -325,7 +325,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '') # ========================================== # 系統版本與路徑 # ========================================== -SYSTEM_VERSION = "V10.378" +SYSTEM_VERSION = "V10.379" LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log') public_url = PUBLIC_URL # 用於模板顯示 diff --git a/docs/memory/code_modularization_inventory_20260430.md b/docs/memory/code_modularization_inventory_20260430.md index a711d87..3720015 100644 --- a/docs/memory/code_modularization_inventory_20260430.md +++ b/docs/memory/code_modularization_inventory_20260430.md @@ -36,6 +36,7 @@ - 2026-05-21 追記:同步市場情報 MCP runtime smoke receipt gate 後的 `routes/market_intel_routes.py` 與 `services/market_intel/deployment_readiness.py` 行數;本次 route 只承接既有 Blueprint glue,後續新增 MCP/UI gate 應優先拆出子 Blueprint 或 route registration helper。 - 2026-05-21 追記:同步 111 fallback context/resource guard 合併後的 `services/ollama_service.py` 行數;此處只更新 inventory,不變更 Ollama 路由行為。 - 2026-05-21 追記:同步專業比價分級連動合併後的 `services/competitor_intel_repository.py` 與 `services/nemoton_dispatcher_service.py` 行數;此處只更新 inventory,不變更比價或告警行為。 +- 2026-05-21 追記:同步市場情報 MCP runtime promotion gate 後的 `routes/market_intel_routes.py` 與 `services/market_intel/deployment_readiness.py` 行數;此處只更新 inventory,後續市場情報 MCP route 應拆出子 Blueprint。 - 2026-05-21 追記:同步 PChome/LUDEYA 商品線名稱漂移比對更新後的 `services/marketplace_product_matcher.py` 行數;此處只更新 inventory,不變更模組化決策。 - 2026-05-21 追記:同步 MAC/Yuskin/AHC 名稱漂移與 bundle equivalent matcher 更新後的 `services/marketplace_product_matcher.py` 行數;此處只更新 inventory,不變更模組化決策。 - 2026-05-21 追記:同步 EDM 失效頁 alert guard 與 REJURAN 唇膏寬價差 exact-identity matcher 更新後的 `scheduler.py`、`services/marketplace_product_matcher.py` 行數;此處只更新 inventory,不變更模組化決策。 @@ -78,8 +79,8 @@ | 1327 | `services/competitor_intel_repository.py` | P2 competitor intel repository | review queue query / cache shaping / formatting helpers | | 805 | `routes/bot_api_routes.py` | P2 Bot API Blueprint | route glue / bot action service | | 1319 | `routes/market_intel_review_report_routes.py` | P2 market intel review report Blueprint | review report route glue / export payload / phase handoff orchestration | -| 833 | `routes/market_intel_routes.py` | P2 market intel Blueprint | page route / API route glue / MCP gate route registration helper | -| 912 | `services/market_intel/deployment_readiness.py` | P2 market intel deployment readiness | preflight gates / readiness payload / route contract helpers | +| 853 | `routes/market_intel_routes.py` | P2 market intel Blueprint | page route / API route glue / MCP gate route registration helper | +| 931 | `services/market_intel/deployment_readiness.py` | P2 market intel deployment readiness | preflight gates / readiness payload / route contract helpers | | 846 | `services/market_intel/candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt.py` | P2 market intel review receipt pipeline | AI summary / persistence / Telegram dispatch / report catalog run receipt orchestration | ## 市場情報開發前置禁區 diff --git a/docs/memory/history_logs.md b/docs/memory/history_logs.md index 22dc271..7463959 100644 --- a/docs/memory/history_logs.md +++ b/docs/memory/history_logs.md @@ -13,6 +13,8 @@ ## 📅 詳細更新日誌 (考古存檔) ### 2026-05-21:瀏覽器測試守門與 PChome 熱路徑優化 +- **V10.379 MCP runtime promotion gate**: 新增 `mcp_runtime_promotion` read-only builder、GET/POST endpoint、UI promotion package 審核面板與 deployment readiness smoke target,將 MCP activation evidence 與 runtime smoke receipt 合併審核,讓 completion audit 的 runtime 缺口可由人工收據明確補齊。 +- **V10.379 只讀安全邊界**: 本階段不保存 payload、不打 health、不開 DB、不抓外站、不掛 scheduler,也不會因 promotion 通過自動打開人工 fetch gate;正式 fetch / DB write / scheduler attach 仍需各自獨立 gate。 - **V10.378 AI 推薦頁首屏 Gemini 防漏**: `/ai_recommend` 首屏狀態快照新增 provider sanitization,即使舊 cache / env 內出現 `default_provider='gemini'` 或 `recommended_provider='gemini'`,也會回到 `ollama`,避免 UI 把 Gemini 顯示成主推薦路徑;`/api/ai/set_provider` 同步正規化 provider 輸入,保留 Gemini 只能作 Ollama 失敗備援的拒絕訊息。 - **V10.377 Gemini 主路徑防漏補強**: `AIProviderService._get_recommended_provider()` 不再於 Ollama 不通時推薦 `gemini` 作為主提供者;`llm_model_router` 的 `ea_engine` 即使 caller 傳入 `gemini-2.0-flash` default,也會改回 `hermes3:latest`,需要深推理才升 `deepseek-r1:14b`;`ElephantAlphaOrchestrator` 的 OpenClaw registry / system prompt 改為 Ollama-first,避免 L3 HITL prompt 繼續把 Gemini 當主模型描述。同步補 AI SOT 與防回歸測試。 - **V10.376 Recipe Box 同款防曬漂移比對**: `services/marketplace_product_matcher.py` 對 Recipe Box 多效提亮防曬霜新增 shared identity anchor 加分,當 MOMO 長標含兒童/無毒/天然彩妝等行銷詞、PChome 以「韓兔 多效提亮防曬霜」呈現時仍可判定同款;同步測試鎖住 `shared_identity_anchor_recipe_box_line`,避免平台名稱漂移讓同款價格告警漏報。 diff --git a/routes/market_intel_routes.py b/routes/market_intel_routes.py index 83f5a9f..c1744d8 100644 --- a/routes/market_intel_routes.py +++ b/routes/market_intel_routes.py @@ -19,6 +19,7 @@ from services.market_intel.candidate_queue_writer_run_receipt import build_candi from services.market_intel.candidate_queue_writer_run_closeout import build_candidate_queue_writer_run_closeout from services.market_intel.candidate_queue_review_handoff import build_candidate_queue_review_handoff from services.market_intel.mcp_activation_evidence import build_mcp_activation_evidence_preview +from services.market_intel.mcp_runtime_promotion import build_mcp_runtime_promotion_preview from services.market_intel.mcp_runtime_smoke_receipt import build_mcp_runtime_smoke_receipt_preview @@ -198,6 +199,25 @@ def market_intel_mcp_runtime_smoke_receipt(): ) +@market_intel_bp.route("/api/market_intel/mcp_runtime_promotion", methods=["GET", "POST"]) +@login_required +def market_intel_mcp_runtime_promotion(): + activation_evidence = {} + runtime_receipt = {} + if request.method == "POST": + payload = request.get_json(silent=True) or {} + package = payload.get("promotion_package") or payload + activation_evidence = package.get("activation_evidence", {}) + runtime_receipt = package.get("runtime_receipt", {}) + return jsonify( + build_mcp_runtime_promotion_preview( + activation_evidence=activation_evidence, + runtime_receipt=runtime_receipt, + phase=_service().phase, + ) + ) + + @market_intel_bp.route("/api/market_intel/scheduler_plan") @login_required def market_intel_scheduler_plan(): diff --git a/services/market_intel/deployment_readiness.py b/services/market_intel/deployment_readiness.py index 4e4998b..5c4e7e7 100644 --- a/services/market_intel/deployment_readiness.py +++ b/services/market_intel/deployment_readiness.py @@ -60,6 +60,7 @@ from services.market_intel.candidate_queue_review_ai_summary_persistence_transac from services.market_intel.candidate_queue_review_ai_summary_persistence_writer_preflight import build_candidate_queue_review_ai_summary_persistence_writer_preflight from services.market_intel.candidate_queue_review_ai_summary_run_package import build_candidate_queue_review_ai_summary_run_package from services.market_intel.mcp_activation_evidence import build_mcp_activation_evidence_preview +from services.market_intel.mcp_runtime_promotion import build_mcp_runtime_promotion_preview from services.market_intel.mcp_runtime_smoke_receipt import build_mcp_runtime_smoke_receipt_preview BLOCKED_RUN_REVIEW_KEYS = ( "ready_for_api_database_write", @@ -143,6 +144,11 @@ PRODUCTION_SMOKE_TARGETS = ( + ("/api/market_intel/mcp_runtime_smoke_receipt",) + PRODUCTION_SMOKE_TARGETS[-1:] ) +PRODUCTION_SMOKE_TARGETS = ( + PRODUCTION_SMOKE_TARGETS[:-1] + + ("/api/market_intel/mcp_runtime_promotion",) + + PRODUCTION_SMOKE_TARGETS[-1:] +) def _run_review_preview_safe(payload, mode): return bool(payload["mode"] == mode and all(not payload.get(key) for key in BLOCKED_RUN_REVIEW_KEYS)) def build_deployment_readiness_preview(*, service, market_intel_tables, schema_smoke_builder): @@ -160,6 +166,9 @@ def build_deployment_readiness_preview(*, service, market_intel_tables, schema_s mcp_runtime_smoke_receipt = build_mcp_runtime_smoke_receipt_preview( phase=service.phase, ) + mcp_runtime_promotion = build_mcp_runtime_promotion_preview( + phase=service.phase, + ) scheduler_plan = service.build_scheduler_plan() manual_sample_plan = service.build_manual_sample_plan() manual_sample_acceptance = service.build_manual_sample_acceptance() @@ -402,6 +411,15 @@ def build_deployment_readiness_preview(*, service, market_intel_tables, schema_s and not mcp_runtime_smoke_receipt["api_writes_database"] and not mcp_runtime_smoke_receipt["api_uses_external_network"] ), + "mcp_runtime_promotion_preview_safe": bool( + mcp_runtime_promotion["mode"] == "mcp_runtime_promotion_preview" + and not mcp_runtime_promotion["payload_persisted"] + and not mcp_runtime_promotion["promotion_persisted"] + and not mcp_runtime_promotion["api_executes_health_check"] + and not mcp_runtime_promotion["api_opens_database_connection"] + and not mcp_runtime_promotion["api_writes_database"] + and not mcp_runtime_promotion["api_uses_external_network"] + ), "scheduler_plan_preview_safe": bool( scheduler_plan["mode"] == "scheduler_attach_plan_preview" and not scheduler_plan["scheduler_registration_executed"] @@ -835,6 +853,7 @@ def build_deployment_readiness_preview(*, service, market_intel_tables, schema_s "mcp_completion_audit": mcp_completion_audit, "mcp_activation_evidence": mcp_activation_evidence, "mcp_runtime_smoke_receipt": mcp_runtime_smoke_receipt, + "mcp_runtime_promotion": mcp_runtime_promotion, "scheduler_plan": scheduler_plan, "manual_sample_plan": manual_sample_plan, "manual_sample_acceptance": manual_sample_acceptance, diff --git a/services/market_intel/mcp_runtime_promotion.py b/services/market_intel/mcp_runtime_promotion.py new file mode 100644 index 0000000..cee6236 --- /dev/null +++ b/services/market_intel/mcp_runtime_promotion.py @@ -0,0 +1,222 @@ +"""市場情報 MCP runtime promotion gate preview。 + +本模組只把操作員貼上的 MCP 啟用證據與 runtime smoke 收據合併審核; +不打 health、不開 DB、不保存 payload、不抓外站、不掛 scheduler。 +""" + +from services.market_intel.mcp_activation_evidence import ( + build_mcp_activation_evidence_preview, +) +from services.market_intel.mcp_runtime_smoke_receipt import ( + build_mcp_runtime_smoke_receipt_preview, +) + + +def _sample_promotion_package(): + return { + "activation_evidence": build_mcp_activation_evidence_preview()[ + "sample_evidence_template" + ], + "runtime_receipt": build_mcp_runtime_smoke_receipt_preview()[ + "sample_receipt_template" + ], + } + + +def _none_executed(payload, keys): + return all(not payload.get(key) for key in keys) + + +def build_mcp_runtime_promotion_preview( + *, + activation_evidence=None, + runtime_receipt=None, + phase=None, +): + """審核 MCP runtime promotion package;不執行任何 runtime 動作。""" + activation_evidence = activation_evidence or {} + runtime_receipt = runtime_receipt or {} + activation_payload_received = bool(activation_evidence) + receipt_payload_received = bool(runtime_receipt) + payload_received = activation_payload_received or receipt_payload_received + + activation_review = build_mcp_activation_evidence_preview( + evidence=activation_evidence, + phase=phase, + ) + receipt_review = build_mcp_runtime_smoke_receipt_preview( + receipt=runtime_receipt, + phase=phase, + ) + side_effect_free = bool( + _none_executed( + activation_review, + ( + "api_executes_health_check", + "api_executes_docker", + "api_executes_ssh", + "api_opens_database_connection", + "api_writes_database", + "api_uses_external_network", + "database_session_created", + "database_write_executed", + "database_commit_executed", + "external_network_executed", + "scheduler_attached", + "writes_executed", + "would_write_database", + ), + ) + and _none_executed( + receipt_review, + ( + "api_executes_health_check", + "api_executes_docker", + "api_executes_ssh", + "api_opens_database_connection", + "api_writes_database", + "api_uses_external_network", + "database_session_created", + "database_write_executed", + "database_commit_executed", + "external_network_executed", + "scheduler_attached", + "writes_executed", + "would_write_database", + ), + ) + ) + + gates = [ + { + "key": "activation_evidence_payload_received", + "passed": activation_payload_received, + "label": "已提供 MCP activation evidence payload", + }, + { + "key": "activation_evidence_accepted", + "passed": activation_review["activation_evidence_accepted"], + "label": "MCP 啟用證據已通過", + }, + { + "key": "runtime_receipt_payload_received", + "passed": receipt_payload_received, + "label": "已提供 runtime smoke receipt payload", + }, + { + "key": "runtime_smoke_receipt_accepted", + "passed": receipt_review["runtime_smoke_receipt_accepted"], + "label": "runtime smoke 收據已通過", + }, + { + "key": "external_runtime_complete_by_receipts", + "passed": bool( + activation_review["external_mcp_runtime_evidence_complete"] + and receipt_review["external_mcp_runtime_receipt_complete"] + ), + "label": "外部 MCP runtime 可由 evidence + receipt 共同驗收", + }, + { + "key": "internal_runtime_complete_by_receipts", + "passed": bool( + activation_review["internal_mcp_runtime_evidence_complete"] + and receipt_review["internal_mcp_runtime_receipt_complete"] + ), + "label": "內部 MCP telemetry / contract 可由 evidence + receipt 共同驗收", + }, + { + "key": "completion_runtime_gap_closed_by_receipts", + "passed": bool( + activation_review["ready_for_runtime_promotion"] + and receipt_review["ready_for_completion_runtime_promotion"] + ), + "label": "completion audit 的 runtime 缺口可由本 promotion package 補齊", + }, + { + "key": "manual_fetch_gate_ready_for_review", + "passed": bool( + activation_review["ready_for_fetch_gate_review"] + and receipt_review["ready_for_manual_fetch_gate_review"] + ), + "label": "可進入人工 fetch gate review,但不可自動打開 fetch", + }, + { + "key": "promotion_payload_not_persisted", + "passed": bool( + not activation_review["payload_persisted"] + and not activation_review["evidence_persisted"] + and not receipt_review["payload_persisted"] + and not receipt_review["receipt_persisted"] + ), + "label": "promotion package 與子 payload 均未保存", + }, + { + "key": "promotion_review_side_effect_free", + "passed": side_effect_free, + "label": "本審核不打 health、不開 DB、不抓外站、不掛 scheduler", + }, + ] + blocked_reasons = [ + gate["key"] for gate in gates + if not gate["passed"] + ] + accepted = payload_received and not blocked_reasons + + return { + "mode": ( + "mcp_runtime_promotion_review" + if payload_received + else "mcp_runtime_promotion_preview" + ), + "phase": phase, + "promotion_payload_received": payload_received, + "activation_evidence_payload_received": activation_payload_received, + "runtime_receipt_payload_received": receipt_payload_received, + "runtime_promotion_accepted": accepted, + "ready_for_completion_runtime_promotion": accepted, + "ready_for_manual_fetch_gate_review": accepted, + "fetch_gate_still_requires_separate_review": True, + "external_mcp_runtime_promoted_by_receipts": accepted, + "internal_mcp_runtime_promoted_by_receipts": accepted, + "gate_count": len(gates), + "passed_gate_count": sum(1 for gate in gates if gate["passed"]), + "blocked_reasons": blocked_reasons, + "gates": gates, + "activation_summary": { + "accepted": activation_review["activation_evidence_accepted"], + "passed_gate_count": activation_review["passed_gate_count"], + "gate_count": activation_review["gate_count"], + "blocked_reasons": activation_review["blocked_reasons"], + }, + "runtime_receipt_summary": { + "accepted": receipt_review["runtime_smoke_receipt_accepted"], + "passed_gate_count": receipt_review["passed_gate_count"], + "gate_count": receipt_review["gate_count"], + "blocked_reasons": receipt_review["blocked_reasons"], + "server_summary": receipt_review["server_summary"], + "telemetry_summary": receipt_review["telemetry_summary"], + }, + "mcp_activation_evidence": activation_review, + "mcp_runtime_smoke_receipt": receipt_review, + "sample_promotion_package": _sample_promotion_package(), + "next_operator_steps": [ + "若 promotion 通過,回到 MCP 完整度稽核標記 runtime 缺口可由人工收據補齊", + "人工 fetch gate 仍須另行審核,且只能針對公開頁面與限速策略", + "正式 fetch / DB write / scheduler attach 仍需各自獨立 gate,不得由本 API 執行", + ], + "payload_persisted": False, + "promotion_persisted": False, + "api_executes_health_check": False, + "api_executes_docker": False, + "api_executes_ssh": False, + "api_opens_database_connection": False, + "api_writes_database": False, + "api_uses_external_network": False, + "database_session_created": False, + "database_write_executed": False, + "database_commit_executed": False, + "external_network_executed": False, + "scheduler_attached": False, + "writes_executed": False, + "would_write_database": False, + } diff --git a/services/market_intel/phase.py b/services/market_intel/phase.py index e1155f4..eed1a91 100644 --- a/services/market_intel/phase.py +++ b/services/market_intel/phase.py @@ -1,3 +1,3 @@ """市場情報 rollout phase 單一來源。""" -MARKET_INTEL_PHASE = "phase_118_market_intel_mcp_runtime_smoke_receipt" +MARKET_INTEL_PHASE = "phase_119_market_intel_mcp_runtime_promotion" diff --git a/templates/market_intel/disabled.html b/templates/market_intel/disabled.html index 93e35ca..c1d9d99 100644 --- a/templates/market_intel/disabled.html +++ b/templates/market_intel/disabled.html @@ -604,6 +604,32 @@ +
+
+
+

MCP / RUNTIME PROMOTION

+

MCP Runtime Promotion 審核

+
+ +
+
+ loading +
+
+
讀取 MCP Runtime Promotion 審核中...
+
+
+ +
+ +
+
+
+
@@ -1110,6 +1136,7 @@ const mcpCompletionRoot = document.querySelector('[data-market-intel-mcp-completion]'); const mcpActivationEvidenceRoot = document.querySelector('[data-market-intel-mcp-activation-evidence]'); const mcpRuntimeSmokeRoot = document.querySelector('[data-market-intel-mcp-runtime-smoke]'); + const mcpRuntimePromotionRoot = document.querySelector('[data-market-intel-mcp-runtime-promotion]'); const manualSampleRoot = document.querySelector('[data-market-intel-manual-sample]'); const sampleAcceptanceRoot = document.querySelector('[data-market-intel-sample-acceptance]'); const sampleReviewRoot = document.querySelector('[data-market-intel-sample-review]'); @@ -1126,7 +1153,7 @@ const liveInventoryRoot = document.querySelector('[data-market-intel-live-inventory]'); const approvalRoot = document.querySelector('[data-market-intel-approval]'); const deployRoot = document.querySelector('[data-market-intel-deploy]'); - if (!root && !writerRoot && !cliRoot && !dbProbeRoot && !seedDiffRoot && !legacyBridgeRoot && !mcpReadinessRoot && !mcpPreflightRoot && !mcpActivationRoot && !mcpFetchGateRoot && !mcpCompletionRoot && !mcpActivationEvidenceRoot && !mcpRuntimeSmokeRoot && !manualSampleRoot && !sampleAcceptanceRoot && !sampleReviewRoot && !schedulerRoot && !matchReviewRoot && !opportunityRoot && !opportunityScoringRoot && !opportunityEvidenceRoot && !opportunityAlertRoot && !migrationRoot && !migrationDrillRoot && !catalogReviewRoot && !liveSmokeRoot && !liveInventoryRoot && !approvalRoot && !deployRoot) return; + if (!root && !writerRoot && !cliRoot && !dbProbeRoot && !seedDiffRoot && !legacyBridgeRoot && !mcpReadinessRoot && !mcpPreflightRoot && !mcpActivationRoot && !mcpFetchGateRoot && !mcpCompletionRoot && !mcpActivationEvidenceRoot && !mcpRuntimeSmokeRoot && !mcpRuntimePromotionRoot && !manualSampleRoot && !sampleAcceptanceRoot && !sampleReviewRoot && !schedulerRoot && !matchReviewRoot && !opportunityRoot && !opportunityScoringRoot && !opportunityEvidenceRoot && !opportunityAlertRoot && !migrationRoot && !migrationDrillRoot && !catalogReviewRoot && !liveSmokeRoot && !liveInventoryRoot && !approvalRoot && !deployRoot) return; const meta = root ? root.querySelector('[data-market-intel-preview-meta]') : null; const body = root ? root.querySelector('[data-market-intel-preview-body]') : null; @@ -1185,6 +1212,12 @@ const mcpRuntimeSmokeReview = mcpRuntimeSmokeRoot ? mcpRuntimeSmokeRoot.querySelector('[data-market-intel-mcp-runtime-smoke-review]') : null; const mcpRuntimeSmokeRefresh = mcpRuntimeSmokeRoot ? mcpRuntimeSmokeRoot.querySelector('[data-market-intel-mcp-runtime-smoke-refresh]') : null; const mcpRuntimeSmokeEndpoint = "{{ url_for('market_intel.market_intel_mcp_runtime_smoke_receipt') }}"; + const mcpRuntimePromotionMeta = mcpRuntimePromotionRoot ? mcpRuntimePromotionRoot.querySelector('[data-market-intel-mcp-runtime-promotion-meta]') : null; + const mcpRuntimePromotionBody = mcpRuntimePromotionRoot ? mcpRuntimePromotionRoot.querySelector('[data-market-intel-mcp-runtime-promotion-body]') : null; + const mcpRuntimePromotionInput = mcpRuntimePromotionRoot ? mcpRuntimePromotionRoot.querySelector('[data-market-intel-mcp-runtime-promotion-input]') : null; + const mcpRuntimePromotionReview = mcpRuntimePromotionRoot ? mcpRuntimePromotionRoot.querySelector('[data-market-intel-mcp-runtime-promotion-review]') : null; + const mcpRuntimePromotionRefresh = mcpRuntimePromotionRoot ? mcpRuntimePromotionRoot.querySelector('[data-market-intel-mcp-runtime-promotion-refresh]') : null; + const mcpRuntimePromotionEndpoint = "{{ url_for('market_intel.market_intel_mcp_runtime_promotion') }}"; const manualSampleMeta = manualSampleRoot ? manualSampleRoot.querySelector('[data-market-intel-manual-sample-meta]') : null; const manualSampleBody = manualSampleRoot ? manualSampleRoot.querySelector('[data-market-intel-manual-sample-body]') : null; const manualSampleRefresh = manualSampleRoot ? manualSampleRoot.querySelector('[data-market-intel-manual-sample-refresh]') : null; @@ -2395,6 +2428,124 @@ } }; + const renderMcpRuntimePromotionMeta = data => { + mcpRuntimePromotionMeta.innerHTML = [ + `mode=${data.mode || 'unknown'}`, + `accepted=${data.runtime_promotion_accepted ? 'yes' : 'no'}`, + `gates=${data.passed_gate_count || 0}/${data.gate_count || 0}`, + `activation=${(data.activation_summary || {}).accepted ? 'ok' : 'pending'}`, + `receipt=${(data.runtime_receipt_summary || {}).accepted ? 'ok' : 'pending'}`, + `persisted=${data.promotion_persisted ? 'yes' : 'no'}` + ].map(item => `${escapeHtml(item)}`).join(''); + }; + + const renderMcpRuntimePromotionBody = data => { + const blockers = (data.blocked_reasons || []).join(' / '); + const gates = data.gates || []; + const activation = data.activation_summary || {}; + const receipt = data.runtime_receipt_summary || {}; + const serverSummary = receipt.server_summary || {}; + const telemetry = receipt.telemetry_summary || {}; + const steps = data.next_operator_steps || []; + const renderCheck = (key, label, status) => ` +
+
+ ${escapeHtml(key)} + ${escapeHtml(label || '')} +
+ ${escapeHtml(status)} +
+ `; + mcpRuntimePromotionBody.innerHTML = ` +
此審核只合併 activation evidence 與 runtime smoke receipt;不打 health、不開 DB、不保存 payload、不打開人工 fetch。${blockers ? `阻擋:${escapeHtml(blockers)}` : ''}
+
+
+

PROMOTION GATES

+
${ + gates.length + ? gates.map(item => renderCheck(item.key, item.label, item.passed ? 'PASS' : 'BLOCK')).join('') + : '
尚未提供 promotion gates。
' + }
+
+
+

RECEIPT SUMMARIES

+
+ ${renderCheck( + 'activation_evidence', + `${activation.passed_gate_count || 0}/${activation.gate_count || 0} gates`, + activation.accepted ? 'ACCEPTED' : 'PENDING' + )} + ${renderCheck( + 'runtime_receipt', + `${receipt.passed_gate_count || 0}/${receipt.gate_count || 0} gates / servers=${serverSummary.healthy_count || 0}/${(serverSummary.expected_servers || []).length || 4}`, + receipt.accepted ? 'ACCEPTED' : 'PENDING' + )} + ${renderCheck( + 'telemetry', + `${telemetry.mode || 'unknown'} / query=${telemetry.read_only_query_executed ? 'read-only' : 'missing'}`, + telemetry.read_only_query_executed && !telemetry.database_write_executed ? 'READ ONLY' : 'BLOCK' + )} +
+
+
+

NEXT

+
${ + steps.map((item, index) => renderCheck(`step_${index + 1}`, item, 'MANUAL')).join('') + }
+
+
+ `; + if (mcpRuntimePromotionInput && !mcpRuntimePromotionInput.value.trim() && data.sample_promotion_package) { + mcpRuntimePromotionInput.value = JSON.stringify(data.sample_promotion_package, null, 2); + } + }; + + const loadMcpRuntimePromotion = async () => { + if (!mcpRuntimePromotionMeta || !mcpRuntimePromotionBody) return; + mcpRuntimePromotionBody.innerHTML = '
讀取 MCP Runtime Promotion 審核中...
'; + try { + const response = await fetch(mcpRuntimePromotionEndpoint, { credentials: 'same-origin' }); + if (!response.ok) throw new Error(`HTTP ${response.status}`); + const data = await response.json(); + renderMcpRuntimePromotionMeta(data); + renderMcpRuntimePromotionBody(data); + } catch (error) { + mcpRuntimePromotionMeta.innerHTML = 'error'; + mcpRuntimePromotionBody.innerHTML = `
MCP Runtime Promotion 審核讀取失敗:${escapeHtml(error.message)}
`; + } + }; + + const reviewMcpRuntimePromotion = async () => { + if (!mcpRuntimePromotionMeta || !mcpRuntimePromotionBody || !mcpRuntimePromotionInput) return; + let parsed; + try { + parsed = JSON.parse(mcpRuntimePromotionInput.value || '{}'); + } catch (error) { + mcpRuntimePromotionMeta.innerHTML = 'json_error'; + mcpRuntimePromotionBody.innerHTML = `
JSON 格式錯誤:${escapeHtml(error.message)}
`; + return; + } + mcpRuntimePromotionBody.innerHTML = '
審核 MCP Runtime Promotion 中...
'; + try { + const response = await fetch(mcpRuntimePromotionEndpoint, { + method: 'POST', + credentials: 'same-origin', + headers: { + 'Content-Type': 'application/json', + 'X-CSRFToken': csrfToken + }, + body: JSON.stringify({ promotion_package: parsed }) + }); + const data = await response.json(); + if (!response.ok && !data.mode) throw new Error(`HTTP ${response.status}`); + renderMcpRuntimePromotionMeta(data); + renderMcpRuntimePromotionBody(data); + } catch (error) { + mcpRuntimePromotionMeta.innerHTML = 'error'; + mcpRuntimePromotionBody.innerHTML = `
MCP Runtime Promotion 審核失敗:${escapeHtml(error.message)}
`; + } + }; + const renderManualSampleMeta = data => { manualSampleMeta.innerHTML = [ `mode=${data.mode || 'unknown'}`, @@ -11810,6 +11961,12 @@ if (mcpRuntimeSmokeReview) { mcpRuntimeSmokeReview.addEventListener('click', reviewMcpRuntimeSmoke); } + if (mcpRuntimePromotionRefresh) { + mcpRuntimePromotionRefresh.addEventListener('click', loadMcpRuntimePromotion); + } + if (mcpRuntimePromotionReview) { + mcpRuntimePromotionReview.addEventListener('click', reviewMcpRuntimePromotion); + } if (manualSampleRefresh) { manualSampleRefresh.addEventListener('click', loadManualSample); } @@ -12066,6 +12223,7 @@ loadMcpCompletion(); loadMcpActivationEvidence(); loadMcpRuntimeSmoke(); + loadMcpRuntimePromotion(); loadManualSample(); loadSampleAcceptance(); loadSampleReview(); diff --git a/tests/test_market_intel_skeleton.py b/tests/test_market_intel_skeleton.py index 8e134f6..4e16799 100644 --- a/tests/test_market_intel_skeleton.py +++ b/tests/test_market_intel_skeleton.py @@ -21,6 +21,7 @@ from services.market_intel.mcp_contract import build_mcp_tool_contract_preview from services.market_intel.mcp_deploy_preflight import build_mcp_deploy_preflight_plan from services.market_intel.mcp_fetch_gate import build_mcp_fetch_gate_preview from services.market_intel.mcp_readiness import build_mcp_readiness_plan +from services.market_intel.mcp_runtime_promotion import build_mcp_runtime_promotion_preview from services.market_intel.mcp_runtime_smoke_receipt import build_mcp_runtime_smoke_receipt_preview from services.market_intel.live_db_inventory import build_live_db_inventory_preview from services.market_intel.manual_sample_review import evaluate_manual_sample_result @@ -946,6 +947,8 @@ def test_market_intel_preview_template_uses_safe_fetch_false_endpoint(): assert "data-market-intel-mcp-activation-evidence" in template assert "market_intel.market_intel_mcp_runtime_smoke_receipt" in template assert "data-market-intel-mcp-runtime-smoke" in template + assert "market_intel.market_intel_mcp_runtime_promotion" in template + assert "data-market-intel-mcp-runtime-promotion" in template assert "market_intel.market_intel_manual_sample_plan" in template assert "market_intel.market_intel_manual_sample_acceptance" in template assert "market_intel.market_intel_manual_sample_review" in template @@ -1416,7 +1419,7 @@ def test_legacy_source_bridge_default_is_planned_only(): bridge = MarketIntelService().build_legacy_source_bridge() assert bridge["mode"] == "legacy_source_bridge_planned" - assert bridge["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert bridge["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert bridge["execute_requested"] is False assert bridge["read_only_query_executed"] is False assert bridge["database_connection_opened"] is False @@ -1574,7 +1577,7 @@ def test_mcp_tool_contract_preview_is_read_only_and_whitelisted(): contract = MarketIntelService().build_mcp_tool_contract() assert contract["mode"] == "mcp_tool_contract_preview" - assert contract["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert contract["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert contract["caller"] == "market_intel" assert contract["contract_ready"] is True assert contract["blocked_reasons"] == [] @@ -1707,7 +1710,7 @@ def test_mcp_activation_runbook_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "mcp_activation_runbook_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["deployment_actions_executed"] is False assert data["docker_command_executed"] is False assert data["ssh_command_executed"] is False @@ -1720,7 +1723,7 @@ def test_mcp_fetch_gate_default_blocks_external_fetch(): gate = MarketIntelService().build_mcp_fetch_gate(fetch_requested=True) assert gate["mode"] == "mcp_fetch_gate_planned" - assert gate["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert gate["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert gate["fetch_requested"] is True assert gate["manual_fetch_gate_open"] is False assert gate["network_request_allowed"] is False @@ -1790,7 +1793,7 @@ def test_mcp_fetch_gate_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "mcp_fetch_gate_planned" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["fetch_requested"] is False assert data["network_request_allowed"] is False assert data["external_network_executed"] is False @@ -1804,7 +1807,7 @@ def test_mcp_completion_audit_summarizes_external_and_internal_state(monkeypatch audit = MarketIntelService().build_mcp_completion_audit() assert audit["mode"] == "mcp_completion_audit_preview" - assert audit["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert audit["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert audit["audit_ready_for_operator_review"] is True assert audit["audit_preview_safe"] is True assert audit["external_mcp_runtime_complete"] is False @@ -1878,7 +1881,7 @@ def test_mcp_completion_audit_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "mcp_completion_audit_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["audit_preview_safe"] is True assert data["external_mcp_runtime_complete"] is False assert data["internal_mcp_contract_complete"] is True @@ -1895,11 +1898,11 @@ def test_mcp_completion_audit_route_is_preview_only(): def test_mcp_activation_evidence_preview_is_safe_without_payload(): evidence = build_mcp_activation_evidence_preview( - phase="phase_118_market_intel_mcp_runtime_smoke_receipt" + phase="phase_119_market_intel_mcp_runtime_promotion" ) assert evidence["mode"] == "mcp_activation_evidence_preview" - assert evidence["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert evidence["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert evidence["evidence_payload_received"] is False assert evidence["activation_evidence_accepted"] is False assert evidence["ready_for_runtime_promotion"] is False @@ -1924,7 +1927,7 @@ def test_mcp_activation_evidence_accepts_redacted_runtime_evidence(): ] evidence = build_mcp_activation_evidence_preview( evidence=sample, - phase="phase_118_market_intel_mcp_runtime_smoke_receipt", + phase="phase_119_market_intel_mcp_runtime_promotion", ) assert evidence["mode"] == "mcp_activation_evidence_review" @@ -1982,12 +1985,12 @@ def test_mcp_activation_evidence_route_get_and_post_are_preview_only(): assert get_response.status_code == 200 assert get_data["mode"] == "mcp_activation_evidence_preview" - assert get_data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert get_data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert get_data["api_executes_health_check"] is False assert get_data["api_writes_database"] is False assert post_response.status_code == 200 assert post_data["mode"] == "mcp_activation_evidence_review" - assert post_data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert post_data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert post_data["activation_evidence_accepted"] is True assert post_data["payload_persisted"] is False assert post_data["api_opens_database_connection"] is False @@ -1996,11 +1999,11 @@ def test_mcp_activation_evidence_route_get_and_post_are_preview_only(): def test_mcp_runtime_smoke_receipt_preview_is_safe_without_payload(): receipt = build_mcp_runtime_smoke_receipt_preview( - phase="phase_118_market_intel_mcp_runtime_smoke_receipt" + phase="phase_119_market_intel_mcp_runtime_promotion" ) assert receipt["mode"] == "mcp_runtime_smoke_receipt_preview" - assert receipt["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert receipt["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert receipt["receipt_payload_received"] is False assert receipt["runtime_smoke_receipt_accepted"] is False assert receipt["ready_for_completion_runtime_promotion"] is False @@ -2028,7 +2031,7 @@ def test_mcp_runtime_smoke_receipt_accepts_complete_readiness_receipt(): ] receipt = build_mcp_runtime_smoke_receipt_preview( receipt=sample, - phase="phase_118_market_intel_mcp_runtime_smoke_receipt", + phase="phase_119_market_intel_mcp_runtime_promotion", ) assert receipt["mode"] == "mcp_runtime_smoke_receipt_review" @@ -2093,23 +2096,129 @@ def test_mcp_runtime_smoke_receipt_route_get_and_post_are_preview_only(): assert get_response.status_code == 200 assert get_data["mode"] == "mcp_runtime_smoke_receipt_preview" - assert get_data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert get_data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert get_data["api_executes_health_check"] is False assert get_data["api_writes_database"] is False assert post_response.status_code == 200 assert post_data["mode"] == "mcp_runtime_smoke_receipt_review" - assert post_data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert post_data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert post_data["runtime_smoke_receipt_accepted"] is True assert post_data["receipt_persisted"] is False assert post_data["api_opens_database_connection"] is False assert post_data["api_uses_external_network"] is False +def test_mcp_runtime_promotion_preview_is_safe_without_payload(): + promotion = build_mcp_runtime_promotion_preview( + phase="phase_119_market_intel_mcp_runtime_promotion" + ) + + assert promotion["mode"] == "mcp_runtime_promotion_preview" + assert promotion["phase"] == "phase_119_market_intel_mcp_runtime_promotion" + assert promotion["promotion_payload_received"] is False + assert promotion["runtime_promotion_accepted"] is False + assert promotion["ready_for_completion_runtime_promotion"] is False + assert promotion["ready_for_manual_fetch_gate_review"] is False + assert promotion["fetch_gate_still_requires_separate_review"] is True + assert promotion["payload_persisted"] is False + assert promotion["promotion_persisted"] is False + assert promotion["api_executes_health_check"] is False + assert promotion["api_opens_database_connection"] is False + assert promotion["api_writes_database"] is False + assert promotion["api_uses_external_network"] is False + assert promotion["database_write_executed"] is False + assert promotion["external_network_executed"] is False + assert promotion["scheduler_attached"] is False + assert "activation_evidence_payload_received" in promotion["blocked_reasons"] + assert "runtime_receipt_payload_received" in promotion["blocked_reasons"] + assert "activation_evidence" in promotion["sample_promotion_package"] + assert "runtime_receipt" in promotion["sample_promotion_package"] + + +def test_mcp_runtime_promotion_accepts_evidence_and_receipt_package(): + sample = build_mcp_runtime_promotion_preview()[ + "sample_promotion_package" + ] + promotion = build_mcp_runtime_promotion_preview( + activation_evidence=sample["activation_evidence"], + runtime_receipt=sample["runtime_receipt"], + phase="phase_119_market_intel_mcp_runtime_promotion", + ) + + assert promotion["mode"] == "mcp_runtime_promotion_review" + assert promotion["runtime_promotion_accepted"] is True + assert promotion["ready_for_completion_runtime_promotion"] is True + assert promotion["ready_for_manual_fetch_gate_review"] is True + assert promotion["external_mcp_runtime_promoted_by_receipts"] is True + assert promotion["internal_mcp_runtime_promoted_by_receipts"] is True + assert promotion["blocked_reasons"] == [] + assert promotion["passed_gate_count"] == promotion["gate_count"] + assert promotion["activation_summary"]["accepted"] is True + assert promotion["runtime_receipt_summary"]["accepted"] is True + assert promotion["payload_persisted"] is False + assert promotion["promotion_persisted"] is False + assert promotion["api_executes_health_check"] is False + assert promotion["api_writes_database"] is False + assert promotion["external_network_executed"] is False + + +def test_mcp_runtime_promotion_blocks_partial_or_unsafe_package(): + sample = build_mcp_runtime_promotion_preview()[ + "sample_promotion_package" + ] + sample["runtime_receipt"]["database_write_executed"] = True + + promotion = build_mcp_runtime_promotion_preview( + activation_evidence=sample["activation_evidence"], + runtime_receipt=sample["runtime_receipt"], + ) + + assert promotion["runtime_promotion_accepted"] is False + assert "runtime_smoke_receipt_accepted" in promotion["blocked_reasons"] + assert "promotion_payload_not_persisted" not in promotion["blocked_reasons"] + assert promotion["runtime_receipt_summary"]["accepted"] is False + assert promotion["database_write_executed"] is False + assert promotion["payload_persisted"] is False + + +def test_mcp_runtime_promotion_route_get_and_post_are_preview_only(): + from routes.market_intel_routes import market_intel_bp + + app = Flask(__name__) + app.secret_key = "test-secret" + app.register_blueprint(market_intel_bp) + client = app.test_client() + with client.session_transaction() as session: + session["logged_in"] = True + + get_response = client.get("/api/market_intel/mcp_runtime_promotion") + get_data = get_response.get_json() + sample = get_data["sample_promotion_package"] + post_response = client.post( + "/api/market_intel/mcp_runtime_promotion", + json={"promotion_package": sample}, + ) + post_data = post_response.get_json() + + assert get_response.status_code == 200 + assert get_data["mode"] == "mcp_runtime_promotion_preview" + assert get_data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" + assert get_data["api_executes_health_check"] is False + assert get_data["api_writes_database"] is False + assert post_response.status_code == 200 + assert post_data["mode"] == "mcp_runtime_promotion_review" + assert post_data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" + assert post_data["runtime_promotion_accepted"] is True + assert post_data["promotion_persisted"] is False + assert post_data["api_opens_database_connection"] is False + assert post_data["api_uses_external_network"] is False + + def test_manual_sample_plan_preview_blocks_fetch_and_write(): plan = MarketIntelService().build_manual_sample_plan() assert plan["mode"] == "manual_sample_fetch_plan_preview" - assert plan["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert plan["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert plan["ready_for_manual_sample_fetch"] is False assert plan["sample_fetch_executed"] is False assert plan["external_network_executed"] is False @@ -2157,7 +2266,7 @@ def test_manual_sample_plan_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "manual_sample_fetch_plan_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["sample_fetch_executed"] is False assert data["external_network_executed"] is False assert data["database_write_executed"] is False @@ -2168,7 +2277,7 @@ def test_manual_sample_acceptance_preview_blocks_candidate_import(): acceptance = MarketIntelService().build_manual_sample_acceptance() assert acceptance["mode"] == "manual_sample_acceptance_preview" - assert acceptance["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert acceptance["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert acceptance["contract_ready"] is True assert acceptance["sample_result_loaded"] is False assert acceptance["sample_result_accepted"] is False @@ -2210,7 +2319,7 @@ def test_manual_sample_acceptance_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "manual_sample_acceptance_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["sample_result_loaded"] is False assert data["candidate_import_allowed"] is False assert data["external_network_executed"] is False @@ -2222,7 +2331,7 @@ def test_manual_sample_review_preview_is_planned_until_result_loaded(): review = MarketIntelService().build_manual_sample_review() assert review["mode"] == "manual_sample_review_preview" - assert review["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert review["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert review["contract_ready"] is True assert review["sample_result_loaded"] is False assert review["sample_result_reviewed"] is False @@ -2333,7 +2442,7 @@ def test_manual_sample_review_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "manual_sample_review_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["sample_result_loaded"] is False assert data["sample_result_reviewed"] is False assert data["candidate_import_allowed"] is False @@ -2372,7 +2481,7 @@ def test_manual_sample_review_evaluation_preview_accepts_payload_without_persist ) assert review["mode"] == "manual_sample_review_evaluation_preview" - assert review["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert review["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert review["review_request_type"] == "operator_posted_json" assert review["payload_received"] is True assert review["payload_valid_json_object"] is True @@ -2434,7 +2543,7 @@ def test_manual_sample_review_evaluate_route_is_post_only_and_no_write(): assert response.status_code == 200 assert data["mode"] == "manual_sample_review_evaluation_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["payload_received"] is True assert data["payload_valid_json_object"] is True assert data["payload_persisted"] is False @@ -2514,7 +2623,7 @@ def test_manual_sample_candidate_handoff_preview_creates_candidates_without_pers ) assert handoff["mode"] == "manual_sample_candidate_handoff_preview" - assert handoff["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert handoff["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert handoff["payload_received"] is True assert handoff["payload_valid_json_object"] is True assert handoff["payload_persisted"] is False @@ -2578,7 +2687,7 @@ def test_manual_sample_candidate_handoff_route_is_post_only_and_no_write(): assert response.status_code == 200 assert data["mode"] == "manual_sample_candidate_handoff_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["payload_received"] is True assert data["handoff_ready"] is True assert data["candidate_handoff_created"] is True @@ -2637,7 +2746,7 @@ def test_manual_sample_candidate_queue_draft_preview_builds_review_items_without ) assert queue_draft["mode"] == "manual_sample_candidate_queue_draft_preview" - assert queue_draft["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert queue_draft["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert queue_draft["payload_received"] is True assert queue_draft["payload_valid_json_object"] is True assert queue_draft["payload_persisted"] is False @@ -2711,7 +2820,7 @@ def test_manual_sample_candidate_queue_draft_route_is_post_only_and_no_write(): assert response.status_code == 200 assert data["mode"] == "manual_sample_candidate_queue_draft_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["payload_received"] is True assert data["handoff_ready"] is True assert data["queue_draft_ready"] is True @@ -2774,7 +2883,7 @@ def test_manual_sample_candidate_queue_approval_preview_blocks_write_and_maps_ro ) assert approval["mode"] == "manual_sample_candidate_queue_approval_preview" - assert approval["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert approval["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert approval["payload_received"] is True assert approval["payload_valid_json_object"] is True assert approval["payload_persisted"] is False @@ -2852,7 +2961,7 @@ def test_manual_sample_candidate_queue_approval_route_is_post_only_and_no_write( assert response.status_code == 200 assert data["mode"] == "manual_sample_candidate_queue_approval_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["payload_received"] is True assert data["approval_preview_created"] is True assert data["approval_request_created"] is False @@ -2915,7 +3024,7 @@ def test_manual_sample_candidate_queue_transaction_preview_blocks_execution(): ) assert transaction["mode"] == "manual_sample_candidate_queue_transaction_preview" - assert transaction["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert transaction["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert transaction["payload_received"] is True assert transaction["payload_valid_json_object"] is True assert transaction["payload_persisted"] is False @@ -2995,7 +3104,7 @@ def test_manual_sample_candidate_queue_transaction_route_is_post_only_and_no_wri assert response.status_code == 200 assert data["mode"] == "manual_sample_candidate_queue_transaction_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["payload_received"] is True assert data["transaction_preview_created"] is True assert data["transaction_ready"] is False @@ -8706,7 +8815,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_input_ready"] is False assert data["summary_persistence_telegram_dispatch_report_input_ready"] is False @@ -8781,7 +8890,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive "candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_archive_summary_ready"] is False assert ( @@ -9053,7 +9162,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_input_ready"] is False assert data["summary_persistence_telegram_dispatch_report_input_ready"] is False @@ -9341,7 +9450,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_run_package_ready"] is False assert ( @@ -9651,7 +9760,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_run_readiness_ready"] is False assert ( @@ -9954,7 +10063,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_run_receipt_passed"] is False assert ( @@ -10213,7 +10322,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_closeout_passed"] is False assert ( @@ -10486,7 +10595,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_archive_passed"] is False assert ( @@ -10734,7 +10843,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_archive_summary_passed"] is False assert ( @@ -10964,7 +11073,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_handoff_passed"] is False assert data["summary_persistence_telegram_dispatch_report_catalog_handoff_passed"] is False @@ -11201,7 +11310,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_index_passed"] is False assert data["summary_persistence_telegram_dispatch_report_catalog_index_passed"] is False @@ -11443,7 +11552,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_write_preflight_passed"] is False assert ( @@ -11719,7 +11828,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_record_write_passed"] is False assert ( @@ -11996,7 +12105,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_record_run_package_passed"] is False assert ( @@ -12275,7 +12384,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_record_run_readiness_passed"] is False assert ( @@ -12604,7 +12713,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_record_run_receipt_passed"] is False assert ( @@ -12866,7 +12975,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_record_commit_passed"] is False assert ( @@ -13130,7 +13239,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_record_closeout_passed"] is False assert ( @@ -13400,7 +13509,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_record_archive_passed"] is False assert ( @@ -13688,7 +13797,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_record_archive_summary_passed"] is False assert ( @@ -13975,7 +14084,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_report_catalog_record_final_closeout_passed"] is False assert ( @@ -14061,7 +14170,7 @@ def test_candidate_queue_writer_preflight_route_is_post_only_and_no_write(): assert response.status_code == 200 assert data["mode"] == "candidate_queue_writer_preflight_planned" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["read_only_query_executed"] is False assert data["database_connection_opened"] is False @@ -14118,7 +14227,7 @@ def test_candidate_queue_writer_status_route_never_leaks_approval_token(monkeypa assert response.status_code == 200 assert data["mode"] == "candidate_queue_writer_cli_blocked" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is True assert data["apply_real_write_requested"] is True assert data["approval_token_present"] is False @@ -14207,7 +14316,7 @@ def test_candidate_queue_writer_postwrite_smoke_route_is_post_only_and_no_write( assert response.status_code == 200 assert data["mode"] == "candidate_queue_writer_postwrite_smoke_planned" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["read_only_query_executed"] is False assert data["database_connection_opened"] is False @@ -14261,7 +14370,7 @@ def test_candidate_queue_writer_operator_drill_route_is_post_only_and_no_write() assert response.status_code == 200 assert data["mode"] == "candidate_queue_writer_operator_drill_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["operator_drill_ready"] is True assert data["api_executes_cli"] is False assert data["api_reads_approval_token"] is False @@ -14317,7 +14426,7 @@ def test_candidate_queue_writer_run_package_route_is_post_only_and_no_write(): assert response.status_code == 200 assert data["mode"] == "candidate_queue_writer_run_package_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["package_ready"] is True assert data["package_artifact_created"] is False assert data["api_writes_file"] is False @@ -14383,7 +14492,7 @@ def test_candidate_queue_writer_run_readiness_route_is_post_only_and_no_write(): assert response.status_code == 200 assert data["mode"] == "candidate_queue_writer_run_readiness_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["ready_for_cli_operator_run"] is True assert data["ready_for_api_database_write"] is False assert data["api_executes_cli"] is False @@ -14685,7 +14794,7 @@ def test_candidate_queue_writer_run_receipt_route_accepts_inline_payload_no_writ assert response.status_code == 200 assert data["mode"] == "candidate_queue_writer_run_receipt_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["receipt_passed"] is True assert data["ready_for_api_database_write"] is False assert data["ready_for_scheduler_attach"] is False @@ -14733,7 +14842,7 @@ def test_candidate_queue_writer_run_closeout_route_is_post_only_and_no_write(): assert response.status_code == 200 assert data["mode"] == "candidate_queue_writer_run_closeout_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["closeout_passed"] is True assert data["ready_for_next_manual_phase"] is True assert data["ready_for_api_database_write"] is False @@ -14782,7 +14891,7 @@ def test_candidate_queue_review_handoff_route_is_post_only_and_no_write(): assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_handoff_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["handoff_ready"] is True assert data["ready_for_manual_queue_review"] is True assert data["ready_for_api_database_write"] is False @@ -14840,7 +14949,7 @@ def test_candidate_queue_review_inventory_route_is_post_only_and_no_write(): assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_inventory_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["review_inventory_ready"] is False assert data["ready_for_human_decision_review"] is False @@ -14906,7 +15015,7 @@ def test_candidate_queue_review_decision_route_is_post_only_and_no_write(): assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_decision_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["decision_ready"] is False assert data["ready_for_human_decision_record"] is False assert data["ready_for_api_review_state_update"] is False @@ -14977,7 +15086,7 @@ def test_candidate_queue_review_decision_approval_route_is_post_only_and_no_writ assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_decision_approval_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["approval_ready"] is False assert data["ready_for_review_state_transaction_preview"] is False assert data["ready_for_cli_decision_writer"] is False @@ -15053,7 +15162,7 @@ def test_candidate_queue_review_decision_transaction_route_is_post_only_and_no_w assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_decision_transaction_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["transaction_preview_created"] is False assert data["transaction_ready"] is False assert data["ready_for_manual_shell_update_window"] is False @@ -15135,7 +15244,7 @@ def test_candidate_queue_review_decision_writer_status_route_is_post_only_and_no assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_decision_writer_cli_blocked" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is True assert data["apply_real_write_requested"] is True assert data["approval_token_present"] is False @@ -15221,7 +15330,7 @@ def test_candidate_queue_review_decision_writer_preflight_route_is_post_only_and assert data["mode"] == ( "candidate_queue_review_decision_writer_preflight_preview" ) - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is True assert data["apply_real_write_requested"] is True assert data["read_only_query_executed"] is False @@ -15304,7 +15413,7 @@ def test_candidate_queue_review_decision_writer_postwrite_smoke_route_is_post_on assert data["mode"] == ( "candidate_queue_review_decision_writer_postwrite_smoke_planned" ) - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["read_only_query_executed"] is False assert data["database_connection_opened"] is False @@ -15387,7 +15496,7 @@ def test_candidate_queue_review_decision_writer_operator_drill_route_is_post_onl assert data["mode"] == ( "candidate_queue_review_decision_writer_operator_drill_preview" ) - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["operator_drill_ready"] is False assert data["ready_for_api_review_state_update"] is False assert data["ready_for_api_database_write"] is False @@ -15473,7 +15582,7 @@ def test_candidate_queue_review_decision_writer_run_package_route_is_post_only_a assert data["mode"] == ( "candidate_queue_review_decision_writer_run_package_preview" ) - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["package_ready"] is False assert data["package_artifact_created"] is False assert data["ready_for_api_review_state_update"] is False @@ -15564,7 +15673,7 @@ def test_candidate_queue_review_decision_writer_run_readiness_route_is_post_only "candidate_queue_review_decision_writer_run_readiness_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["ready_for_cli_operator_run"] is False assert data["ready_for_api_review_state_update"] is False @@ -15674,7 +15783,7 @@ def test_candidate_queue_review_decision_writer_run_receipt_route_is_post_only_a "candidate_queue_review_decision_writer_run_receipt_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["receipt_passed"] is False assert data["ready_for_api_review_state_update"] is False @@ -15760,7 +15869,7 @@ def test_candidate_queue_review_decision_writer_run_closeout_route_is_post_only_ "candidate_queue_review_decision_writer_run_closeout_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["closeout_passed"] is False assert data["ready_for_api_review_state_update"] is False @@ -15817,7 +15926,7 @@ def test_candidate_queue_review_decision_post_closeout_inventory_route_is_post_o "candidate_queue_review_decision_post_closeout_inventory_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["post_closeout_inventory_ready"] is False assert data["ready_for_api_review_state_update"] is False @@ -15870,7 +15979,7 @@ def test_candidate_queue_review_completion_archive_route_is_post_only_and_no_wri assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_completion_archive_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["review_completion_archive_ready"] is False assert data["archive_manifest_ready"] is False assert data["ready_for_api_review_state_update"] is False @@ -15923,7 +16032,7 @@ def test_candidate_queue_review_archive_summary_route_is_post_only_and_no_write( assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_archive_summary_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["archive_summary_ready"] is False assert data["summary_input_ready"] is False assert data["ready_for_ai_summary_generation"] is False @@ -15984,7 +16093,7 @@ def test_candidate_queue_review_ai_summary_preflight_route_is_post_only_and_no_w assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_ai_summary_preflight_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["ai_summary_preflight_ready"] is False assert data["ready_for_manual_ollama_summary_run"] is False assert data["ready_for_ai_summary_generation"] is False @@ -16053,7 +16162,7 @@ def test_candidate_queue_review_ai_summary_run_package_route_is_post_only_and_no assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_ai_summary_run_package_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["ai_summary_run_package_ready"] is False assert data["ready_for_manual_ollama_summary_run"] is False assert data["ready_for_ai_summary_generation"] is False @@ -16125,7 +16234,7 @@ def test_candidate_queue_review_ai_summary_output_receipt_route_is_post_only_and assert get_response.status_code == 405 assert response.status_code == 200 assert data["mode"] == "candidate_queue_review_ai_summary_output_receipt_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["ai_summary_output_receipt_ready"] is False assert data["ready_for_summary_persistence_review"] is False assert data["manual_ai_summary_output_provided"] is False @@ -16198,7 +16307,7 @@ def test_candidate_queue_review_ai_summary_persistence_preflight_route_is_post_o "candidate_queue_review_ai_summary_persistence_preflight_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["summary_persistence_preflight_ready"] is False assert data["ready_for_summary_transaction_preview"] is False @@ -16269,7 +16378,7 @@ def test_candidate_queue_review_ai_summary_persistence_transaction_route_is_post "candidate_queue_review_ai_summary_persistence_transaction_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["summary_persistence_transaction_ready"] is False assert data["ready_for_summary_persistence_writer_gate"] is False @@ -16334,7 +16443,7 @@ def test_candidate_queue_review_ai_summary_persistence_writer_preflight_route_is "candidate_queue_review_ai_summary_persistence_writer_preflight_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["summary_persistence_writer_preflight_ready"] is False assert data["ready_for_summary_persistence_run_package"] is False @@ -16405,7 +16514,7 @@ def test_candidate_queue_review_ai_summary_persistence_run_package_route_is_post "candidate_queue_review_ai_summary_persistence_run_package_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["package_ready"] is False assert data["ready_for_summary_persistence_run_readiness"] is False @@ -16478,7 +16587,7 @@ def test_candidate_queue_review_ai_summary_persistence_run_readiness_route_is_po "candidate_queue_review_ai_summary_persistence_run_readiness_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["run_readiness_ready"] is False assert data["summary_persistence_run_readiness_ready"] is False @@ -16555,7 +16664,7 @@ def test_candidate_queue_review_ai_summary_persistence_run_receipt_route_is_post "candidate_queue_review_ai_summary_persistence_run_receipt_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["run_receipt_passed"] is False assert data["summary_persistence_run_receipt_passed"] is False @@ -16632,7 +16741,7 @@ def test_candidate_queue_review_ai_summary_persistence_run_closeout_route_is_pos "candidate_queue_review_ai_summary_persistence_run_closeout_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["closeout_passed"] is False assert data["summary_persistence_closeout_passed"] is False @@ -16709,7 +16818,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate_ro "candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_gate_passed"] is False assert data["summary_persistence_telegram_dispatch_gate_passed"] is False @@ -16783,7 +16892,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_pac "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_run_package_ready"] is False assert data["summary_persistence_telegram_dispatch_run_package_ready"] is False @@ -16862,7 +16971,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_rea "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_run_readiness_ready"] is False assert ( @@ -16949,7 +17058,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_rec "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_run_receipt_passed"] is False assert data["summary_persistence_telegram_dispatch_run_receipt_passed"] is False @@ -17030,7 +17139,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeou "candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_closeout_passed"] is False assert data["summary_persistence_telegram_dispatch_closeout_passed"] is False @@ -17112,7 +17221,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive "candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_preview" ) assert data["phase"] == ( - "phase_118_market_intel_mcp_runtime_smoke_receipt" + "phase_119_market_intel_mcp_runtime_promotion" ) assert data["telegram_dispatch_archive_ready"] is False assert data["summary_persistence_telegram_dispatch_archive_ready"] is False @@ -17195,7 +17304,7 @@ def test_candidate_queue_writer_run_receipt_route_is_post_only_and_no_write(): assert response.status_code == 200 assert data["mode"] == "candidate_queue_writer_run_receipt_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["receipt_passed"] is True assert data["ready_for_next_manual_review"] is True assert data["ready_for_api_database_write"] is False @@ -17220,7 +17329,7 @@ def test_scheduler_plan_preview_blocks_job_attachment(): plan = MarketIntelService().build_scheduler_plan() assert plan["mode"] == "scheduler_attach_plan_preview" - assert plan["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert plan["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert plan["ready_to_attach_scheduler"] is False assert plan["scheduler_attached"] is False assert plan["scheduler_registration_executed"] is False @@ -17258,7 +17367,7 @@ def test_scheduler_plan_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "scheduler_attach_plan_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["scheduler_registration_executed"] is False assert data["crawler_job_started"] is False assert data["external_network_executed"] is False @@ -17269,7 +17378,7 @@ def test_match_review_plan_preview_blocks_auto_confirm(): plan = MarketIntelService().build_match_review_plan() assert plan["mode"] == "match_review_plan_preview" - assert plan["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert plan["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert plan["ready_for_review_queue"] is False assert plan["review_queue_created"] is False assert plan["auto_match_executed"] is False @@ -17305,7 +17414,7 @@ def test_match_review_plan_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "match_review_plan_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["review_queue_created"] is False assert data["auto_confirm_executed"] is False assert data["external_network_executed"] is False @@ -17316,7 +17425,7 @@ def test_opportunity_plan_preview_blocks_alerts_and_ai_summary(): plan = MarketIntelService().build_opportunity_plan() assert plan["mode"] == "opportunity_plan_preview" - assert plan["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert plan["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert plan["ready_for_opportunity_queue"] is False assert plan["opportunity_queue_created"] is False assert plan["threat_alert_dispatched"] is False @@ -17357,7 +17466,7 @@ def test_opportunity_plan_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "opportunity_plan_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["opportunity_queue_created"] is False assert data["threat_alert_dispatched"] is False assert data["ai_summary_generated"] is False @@ -17368,7 +17477,7 @@ def test_opportunity_scoring_plan_preview_blocks_scoring_and_alerts(): plan = MarketIntelService().build_opportunity_scoring_plan() assert plan["mode"] == "opportunity_scoring_plan_preview" - assert plan["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert plan["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert plan["ready_for_scoring_job"] is False assert plan["scoring_job_created"] is False assert plan["score_calculation_executed"] is False @@ -17416,7 +17525,7 @@ def test_opportunity_scoring_plan_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "opportunity_scoring_plan_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["scoring_job_created"] is False assert data["score_calculation_executed"] is False assert data["sample_scores_generated"] is False @@ -17428,7 +17537,7 @@ def test_opportunity_evidence_plan_preview_blocks_queries_and_alerts(): plan = MarketIntelService().build_opportunity_evidence_plan() assert plan["mode"] == "opportunity_evidence_plan_preview" - assert plan["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert plan["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert plan["ready_for_evidence_bundle"] is False assert plan["evidence_bundle_created"] is False assert plan["evidence_query_executed"] is False @@ -17474,7 +17583,7 @@ def test_opportunity_evidence_plan_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "opportunity_evidence_plan_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["evidence_bundle_created"] is False assert data["evidence_query_executed"] is False assert data["sample_evidence_generated"] is False @@ -17487,7 +17596,7 @@ def test_opportunity_alert_plan_preview_blocks_dispatch_and_llm_calls(): plan = MarketIntelService().build_opportunity_alert_plan() assert plan["mode"] == "opportunity_alert_plan_preview" - assert plan["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert plan["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert plan["ready_for_alert_candidates"] is False assert plan["alert_candidate_created"] is False assert plan["alert_queue_created"] is False @@ -17572,7 +17681,7 @@ def test_opportunity_alert_plan_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "opportunity_alert_plan_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["alert_candidate_created"] is False assert data["alert_queue_created"] is False assert data["review_queue_created"] is False @@ -17650,7 +17759,7 @@ def test_mcp_deploy_preflight_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "mcp_external_deploy_preflight_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["deployment_actions_executed"] is False assert data["docker_command_executed"] is False assert data["ssh_command_executed"] is False @@ -17665,7 +17774,7 @@ def test_mcp_readiness_default_is_planned_only(monkeypatch): readiness = MarketIntelService().build_mcp_readiness() assert readiness["mode"] == "mcp_readiness_planned" - assert readiness["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert readiness["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert readiness["execute_requested"] is False assert readiness["router_enabled"] is False assert readiness["external_mcp_complete"] is False @@ -18055,6 +18164,7 @@ def test_deployment_readiness_reports_app_only_release_gate(): assert readiness["checks"]["mcp_completion_audit_preview_safe"] is True assert readiness["checks"]["mcp_activation_evidence_preview_safe"] is True assert readiness["checks"]["mcp_runtime_smoke_receipt_preview_safe"] is True + assert readiness["checks"]["mcp_runtime_promotion_preview_safe"] is True assert readiness["checks"]["scheduler_plan_preview_safe"] is True assert readiness["checks"]["manual_sample_plan_preview_safe"] is True assert readiness["checks"]["manual_sample_acceptance_preview_safe"] is True @@ -18428,6 +18538,7 @@ def test_deployment_readiness_reports_app_only_release_gate(): assert "/api/market_intel/mcp_completion_audit" in readiness["production_smoke_targets"] assert "/api/market_intel/mcp_activation_evidence" in readiness["production_smoke_targets"] assert "/api/market_intel/mcp_runtime_smoke_receipt" in readiness["production_smoke_targets"] + assert "/api/market_intel/mcp_runtime_promotion" in readiness["production_smoke_targets"] assert "/api/market_intel/scheduler_plan" in readiness["production_smoke_targets"] assert "/api/market_intel/manual_sample_plan" in readiness["production_smoke_targets"] assert "/api/market_intel/manual_sample_acceptance" in readiness["production_smoke_targets"] @@ -18777,6 +18888,13 @@ def test_deployment_readiness_reports_app_only_release_gate(): assert readiness["mcp_runtime_smoke_receipt"]["api_executes_health_check"] is False assert readiness["mcp_runtime_smoke_receipt"]["api_writes_database"] is False assert readiness["mcp_runtime_smoke_receipt"]["api_uses_external_network"] is False + assert readiness["mcp_runtime_promotion"]["mode"] == "mcp_runtime_promotion_preview" + assert readiness["mcp_runtime_promotion"]["promotion_payload_received"] is False + assert readiness["mcp_runtime_promotion"]["payload_persisted"] is False + assert readiness["mcp_runtime_promotion"]["promotion_persisted"] is False + assert readiness["mcp_runtime_promotion"]["api_executes_health_check"] is False + assert readiness["mcp_runtime_promotion"]["api_writes_database"] is False + assert readiness["mcp_runtime_promotion"]["api_uses_external_network"] is False assert readiness["manual_sample_plan"]["mode"] == "manual_sample_fetch_plan_preview" assert readiness["manual_sample_plan"]["sample_fetch_executed"] is False assert readiness["manual_sample_plan"]["external_network_executed"] is False @@ -22396,7 +22514,7 @@ def test_migration_apply_drill_planned_is_safe_and_manual_only(): drill = MarketIntelService().build_migration_apply_drill() assert drill["mode"] == "migration_apply_drill_preview" - assert drill["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert drill["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert drill["execute_requested"] is False assert drill["schema_state"] == "planned_no_db_probe" assert drill["drill_ready_for_operator_review"] is True @@ -22511,7 +22629,7 @@ def test_migration_apply_drill_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "migration_apply_drill_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["migration_executed"] is False assert data["rollback_executed"] is False @@ -22523,7 +22641,7 @@ def test_migration_catalog_review_planned_is_safe_and_diagnostic(): review = MarketIntelService().build_migration_catalog_review() assert review["mode"] == "migration_catalog_review_preview" - assert review["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert review["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert review["execute_requested"] is False assert review["catalog_state"] == "planned_no_probe" assert review["seed_state"] == "planned_no_probe" @@ -22638,7 +22756,7 @@ def test_migration_catalog_review_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "migration_catalog_review_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["catalog_state"] == "planned_no_probe" assert data["migration_executed"] is False @@ -22651,7 +22769,7 @@ def test_migration_live_smoke_planned_is_preview_only(): smoke = MarketIntelService().build_migration_live_smoke() assert smoke["mode"] == "migration_live_smoke_preview" - assert smoke["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert smoke["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert smoke["execute_requested"] is False assert smoke["smoke_result"] == "planned_no_execution" assert smoke["live_smoke_passed"] is False @@ -22713,7 +22831,7 @@ def test_migration_live_smoke_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "migration_live_smoke_preview" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["smoke_result"] == "planned_no_execution" assert data["migration_executed"] is False @@ -22726,7 +22844,7 @@ def test_live_db_inventory_planned_is_preview_only(): inventory = MarketIntelService().build_live_db_inventory() assert inventory["mode"] == "live_db_inventory_planned" - assert inventory["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert inventory["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert inventory["execute_requested"] is False assert inventory["read_only_query_executed"] is False assert inventory["database_connection_opened"] is False @@ -22870,7 +22988,7 @@ def test_live_db_inventory_route_is_preview_only(): assert response.status_code == 200 assert data["mode"] == "live_db_inventory_planned" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["read_only_query_executed"] is False assert data["database_write_executed"] is False @@ -23106,7 +23224,7 @@ def test_candidate_queue_writer_cli_script_outputs_blocked_gate(tmp_path): assert result.returncode == 0 assert data["mode"] == "candidate_queue_writer_cli_blocked" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["apply_real_write_requested"] is False assert data["writes_executed"] is False @@ -23135,7 +23253,7 @@ def test_review_decision_writer_cli_script_outputs_blocked_gate_without_login_en assert result.returncode == 0 assert data["mode"] == "candidate_queue_review_decision_writer_cli_blocked" - assert data["phase"] == "phase_118_market_intel_mcp_runtime_smoke_receipt" + assert data["phase"] == "phase_119_market_intel_mcp_runtime_promotion" assert data["execute_requested"] is False assert data["apply_real_write_requested"] is False assert data["approval_token_present"] is False