"""市場情報 app-only release gate 組裝器;只組裝 preview payload,不執行 git、部署、SSH、migration 或 DB write。""" from services.market_intel.ai_controlled_route_aliases import ( AI_CONTROLLED_CANONICAL_SMOKE_TARGETS, AI_CONTROLLED_ROUTE_ALIASES, ) from services.market_intel.ai_controlled_service_compat import ( compatibility_flag, mcp_fetch_handoff_key, mcp_fetch_handoff_preview_builder, sample_payload_key, ) from services.market_intel.candidate_queue_writer_cli import build_candidate_queue_writer_cli_plan from services.market_intel.candidate_queue_writer_preflight import build_candidate_queue_writer_preflight from services.market_intel.candidate_queue_writer_postwrite_smoke import build_candidate_queue_writer_postwrite_smoke from services.market_intel.candidate_queue_writer_operator_drill import build_candidate_queue_writer_operator_drill from services.market_intel.candidate_queue_writer_run_package import build_candidate_queue_writer_run_package from services.market_intel.candidate_queue_writer_run_readiness import build_candidate_queue_writer_run_readiness from services.market_intel.candidate_queue_writer_run_receipt import build_candidate_queue_writer_run_receipt 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.candidate_queue_review_inventory import build_candidate_queue_review_inventory from services.market_intel.candidate_queue_review_decision import build_candidate_queue_review_decision from services.market_intel.candidate_queue_review_decision_approval import build_candidate_queue_review_decision_approval from services.market_intel.candidate_queue_review_decision_transaction import build_candidate_queue_review_decision_transaction from services.market_intel.candidate_queue_review_decision_writer_cli import build_candidate_queue_review_decision_writer_cli_plan from services.market_intel.candidate_queue_review_decision_writer_preflight import build_candidate_queue_review_decision_writer_preflight from services.market_intel.candidate_queue_review_decision_writer_postwrite_smoke import build_candidate_queue_review_decision_writer_postwrite_smoke from services.market_intel.candidate_queue_review_decision_writer_operator_drill import build_candidate_queue_review_decision_writer_operator_drill from services.market_intel.candidate_queue_review_decision_writer_run_package import build_candidate_queue_review_decision_writer_run_package from services.market_intel.candidate_queue_review_decision_writer_run_readiness import build_candidate_queue_review_decision_writer_run_readiness from services.market_intel.candidate_queue_review_decision_writer_run_receipt import build_candidate_queue_review_decision_writer_run_receipt from services.market_intel.candidate_queue_review_decision_writer_run_closeout import build_candidate_queue_review_decision_writer_run_closeout from services.market_intel.candidate_queue_review_decision_post_closeout_inventory import build_candidate_queue_review_decision_post_closeout_inventory from services.market_intel.candidate_queue_review_completion_archive import build_candidate_queue_review_completion_archive from services.market_intel.candidate_queue_review_archive_summary import build_candidate_queue_review_archive_summary from services.market_intel.candidate_queue_review_ai_summary_preflight import build_candidate_queue_review_ai_summary_preflight from services.market_intel.candidate_queue_review_ai_summary_output_receipt import build_candidate_queue_review_ai_summary_output_receipt from services.market_intel.candidate_queue_review_ai_summary_persistence_preflight import build_candidate_queue_review_ai_summary_persistence_preflight from services.market_intel.candidate_queue_review_ai_summary_persistence_run_package import build_candidate_queue_review_ai_summary_persistence_run_package from services.market_intel.candidate_queue_review_ai_summary_persistence_run_readiness import build_candidate_queue_review_ai_summary_persistence_run_readiness from services.market_intel.candidate_queue_review_ai_summary_persistence_run_receipt import build_candidate_queue_review_ai_summary_persistence_run_receipt from services.market_intel.candidate_queue_review_ai_summary_persistence_run_closeout import build_candidate_queue_review_ai_summary_persistence_run_closeout from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout import build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout from services.market_intel.candidate_queue_review_ai_summary_persistence_transaction import build_candidate_queue_review_ai_summary_persistence_transaction 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_fetch_target_review import ( build_mcp_fetch_target_review_preview, ) from services.market_intel.mcp_fetch_target_source_governance_review import ( build_mcp_fetch_target_source_governance_review_preview, ) from services.market_intel.mcp_fetch_run_package import ( build_mcp_fetch_run_package_preview, ) from services.market_intel.mcp_fetch_run_readiness import ( build_mcp_fetch_run_readiness_preview, ) from services.market_intel.mcp_fetch_run_receipt import ( build_mcp_fetch_run_receipt_preview, ) from services.market_intel.mcp_fetch_result_parser_review import ( build_mcp_fetch_result_parser_review_preview, ) from services.market_intel.mcp_fetch_candidate_handoff_review import ( build_mcp_fetch_candidate_handoff_review_preview, ) from services.market_intel.mcp_fetch_candidate_queue_review import ( build_mcp_fetch_candidate_queue_review_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_preflight import ( build_mcp_fetch_candidate_queue_writer_preflight_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_cli_review import ( build_mcp_fetch_candidate_queue_writer_cli_review_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_run_package_review import ( build_mcp_fetch_candidate_queue_writer_run_package_review_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_run_readiness import ( build_mcp_fetch_candidate_queue_writer_run_readiness_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_run_receipt_review import ( build_mcp_fetch_candidate_queue_writer_run_receipt_review_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_run_closeout_review import ( build_mcp_fetch_candidate_queue_writer_run_closeout_review_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_post_closeout_inventory_review import ( build_mcp_fetch_candidate_queue_writer_post_closeout_inventory_review_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_review_handoff import ( build_mcp_fetch_candidate_queue_writer_review_handoff_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_review_inventory import ( build_mcp_fetch_candidate_queue_writer_review_inventory_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_review_decision import ( build_mcp_fetch_candidate_queue_writer_review_decision_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_review_decision_approval import ( build_mcp_fetch_candidate_queue_writer_review_decision_approval_preview, ) from services.market_intel.mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight import ( build_mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight_preview, ) from services.market_intel.mcp_professional_source_governance import ( build_mcp_professional_source_governance_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", "ready_for_scheduler_attach", "ready_for_ai_summary_generation", "ready_for_llm_call", "ready_for_telegram_dispatch", "api_executes_cli", "api_executes_llm", "api_reads_approval_token", "api_writes_file", "api_writes_database", "api_updates_review_state", "package_artifact_created", "approval_record_written", "decision_record_written", "run_package_file_written", "summary_file_written", "summary_record_written", "summary_manifest_written", "summary_receipt_file_written", "summary_persistence_preflight_file_written", "summary_persistence_transaction_file_written", "summary_persistence_writer_preflight_file_written", "summary_persistence_run_package_file_written", "summary_persistence_run_readiness_file_written", "run_readiness_file_written", "summary_persistence_run_receipt_file_written", "run_receipt_file_written", "receipt_file_written", "summary_persistence_closeout_file_written", "closeout_file_written", "telegram_dispatch_gate_file_written", "telegram_dispatch_run_package_file_written", "telegram_dispatch_run_readiness_file_written", "telegram_dispatch_run_receipt_file_written", "telegram_dispatch_receipt_file_written", "telegram_dispatch_closeout_file_written", "telegram_dispatch_archive_file_written", "telegram_dispatch_archive_summary_file_written", "telegram_dispatch_report_input_file_written", "telegram_dispatch_report_run_package_file_written", "telegram_dispatch_report_run_readiness_file_written", "telegram_dispatch_report_run_receipt_file_written", "telegram_message_file_written", "archive_file_written", "archive_record_written", "archive_manifest_written", "archive_summary_file_written", "report_input_file_written", "report_run_package_file_written", "report_run_readiness_file_written", "report_run_receipt_file_written", "report_receipt_file_written", "report_output_file_written", "report_file_written", "report_record_written", "report_manifest_written", "telegram_dispatch_report_closeout_file_written", "report_closeout_file_written", "telegram_dispatch_report_archive_file_written", "report_archive_file_written", "report_archive_record_written", "report_archive_manifest_written", "telegram_dispatch_report_archive_summary_file_written", "report_archive_summary_file_written", "report_summary_input_file_written", "telegram_dispatch_report_catalog_handoff_file_written", "report_catalog_handoff_file_written", "catalog_handoff_file_written", "telegram_dispatch_report_catalog_index_file_written", "report_catalog_index_file_written", "catalog_index_file_written", "report_catalog_index_manifest_written", "catalog_index_manifest_written", "catalog_index_written", "catalog_manifest_written", "catalog_record_written", "report_catalog_record_written", "report_archive_summary_catalog_handoff_file_written", "telegram_dispatch_report_catalog_write_preflight_file_written", "report_catalog_write_preflight_file_written", "catalog_write_preflight_file_written", "catalog_record_write_preflight_file_written", "telegram_dispatch_report_catalog_record_write_file_written", "report_catalog_record_write_file_written", "catalog_record_write_file_written", "catalog_record_write_executed", "report_catalog_record_write_executed", "telegram_dispatch_report_catalog_record_write_gate_file_written", "report_catalog_record_write_gate_file_written", "catalog_record_write_gate_file_written", "telegram_dispatch_report_catalog_record_run_package_file_written", "report_catalog_record_run_package_file_written", "catalog_record_run_package_file_written", "catalog_record_write_receipt_file_written", "catalog_record_postwrite_smoke_executed", "catalog_record_commit_executed", "telegram_dispatch_report_catalog_record_run_readiness_file_written", "report_catalog_record_run_readiness_file_written", "catalog_record_run_readiness_file_written", "telegram_dispatch_report_catalog_record_run_readiness_gate_file_written", "report_catalog_record_run_readiness_gate_file_written", "catalog_record_run_readiness_gate_file_written", "catalog_record_run_readiness_executed", "catalog_record_run_receipt_written", "catalog_record_postwrite_smoke_written", "telegram_dispatch_report_catalog_record_run_receipt_gate_file_written", "report_catalog_record_run_receipt_gate_file_written", "catalog_record_run_receipt_gate_file_written", "catalog_record_run_receipt_executed", "catalog_record_commit_gate_file_written", "telegram_dispatch_report_catalog_record_run_receipt_file_written", "report_catalog_record_run_receipt_file_written", "catalog_record_run_receipt_file_written", "catalog_record_cli_executed", "catalog_record_writer_cli_executed", "catalog_record_postwrite_smoke_file_written", "telegram_dispatch_report_catalog_record_commit_gate_file_written", "report_catalog_record_commit_gate_file_written", "telegram_dispatch_report_catalog_record_commit_file_written", "report_catalog_record_commit_file_written", "catalog_record_commit_file_written", "catalog_record_closeout_gate_file_written", "telegram_dispatch_report_catalog_record_closeout_gate_file_written", "report_catalog_record_closeout_gate_file_written", "telegram_dispatch_report_catalog_record_closeout_file_written", "report_catalog_record_closeout_file_written", "catalog_record_closeout_file_written", "catalog_record_closeout_executed", "catalog_record_archive_gate_file_written", "telegram_dispatch_report_catalog_record_archive_gate_file_written", "report_catalog_record_archive_gate_file_written", "telegram_dispatch_report_catalog_record_archive_file_written", "report_catalog_record_archive_file_written", "catalog_record_archive_file_written", "catalog_record_archive_record_written", "catalog_record_archive_manifest_written", "catalog_record_archive_executed", "catalog_record_archive_summary_gate_file_written", "telegram_dispatch_report_catalog_record_archive_summary_gate_file_written", "report_catalog_record_archive_summary_gate_file_written", "telegram_dispatch_report_catalog_record_archive_summary_file_written", "report_catalog_record_archive_summary_file_written", "catalog_record_archive_summary_file_written", "catalog_record_archive_summary_record_written", "catalog_record_archive_summary_executed", "catalog_record_final_closeout_gate_file_written", "telegram_dispatch_report_catalog_record_final_closeout_gate_file_written", "report_catalog_record_final_closeout_gate_file_written", "telegram_dispatch_report_catalog_record_final_closeout_file_written", "report_catalog_record_final_closeout_file_written", "catalog_record_final_closeout_file_written", "catalog_record_final_closeout_record_written", "catalog_record_final_closeout_executed", "catalog_record_pipeline_completion_record_written", "market_intel_catalog_record_pipeline_completed_by_api", "summary_persistence_record_written", "metadata_patch_written", "transaction_file_written", "writer_preflight_file_written", "ai_summary_generated", "llm_call_executed", "ollama_call_executed", "gemini_call_executed", "telegram_dispatched", "telegram_dispatch_attempted", "review_state_update_executed", "database_connection_opened", "database_session_created", "explicit_transaction_opened", "transaction_opened", "transaction_committed", "database_write_executed", "database_commit_executed", "database_rollback_executed", "scheduler_attached", "writes_executed", "would_write_database", ) BASE_PRODUCTION_SMOKE_TARGETS = ( "/health", "/market_intel", "/api/market_intel/status", "/api/market_intel/deployment_readiness", "/api/market_intel/schema_smoke", "/api/market_intel/schema_db_probe", "/api/market_intel/platform_seed_db_diff", "/api/market_intel/legacy_source_bridge", "/api/market_intel/mcp_readiness", "/api/market_intel/mcp_tool_contract", "/api/market_intel/mcp_deploy_preflight", "/api/market_intel/mcp_activation_runbook", "/api/market_intel/mcp_fetch_gate", "/api/market_intel/mcp_completion_audit", "/api/market_intel/mcp_activation_evidence", "/api/market_intel/scheduler_plan", "/api/market_intel/match_review_plan", "/api/market_intel/opportunity_plan", "/api/market_intel/opportunity_scoring_plan", "/api/market_intel/opportunity_evidence_plan", "/api/market_intel/opportunity_alert_plan", "/api/market_intel/migration_apply_drill", "/api/market_intel/migration_catalog_review", "/api/market_intel/migration_live_smoke", "/api/market_intel/live_db_inventory", "/api/market_intel/mcp_runtime_smoke_receipt", "/api/market_intel/mcp_runtime_promotion", ) LEGACY_ROUTE_ALIAS_EXCLUDED_SMOKE_NAMES = { "sample_review_evaluate", "candidate_handoff", "candidate_queue_draft", "candidate_queue_approval", "candidate_queue_transaction", "candidate_queue_writer_status", "candidate_queue_writer_preflight", } LEGACY_ROUTE_ALIAS_SMOKE_TARGETS = tuple( alias.legacy_path for alias in AI_CONTROLLED_ROUTE_ALIASES if alias.name not in LEGACY_ROUTE_ALIAS_EXCLUDED_SMOKE_NAMES ) PRODUCTION_SMOKE_TARGETS = tuple( dict.fromkeys(BASE_PRODUCTION_SMOKE_TARGETS + LEGACY_ROUTE_ALIAS_SMOKE_TARGETS) ) 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): """建立市場情報推版準備狀態;不執行 git、部署或遠端操作。""" status = service.get_runtime_status() schema_smoke = schema_smoke_builder(market_intel_tables) writer_plan = service.build_platform_seed_writer_plan() mcp_deploy_preflight = service.build_mcp_deploy_preflight() mcp_activation_runbook = service.build_mcp_activation_runbook() mcp_fetch_gate = service.build_mcp_fetch_gate() mcp_completion_audit = service.build_mcp_completion_audit() mcp_activation_evidence = build_mcp_activation_evidence_preview( phase=service.phase, ) mcp_runtime_smoke_receipt = build_mcp_runtime_smoke_receipt_preview( phase=service.phase, ) mcp_runtime_promotion = build_mcp_runtime_promotion_preview( phase=service.phase, ) mcp_fetch_handoff = mcp_fetch_handoff_preview_builder()( runtime_status=status, phase=service.phase, ) mcp_fetch_target_review = build_mcp_fetch_target_review_preview( phase=service.phase, ) mcp_fetch_run_package = build_mcp_fetch_run_package_preview( phase=service.phase, ) mcp_fetch_run_readiness = build_mcp_fetch_run_readiness_preview( phase=service.phase, ) mcp_fetch_run_receipt = build_mcp_fetch_run_receipt_preview( phase=service.phase, ) mcp_fetch_result_parser_review = build_mcp_fetch_result_parser_review_preview( phase=service.phase, ) mcp_fetch_candidate_handoff_review = ( build_mcp_fetch_candidate_handoff_review_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_review = ( build_mcp_fetch_candidate_queue_review_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_preflight = ( build_mcp_fetch_candidate_queue_writer_preflight_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_cli_review = ( build_mcp_fetch_candidate_queue_writer_cli_review_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_run_package_review = ( build_mcp_fetch_candidate_queue_writer_run_package_review_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_run_readiness = ( build_mcp_fetch_candidate_queue_writer_run_readiness_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_run_receipt_review = ( build_mcp_fetch_candidate_queue_writer_run_receipt_review_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_run_closeout_review = ( build_mcp_fetch_candidate_queue_writer_run_closeout_review_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_post_closeout_inventory_review = ( build_mcp_fetch_candidate_queue_writer_post_closeout_inventory_review_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_review_handoff = ( build_mcp_fetch_candidate_queue_writer_review_handoff_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_review_inventory = ( build_mcp_fetch_candidate_queue_writer_review_inventory_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_review_decision = ( build_mcp_fetch_candidate_queue_writer_review_decision_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_review_decision_approval = ( build_mcp_fetch_candidate_queue_writer_review_decision_approval_preview( phase=service.phase, ) ) mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight = ( build_mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight_preview( phase=service.phase, ) ) mcp_professional_source_governance = ( build_mcp_professional_source_governance_preview( phase=service.phase, ) ) mcp_fetch_target_source_governance_review = ( build_mcp_fetch_target_source_governance_review_preview( phase=service.phase, ) ) scheduler_plan = service.build_scheduler_plan() sample_plan = service.build_ai_controlled_sample_plan() sample_acceptance = service.build_ai_controlled_sample_acceptance() sample_review = service.build_ai_controlled_sample_review() sample_review_evaluation = service.build_ai_controlled_sample_review_evaluation(sample_result={}) sample_candidate_handoff = service.build_ai_controlled_sample_candidate_handoff(sample_result={}) sample_candidate_queue_draft = service.build_ai_controlled_sample_candidate_queue_draft(sample_result={}) sample_candidate_queue_approval = service.build_ai_controlled_sample_candidate_queue_approval(sample_result={}) sample_candidate_queue_transaction = service.build_ai_controlled_sample_candidate_queue_transaction(sample_result={}) candidate_queue_writer_preflight = build_candidate_queue_writer_preflight( transaction_preview=sample_candidate_queue_transaction, execute_requested=False, ) candidate_queue_writer_cli_status = build_candidate_queue_writer_cli_plan( transaction_preview=sample_candidate_queue_transaction, writer_preflight=candidate_queue_writer_preflight, ) candidate_queue_writer_postwrite_smoke = build_candidate_queue_writer_postwrite_smoke( transaction_preview=sample_candidate_queue_transaction, execute_requested=False, ) candidate_queue_writer_operator_drill = ( build_candidate_queue_writer_operator_drill( transaction_preview=sample_candidate_queue_transaction, writer_preflight=candidate_queue_writer_preflight, writer_status=candidate_queue_writer_cli_status, postwrite_smoke=candidate_queue_writer_postwrite_smoke, ) ) candidate_queue_writer_run_package = build_candidate_queue_writer_run_package( transaction_preview=sample_candidate_queue_transaction, writer_preflight=candidate_queue_writer_preflight, writer_status=candidate_queue_writer_cli_status, postwrite_smoke=candidate_queue_writer_postwrite_smoke, operator_drill=candidate_queue_writer_operator_drill, ) candidate_queue_writer_run_readiness = build_candidate_queue_writer_run_readiness( transaction_preview=sample_candidate_queue_transaction, writer_preflight=candidate_queue_writer_preflight, writer_status=candidate_queue_writer_cli_status, postwrite_smoke=candidate_queue_writer_postwrite_smoke, operator_drill=candidate_queue_writer_operator_drill, run_package=candidate_queue_writer_run_package, ) candidate_queue_writer_run_receipt = build_candidate_queue_writer_run_receipt( transaction_preview=sample_candidate_queue_transaction, run_readiness=candidate_queue_writer_run_readiness, ) candidate_queue_writer_run_closeout = build_candidate_queue_writer_run_closeout( transaction_preview=sample_candidate_queue_transaction, run_receipt=candidate_queue_writer_run_receipt, ) candidate_queue_review_handoff = build_candidate_queue_review_handoff( transaction_preview=sample_candidate_queue_transaction, run_closeout=candidate_queue_writer_run_closeout, ) match_review_plan = service.build_match_review_plan() opportunity_plan = service.build_opportunity_plan() opportunity_scoring_plan = service.build_opportunity_scoring_plan() opportunity_evidence_plan = service.build_opportunity_evidence_plan() opportunity_alert_plan = service.build_opportunity_alert_plan() migration_apply_drill = service.build_migration_apply_drill() migration_catalog_review = service.build_migration_catalog_review() migration_live_smoke = service.build_migration_live_smoke() live_db_inventory = service.build_live_db_inventory() candidate_queue_review_inventory = build_candidate_queue_review_inventory( review_handoff=candidate_queue_review_handoff, postwrite_smoke=candidate_queue_writer_postwrite_smoke, live_db_inventory=live_db_inventory, ) candidate_queue_review_decision = build_candidate_queue_review_decision( review_inventory=candidate_queue_review_inventory, ) candidate_queue_review_decision_approval = build_candidate_queue_review_decision_approval(review_decision=candidate_queue_review_decision) candidate_queue_review_decision_transaction = build_candidate_queue_review_decision_transaction(decision_approval=candidate_queue_review_decision_approval) candidate_queue_review_decision_writer_status = build_candidate_queue_review_decision_writer_cli_plan(transaction_preview=candidate_queue_review_decision_transaction) candidate_queue_review_decision_writer_preflight = build_candidate_queue_review_decision_writer_preflight( writer_status=candidate_queue_review_decision_writer_status, transaction_preview=candidate_queue_review_decision_transaction, ) candidate_queue_review_decision_writer_postwrite_smoke = build_candidate_queue_review_decision_writer_postwrite_smoke( transaction_preview=candidate_queue_review_decision_transaction, execute_requested=False, ) candidate_queue_review_decision_writer_operator_drill = build_candidate_queue_review_decision_writer_operator_drill( transaction_preview=candidate_queue_review_decision_transaction, writer_preflight=candidate_queue_review_decision_writer_preflight, writer_status=candidate_queue_review_decision_writer_status, postwrite_smoke=candidate_queue_review_decision_writer_postwrite_smoke, ) candidate_queue_review_decision_writer_run_package = build_candidate_queue_review_decision_writer_run_package( transaction_preview=candidate_queue_review_decision_transaction, writer_preflight=candidate_queue_review_decision_writer_preflight, writer_status=candidate_queue_review_decision_writer_status, postwrite_smoke=candidate_queue_review_decision_writer_postwrite_smoke, operator_drill=candidate_queue_review_decision_writer_operator_drill, ) candidate_queue_review_decision_writer_run_readiness = build_candidate_queue_review_decision_writer_run_readiness( transaction_preview=candidate_queue_review_decision_transaction, writer_preflight=candidate_queue_review_decision_writer_preflight, writer_status=candidate_queue_review_decision_writer_status, postwrite_smoke=candidate_queue_review_decision_writer_postwrite_smoke, operator_drill=candidate_queue_review_decision_writer_operator_drill, run_package=candidate_queue_review_decision_writer_run_package, ) candidate_queue_review_decision_writer_run_receipt = build_candidate_queue_review_decision_writer_run_receipt( transaction_preview=candidate_queue_review_decision_transaction, run_readiness=candidate_queue_review_decision_writer_run_readiness, ) candidate_queue_review_decision_writer_run_closeout = build_candidate_queue_review_decision_writer_run_closeout( transaction_preview=candidate_queue_review_decision_transaction, run_receipt=candidate_queue_review_decision_writer_run_receipt, ) candidate_queue_review_decision_post_closeout_inventory = build_candidate_queue_review_decision_post_closeout_inventory( transaction_preview=candidate_queue_review_decision_transaction, run_closeout=candidate_queue_review_decision_writer_run_closeout, postwrite_smoke=candidate_queue_review_decision_writer_postwrite_smoke, live_db_inventory=live_db_inventory, ) candidate_queue_review_completion_archive = build_candidate_queue_review_completion_archive( transaction_preview=candidate_queue_review_decision_transaction, run_receipt=candidate_queue_review_decision_writer_run_receipt, run_closeout=candidate_queue_review_decision_writer_run_closeout, post_closeout_inventory=candidate_queue_review_decision_post_closeout_inventory, ) candidate_queue_review_archive_summary = build_candidate_queue_review_archive_summary( review_completion_archive=candidate_queue_review_completion_archive, ) candidate_queue_review_ai_summary_preflight = build_candidate_queue_review_ai_summary_preflight( archive_summary=candidate_queue_review_archive_summary, ) candidate_queue_review_ai_summary_run_package = build_candidate_queue_review_ai_summary_run_package( archive_summary=candidate_queue_review_archive_summary, ai_summary_preflight=candidate_queue_review_ai_summary_preflight, ) candidate_queue_review_ai_summary_output_receipt = build_candidate_queue_review_ai_summary_output_receipt( ai_summary_run_package=candidate_queue_review_ai_summary_run_package, ) candidate_queue_review_ai_summary_persistence_preflight = build_candidate_queue_review_ai_summary_persistence_preflight(ai_summary_output_receipt=candidate_queue_review_ai_summary_output_receipt) candidate_queue_review_ai_summary_persistence_transaction = build_candidate_queue_review_ai_summary_persistence_transaction(ai_summary_persistence_preflight=candidate_queue_review_ai_summary_persistence_preflight) candidate_queue_review_ai_summary_persistence_writer_preflight = build_candidate_queue_review_ai_summary_persistence_writer_preflight(ai_summary_persistence_transaction=candidate_queue_review_ai_summary_persistence_transaction) candidate_queue_review_ai_summary_persistence_run_package = build_candidate_queue_review_ai_summary_persistence_run_package(ai_summary_persistence_writer_preflight=candidate_queue_review_ai_summary_persistence_writer_preflight) candidate_queue_review_ai_summary_persistence_run_readiness = build_candidate_queue_review_ai_summary_persistence_run_readiness(ai_summary_persistence_run_package=candidate_queue_review_ai_summary_persistence_run_package) candidate_queue_review_ai_summary_persistence_run_receipt = build_candidate_queue_review_ai_summary_persistence_run_receipt(ai_summary_persistence_run_readiness=candidate_queue_review_ai_summary_persistence_run_readiness) candidate_queue_review_ai_summary_persistence_run_closeout = build_candidate_queue_review_ai_summary_persistence_run_closeout(run_receipt=candidate_queue_review_ai_summary_persistence_run_receipt) candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate(summary_persistence_closeout=candidate_queue_review_ai_summary_persistence_run_closeout) candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package(telegram_dispatch_gate=candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate) candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness(telegram_dispatch_run_package=candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package) candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt(telegram_dispatch_run_readiness=candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness) candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout(telegram_dispatch_run_receipt=candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt) candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive(telegram_dispatch_closeout=candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout) candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary(telegram_dispatch_archive=candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input(telegram_dispatch_archive_summary=candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package(telegram_dispatch_report_input=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness(telegram_dispatch_report_run_package=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt(telegram_dispatch_report_run_readiness=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout(telegram_dispatch_report_run_receipt=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive(telegram_dispatch_report_closeout=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary(telegram_dispatch_report_archive=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff(telegram_dispatch_report_archive_summary=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index(telegram_dispatch_report_catalog_handoff=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight(telegram_dispatch_report_catalog_index=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write(telegram_dispatch_report_catalog_write_preflight=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package(telegram_dispatch_report_catalog_record_write=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness(telegram_dispatch_report_catalog_record_run_package=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt(telegram_dispatch_report_catalog_record_run_readiness=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit(telegram_dispatch_report_catalog_record_run_receipt=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout(telegram_dispatch_report_catalog_record_commit=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive(telegram_dispatch_report_catalog_record_closeout=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary(telegram_dispatch_report_catalog_record_archive=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive) candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout(telegram_dispatch_report_catalog_record_archive_summary=candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary) checks = { "schema_smoke_passed": bool(schema_smoke["passed"]), "feature_flags_default_safe": bool( not status.enabled and not status.crawler_enabled and not status.write_enabled ), "database_write_blocked": bool(not status.database_write_allowed), "scheduler_detached": bool(not status.scheduler_attached), compatibility_flag("fetch_disabled"): bool(not service.ai_controlled_fetch_allowed()), "writer_plan_dry_run_only": bool( writer_plan["mode"] == "dry_run" and not writer_plan["writes_executed"] and not writer_plan["would_write_database"] ), "registered_adapters_present": bool(len(service.get_adapter_summaries()) >= 4), "schema_db_probe_planned_safe": bool( not service.build_schema_db_probe()["read_only_query_executed"] ), "platform_seed_db_diff_planned_safe": bool( not service.build_platform_seed_db_diff()["read_only_query_executed"] ), "legacy_source_bridge_planned_safe": bool( not service.build_legacy_source_bridge()["read_only_query_executed"] ), "mcp_readiness_planned_safe": bool( service.build_mcp_readiness()["mode"] == "mcp_readiness_planned" ), "mcp_tool_contract_ready": bool( service.build_mcp_tool_contract()["contract_ready"] ), "mcp_deploy_preflight_preview_safe": bool( mcp_deploy_preflight["mode"] == "mcp_external_deploy_preflight_preview" and not mcp_deploy_preflight["deployment_actions_executed"] ), "mcp_activation_runbook_preview_safe": bool( mcp_activation_runbook["mode"] == "mcp_activation_runbook_preview" and not mcp_activation_runbook["deployment_actions_executed"] ), "mcp_fetch_gate_preview_safe": bool( mcp_fetch_gate["mode"] == "mcp_fetch_gate_planned" and not mcp_fetch_gate["network_request_allowed"] and not mcp_fetch_gate["external_network_executed"] ), "mcp_completion_audit_preview_safe": bool( mcp_completion_audit["mode"] == "mcp_completion_audit_preview" and mcp_completion_audit["audit_preview_safe"] and not mcp_completion_audit["api_executes_health_check"] and not mcp_completion_audit["api_executes_docker"] and not mcp_completion_audit["api_opens_database_connection"] and not mcp_completion_audit["api_writes_database"] and not mcp_completion_audit["api_uses_external_network"] ), "mcp_activation_evidence_preview_safe": bool( mcp_activation_evidence["mode"] == "mcp_activation_evidence_preview" and not mcp_activation_evidence["payload_persisted"] and not mcp_activation_evidence["evidence_persisted"] and not mcp_activation_evidence["api_executes_health_check"] and not mcp_activation_evidence["api_opens_database_connection"] and not mcp_activation_evidence["api_writes_database"] and not mcp_activation_evidence["api_uses_external_network"] ), "mcp_runtime_smoke_receipt_preview_safe": bool( mcp_runtime_smoke_receipt["mode"] == "mcp_runtime_smoke_receipt_preview" and not mcp_runtime_smoke_receipt["payload_persisted"] and not mcp_runtime_smoke_receipt["receipt_persisted"] and not mcp_runtime_smoke_receipt["api_executes_health_check"] and not mcp_runtime_smoke_receipt["api_opens_database_connection"] 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"] ), f"{mcp_fetch_handoff_key()}_preview_safe": bool( mcp_fetch_handoff["mode"] == f"{mcp_fetch_handoff_key()}_preview" and not mcp_fetch_handoff["payload_persisted"] and not mcp_fetch_handoff["handoff_persisted"] and not mcp_fetch_handoff[compatibility_flag("fetch_gate_opened_by_api")] and not mcp_fetch_handoff["network_request_allowed"] and not mcp_fetch_handoff["api_opens_database_connection"] and not mcp_fetch_handoff["api_writes_database"] and not mcp_fetch_handoff["api_uses_external_network"] ), "mcp_fetch_target_review_preview_safe": bool( mcp_fetch_target_review["mode"] == "mcp_fetch_target_review_preview" and not mcp_fetch_target_review["payload_persisted"] and not mcp_fetch_target_review["target_review_persisted"] and not mcp_fetch_target_review[compatibility_flag("fetch_gate_opened_by_api")] and not mcp_fetch_target_review["network_request_allowed"] and not mcp_fetch_target_review["api_opens_database_connection"] and not mcp_fetch_target_review["api_writes_database"] and not mcp_fetch_target_review["api_uses_external_network"] and not mcp_fetch_target_review["database_write_executed"] and not mcp_fetch_target_review["fetch_executed"] and not mcp_fetch_target_review["scheduler_attached"] ), "mcp_fetch_run_package_preview_safe": bool( mcp_fetch_run_package["mode"] == "mcp_fetch_run_package_preview" and not mcp_fetch_run_package["payload_persisted"] and not mcp_fetch_run_package["run_package_persisted"] and not mcp_fetch_run_package["command_preview_persisted"] and not mcp_fetch_run_package["package_artifact_created"] and not mcp_fetch_run_package[compatibility_flag("fetch_gate_opened_by_api")] and not mcp_fetch_run_package["network_request_allowed"] and not mcp_fetch_run_package["api_executes_cli"] and not mcp_fetch_run_package["api_opens_database_connection"] and not mcp_fetch_run_package["api_writes_database"] and not mcp_fetch_run_package["api_uses_external_network"] and not mcp_fetch_run_package["database_write_executed"] and not mcp_fetch_run_package["fetch_executed"] and not mcp_fetch_run_package["cli_executed"] and not mcp_fetch_run_package["file_written"] and not mcp_fetch_run_package["scheduler_attached"] ), "mcp_fetch_run_readiness_preview_safe": bool( mcp_fetch_run_readiness["mode"] == "mcp_fetch_run_readiness_preview" and not mcp_fetch_run_readiness["payload_persisted"] and not mcp_fetch_run_readiness["run_readiness_persisted"] and not mcp_fetch_run_readiness["run_readiness_artifact_created"] and not mcp_fetch_run_readiness["run_readiness_file_written"] and not mcp_fetch_run_readiness["receipt_file_written"] and not mcp_fetch_run_readiness[compatibility_flag("fetch_gate_opened_by_api")] and not mcp_fetch_run_readiness["network_request_allowed"] and not mcp_fetch_run_readiness["api_executes_cli"] and not mcp_fetch_run_readiness["api_opens_database_connection"] and not mcp_fetch_run_readiness["api_writes_database"] and not mcp_fetch_run_readiness["api_uses_external_network"] and not mcp_fetch_run_readiness["database_write_executed"] and not mcp_fetch_run_readiness["fetch_executed"] and not mcp_fetch_run_readiness["cli_executed"] and not mcp_fetch_run_readiness["file_written"] and not mcp_fetch_run_readiness["scheduler_attached"] ), "mcp_fetch_run_receipt_preview_safe": bool( mcp_fetch_run_receipt["mode"] == "mcp_fetch_run_receipt_preview" and not mcp_fetch_run_receipt["payload_persisted"] and not mcp_fetch_run_receipt["run_receipt_persisted"] and not mcp_fetch_run_receipt["receipt_persisted"] and not mcp_fetch_run_receipt["run_receipt_file_written"] and not mcp_fetch_run_receipt["receipt_file_written"] and not mcp_fetch_run_receipt[compatibility_flag("fetch_gate_opened_by_api")] and not mcp_fetch_run_receipt["network_request_allowed"] and not mcp_fetch_run_receipt["api_executes_cli"] and not mcp_fetch_run_receipt["api_opens_database_connection"] and not mcp_fetch_run_receipt["api_writes_database"] and not mcp_fetch_run_receipt["api_uses_external_network"] and not mcp_fetch_run_receipt["database_write_executed"] and not mcp_fetch_run_receipt["fetch_executed"] and not mcp_fetch_run_receipt["fetch_executed_by_api"] and not mcp_fetch_run_receipt["cli_executed"] and not mcp_fetch_run_receipt["file_written"] and not mcp_fetch_run_receipt["scheduler_attached"] ), "mcp_fetch_result_parser_review_preview_safe": bool( mcp_fetch_result_parser_review["mode"] == "mcp_fetch_result_parser_review_preview" and not mcp_fetch_result_parser_review["payload_persisted"] and not mcp_fetch_result_parser_review["result_parser_persisted"] and not mcp_fetch_result_parser_review["result_parser_file_written"] and not mcp_fetch_result_parser_review["candidate_handoff_persisted"] and not mcp_fetch_result_parser_review[compatibility_flag("fetch_gate_opened_by_api")] and not mcp_fetch_result_parser_review["network_request_allowed"] and not mcp_fetch_result_parser_review["parser_executed_by_api"] and not mcp_fetch_result_parser_review["api_executes_cli"] and not mcp_fetch_result_parser_review["api_opens_database_connection"] and not mcp_fetch_result_parser_review["api_writes_database"] and not mcp_fetch_result_parser_review["api_uses_external_network"] and not mcp_fetch_result_parser_review["database_write_executed"] and not mcp_fetch_result_parser_review["fetch_executed"] and not mcp_fetch_result_parser_review["cli_executed"] and not mcp_fetch_result_parser_review["file_written"] and not mcp_fetch_result_parser_review["scheduler_attached"] ), "mcp_fetch_candidate_handoff_review_preview_safe": bool( mcp_fetch_candidate_handoff_review["mode"] == "mcp_fetch_candidate_handoff_review_preview" and not mcp_fetch_candidate_handoff_review["payload_persisted"] and not mcp_fetch_candidate_handoff_review[ "candidate_handoff_persisted" ] and not mcp_fetch_candidate_handoff_review["candidate_queue_created"] and not mcp_fetch_candidate_handoff_review["candidate_queue_persisted"] and not mcp_fetch_candidate_handoff_review[ compatibility_flag("fetch_gate_opened_by_api") ] and not mcp_fetch_candidate_handoff_review["network_request_allowed"] and not mcp_fetch_candidate_handoff_review["api_executes_cli"] and not mcp_fetch_candidate_handoff_review[ "api_opens_database_connection" ] and not mcp_fetch_candidate_handoff_review["api_writes_database"] and not mcp_fetch_candidate_handoff_review["api_uses_external_network"] and not mcp_fetch_candidate_handoff_review[ "database_write_executed" ] and not mcp_fetch_candidate_handoff_review["fetch_executed"] and not mcp_fetch_candidate_handoff_review["cli_executed"] and not mcp_fetch_candidate_handoff_review["file_written"] and not mcp_fetch_candidate_handoff_review["scheduler_attached"] ), "mcp_fetch_candidate_queue_review_preview_safe": bool( mcp_fetch_candidate_queue_review["mode"] == "mcp_fetch_candidate_queue_review_preview" and not mcp_fetch_candidate_queue_review["payload_persisted"] and not mcp_fetch_candidate_queue_review["candidate_queue_created"] and not mcp_fetch_candidate_queue_review["candidate_queue_persisted"] and not mcp_fetch_candidate_queue_review[ "candidate_review_state_updated" ] and not mcp_fetch_candidate_queue_review["network_request_allowed"] and not mcp_fetch_candidate_queue_review["api_executes_cli"] and not mcp_fetch_candidate_queue_review[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_review["api_writes_database"] and not mcp_fetch_candidate_queue_review["api_uses_external_network"] and not mcp_fetch_candidate_queue_review["database_write_executed"] and not mcp_fetch_candidate_queue_review["fetch_executed"] and not mcp_fetch_candidate_queue_review["cli_executed"] and not mcp_fetch_candidate_queue_review["file_written"] and not mcp_fetch_candidate_queue_review["scheduler_attached"] ), "scheduler_plan_preview_safe": bool( scheduler_plan["mode"] == "scheduler_attach_plan_preview" and not scheduler_plan["scheduler_registration_executed"] and not scheduler_plan["crawler_job_started"] and not scheduler_plan["database_write_executed"] ), f"{sample_payload_key('plan')}_preview_safe": bool( sample_plan["mode"] == f"{sample_payload_key('fetch_plan')}_preview" and not sample_plan["sample_fetch_executed"] and not sample_plan["external_network_executed"] and not sample_plan["database_write_executed"] and not sample_plan["database_commit_executed"] and not sample_plan["scheduler_attached"] ), f"{sample_payload_key('acceptance')}_preview_safe": bool( sample_acceptance["mode"] == f"{sample_payload_key('acceptance')}_preview" and not sample_acceptance["sample_result_loaded"] and not sample_acceptance["candidate_import_allowed"] and not sample_acceptance["external_network_executed"] and not sample_acceptance["database_write_executed"] and not sample_acceptance["database_commit_executed"] and not sample_acceptance["scheduler_attached"] ), f"{sample_payload_key('review')}_preview_safe": bool( sample_review["mode"] == f"{sample_payload_key('review')}_preview" and not sample_review["sample_result_loaded"] and not sample_review["candidate_import_allowed"] and not sample_review["external_network_executed"] and not sample_review["database_write_executed"] and not sample_review["database_commit_executed"] and not sample_review["scheduler_attached"] ), f"{sample_payload_key('review_evaluation')}_post_safe": bool( sample_review_evaluation["mode"] == f"{sample_payload_key('review_evaluation')}_preview" and sample_review_evaluation["payload_received"] and not sample_review_evaluation["payload_persisted"] and not sample_review_evaluation["sample_result_persisted"] and not sample_review_evaluation["candidate_import_allowed"] and not sample_review_evaluation["external_network_executed"] and not sample_review_evaluation["database_write_executed"] and not sample_review_evaluation["database_commit_executed"] and not sample_review_evaluation["scheduler_attached"] ), f"{sample_payload_key('candidate_handoff')}_post_safe": bool( sample_candidate_handoff["mode"] == f"{sample_payload_key('candidate_handoff')}_preview" and sample_candidate_handoff["payload_received"] and not sample_candidate_handoff["payload_persisted"] and not sample_candidate_handoff["candidate_handoff_persisted"] and not sample_candidate_handoff["candidate_import_allowed"] and not sample_candidate_handoff["external_network_executed"] and not sample_candidate_handoff["database_write_executed"] and not sample_candidate_handoff["database_commit_executed"] and not sample_candidate_handoff["scheduler_attached"] ), f"{sample_payload_key('candidate_queue_draft')}_post_safe": bool( sample_candidate_queue_draft["mode"] == f"{sample_payload_key('candidate_queue_draft')}_preview" and sample_candidate_queue_draft["payload_received"] and not sample_candidate_queue_draft["payload_persisted"] and not sample_candidate_queue_draft["review_queue_created"] and not sample_candidate_queue_draft["review_queue_persisted"] and not sample_candidate_queue_draft["candidate_import_allowed"] and not sample_candidate_queue_draft["external_network_executed"] and not sample_candidate_queue_draft["database_write_executed"] and not sample_candidate_queue_draft["database_commit_executed"] and not sample_candidate_queue_draft["scheduler_attached"] ), f"{sample_payload_key('candidate_queue_approval')}_post_safe": bool( sample_candidate_queue_approval["mode"] == f"{sample_payload_key('candidate_queue_approval')}_preview" and sample_candidate_queue_approval["payload_received"] and not sample_candidate_queue_approval["payload_persisted"] and not sample_candidate_queue_approval["approval_request_created"] and not sample_candidate_queue_approval["approval_record_written"] and not sample_candidate_queue_approval["review_queue_write_allowed"] and not sample_candidate_queue_approval["review_queue_created"] and not sample_candidate_queue_approval["review_queue_persisted"] and not sample_candidate_queue_approval["candidate_import_allowed"] and not sample_candidate_queue_approval["external_network_executed"] and not sample_candidate_queue_approval["database_write_executed"] and not sample_candidate_queue_approval["database_commit_executed"] and not sample_candidate_queue_approval["scheduler_attached"] ), f"{sample_payload_key('candidate_queue_transaction')}_post_safe": bool( sample_candidate_queue_transaction["mode"] == f"{sample_payload_key('candidate_queue_transaction')}_preview" and sample_candidate_queue_transaction["payload_received"] and not sample_candidate_queue_transaction["payload_persisted"] and not sample_candidate_queue_transaction["transaction_ready"] and not sample_candidate_queue_transaction["transaction_opened"] and not sample_candidate_queue_transaction["transaction_committed"] and not sample_candidate_queue_transaction["approval_record_written"] and not sample_candidate_queue_transaction["review_queue_created"] and not sample_candidate_queue_transaction["review_queue_persisted"] and not sample_candidate_queue_transaction["candidate_import_allowed"] and not sample_candidate_queue_transaction["external_network_executed"] and not sample_candidate_queue_transaction["database_write_executed"] and not sample_candidate_queue_transaction["database_commit_executed"] and not sample_candidate_queue_transaction["scheduler_attached"] ), "candidate_queue_writer_cli_status_safe": bool( candidate_queue_writer_cli_status["mode"] == "candidate_queue_writer_cli_blocked" and not candidate_queue_writer_cli_status["ready_for_real_write"] and not candidate_queue_writer_cli_status["writes_executed"] and not candidate_queue_writer_cli_status["would_write_database"] and not candidate_queue_writer_cli_status["database_connection_opened"] and not candidate_queue_writer_cli_status["explicit_transaction_opened"] and not candidate_queue_writer_cli_status["database_write_executed"] and not candidate_queue_writer_cli_status["database_commit_executed"] and not candidate_queue_writer_cli_status["scheduler_attached"] ), "candidate_queue_writer_preflight_planned_safe": bool( candidate_queue_writer_preflight["mode"] == "candidate_queue_writer_preflight_planned" and not candidate_queue_writer_preflight["read_only_query_executed"] and not candidate_queue_writer_preflight["database_connection_opened"] and not candidate_queue_writer_preflight["database_write_executed"] and not candidate_queue_writer_preflight["database_commit_executed"] and not candidate_queue_writer_preflight["scheduler_attached"] ), "mcp_fetch_candidate_queue_writer_preflight_preview_safe": bool( mcp_fetch_candidate_queue_writer_preflight["mode"] == "mcp_fetch_candidate_queue_writer_preflight_preview" and not mcp_fetch_candidate_queue_writer_preflight["payload_persisted"] and not mcp_fetch_candidate_queue_writer_preflight["preflight_persisted"] and not mcp_fetch_candidate_queue_writer_preflight["candidate_queue_created"] and not mcp_fetch_candidate_queue_writer_preflight["candidate_queue_persisted"] and not mcp_fetch_candidate_queue_writer_preflight["candidate_review_state_updated"] and not mcp_fetch_candidate_queue_writer_preflight["network_request_allowed"] and not mcp_fetch_candidate_queue_writer_preflight["api_executes_cli"] and not mcp_fetch_candidate_queue_writer_preflight[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_preflight["api_writes_database"] and not mcp_fetch_candidate_queue_writer_preflight[ "api_uses_external_network" ] and not mcp_fetch_candidate_queue_writer_preflight[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_preflight["cli_executed"] and not mcp_fetch_candidate_queue_writer_preflight["file_written"] and not mcp_fetch_candidate_queue_writer_preflight["scheduler_attached"] ), "mcp_fetch_candidate_queue_writer_cli_review_preview_safe": bool( mcp_fetch_candidate_queue_writer_cli_review["mode"] == "mcp_fetch_candidate_queue_writer_cli_review_preview" and not mcp_fetch_candidate_queue_writer_cli_review["payload_persisted"] and not mcp_fetch_candidate_queue_writer_cli_review["cli_review_persisted"] and not mcp_fetch_candidate_queue_writer_cli_review[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_cli_review["api_writes_file"] and not mcp_fetch_candidate_queue_writer_cli_review["api_executes_cli"] and not mcp_fetch_candidate_queue_writer_cli_review[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_cli_review[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_cli_review["api_writes_database"] and not mcp_fetch_candidate_queue_writer_cli_review[ "api_uses_external_network" ] and not mcp_fetch_candidate_queue_writer_cli_review[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_cli_review["cli_executed"] and not mcp_fetch_candidate_queue_writer_cli_review["file_written"] and not mcp_fetch_candidate_queue_writer_cli_review["scheduler_attached"] ), "mcp_fetch_candidate_queue_writer_run_package_review_preview_safe": bool( mcp_fetch_candidate_queue_writer_run_package_review["mode"] == "mcp_fetch_candidate_queue_writer_run_package_review_preview" and not mcp_fetch_candidate_queue_writer_run_package_review[ "payload_persisted" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "run_package_persisted" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "api_writes_file" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "api_executes_cli" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "api_writes_database" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "api_uses_external_network" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "cli_executed" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "file_written" ] and not mcp_fetch_candidate_queue_writer_run_package_review[ "scheduler_attached" ] ), "mcp_fetch_candidate_queue_writer_run_readiness_preview_safe": bool( mcp_fetch_candidate_queue_writer_run_readiness["mode"] == "mcp_fetch_candidate_queue_writer_run_readiness_preview" and not mcp_fetch_candidate_queue_writer_run_readiness[ "payload_persisted" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "run_readiness_persisted" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "run_readiness_artifact_created" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "run_readiness_file_written" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "api_writes_file" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "api_executes_cli" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "api_writes_database" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "api_uses_external_network" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "cli_executed" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "file_written" ] and not mcp_fetch_candidate_queue_writer_run_readiness[ "scheduler_attached" ] ), "mcp_fetch_candidate_queue_writer_run_receipt_review_preview_safe": bool( mcp_fetch_candidate_queue_writer_run_receipt_review["mode"] == "mcp_fetch_candidate_queue_writer_run_receipt_review_preview" and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "payload_persisted" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "run_receipt_persisted" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "run_receipt_file_written" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "receipt_file_written" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "api_writes_file" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "api_executes_cli" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "api_writes_database" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "api_uses_external_network" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "postwrite_query_executed_by_api" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "cli_executed" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "file_written" ] and not mcp_fetch_candidate_queue_writer_run_receipt_review[ "scheduler_attached" ] ), "mcp_fetch_candidate_queue_writer_run_closeout_review_preview_safe": bool( mcp_fetch_candidate_queue_writer_run_closeout_review["mode"] == "mcp_fetch_candidate_queue_writer_run_closeout_review_preview" and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "payload_persisted" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "run_closeout_persisted" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "run_closeout_file_written" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "closeout_file_written" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "api_writes_file" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "api_executes_cli" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "api_writes_database" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "api_uses_external_network" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "post_closeout_query_executed_by_api" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "cli_executed" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "file_written" ] and not mcp_fetch_candidate_queue_writer_run_closeout_review[ "scheduler_attached" ] ), "mcp_fetch_candidate_queue_writer_post_closeout_inventory_review_preview_safe": bool( mcp_fetch_candidate_queue_writer_post_closeout_inventory_review["mode"] == "mcp_fetch_candidate_queue_writer_post_closeout_inventory_review_preview" and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "payload_persisted" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "post_closeout_inventory_persisted" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "post_closeout_inventory_file_written" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "inventory_file_written" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "api_writes_file" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "api_executes_cli" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "api_writes_database" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "api_uses_external_network" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "api_inventory_query_executed" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "post_closeout_query_executed_by_api" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "cli_executed" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "file_written" ] and not mcp_fetch_candidate_queue_writer_post_closeout_inventory_review[ "scheduler_attached" ] ), "mcp_fetch_candidate_queue_writer_review_handoff_preview_safe": bool( mcp_fetch_candidate_queue_writer_review_handoff["mode"] == "mcp_fetch_candidate_queue_writer_review_handoff_preview" and not mcp_fetch_candidate_queue_writer_review_handoff[ "payload_persisted" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "review_handoff_persisted" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "handoff_file_written" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "api_writes_file" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "api_executes_cli" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "api_writes_database" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "api_updates_review_state" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "api_inventory_query_executed" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "database_commit_executed" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "cli_executed" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "file_written" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "scheduler_attached" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "candidate_queue_persisted" ] and not mcp_fetch_candidate_queue_writer_review_handoff[ "candidate_review_state_updated" ] ), "mcp_fetch_candidate_queue_writer_review_inventory_preview_safe": bool( mcp_fetch_candidate_queue_writer_review_inventory["mode"] == "mcp_fetch_candidate_queue_writer_review_inventory_preview" and not mcp_fetch_candidate_queue_writer_review_inventory[ "payload_persisted" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "review_inventory_persisted" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "inventory_file_written" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "api_writes_file" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "api_executes_cli" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "api_writes_database" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "api_updates_review_state" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "api_inventory_query_executed" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "database_commit_executed" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "database_connection_opened" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "cli_executed" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "file_written" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "scheduler_attached" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "candidate_queue_persisted" ] and not mcp_fetch_candidate_queue_writer_review_inventory[ "candidate_review_state_updated" ] ), "mcp_fetch_candidate_queue_writer_review_decision_preview_safe": bool( mcp_fetch_candidate_queue_writer_review_decision["mode"] == "mcp_fetch_candidate_queue_writer_review_decision_preview" and not mcp_fetch_candidate_queue_writer_review_decision[ "payload_persisted" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "review_decision_persisted" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "candidate_queue_review_decision_persisted" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "candidate_queue_review_decision_file_written" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "decision_record_written" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "decision_record_file_written" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "api_writes_file" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "api_executes_cli" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "api_writes_database" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "api_updates_review_state" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "api_writes_decision_record" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "database_commit_executed" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "database_connection_opened" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "cli_executed" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "file_written" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "scheduler_attached" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "candidate_queue_persisted" ] and not mcp_fetch_candidate_queue_writer_review_decision[ "candidate_review_state_updated" ] ), "mcp_fetch_candidate_queue_writer_review_decision_approval_preview_safe": bool( mcp_fetch_candidate_queue_writer_review_decision_approval["mode"] == "mcp_fetch_candidate_queue_writer_review_decision_approval_preview" and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "payload_persisted" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "review_decision_approval_persisted" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "candidate_queue_review_decision_approval_persisted" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "candidate_queue_review_decision_approval_file_written" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "approval_record_written" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "approval_record_file_written" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "decision_record_written" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "match_result_written" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "package_artifact_created" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "api_writes_file" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "api_executes_cli" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "api_reads_approval_token" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "api_opens_database_connection" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "api_writes_database" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "api_updates_review_state" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "api_writes_approval_record" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "api_writes_decision_record" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "api_writes_match_result" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "database_write_executed" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "database_commit_executed" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "database_connection_opened" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "cli_executed" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "file_written" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "scheduler_attached" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "candidate_queue_persisted" ] and not mcp_fetch_candidate_queue_writer_review_decision_approval[ "candidate_review_state_updated" ] ), "mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight_preview_safe": _run_review_preview_safe( mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight, "mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight_preview", ), "mcp_professional_source_governance_preview_safe": bool( mcp_professional_source_governance["mode"] == "mcp_professional_source_governance_preview" and not mcp_professional_source_governance["network_request_allowed"] and not mcp_professional_source_governance["external_network_executed"] and not mcp_professional_source_governance["api_uses_external_network"] and not mcp_professional_source_governance["api_fetches_robots_txt"] and not mcp_professional_source_governance["api_fetches_sitemap"] and not mcp_professional_source_governance["api_fetches_source_url"] and not mcp_professional_source_governance[ "api_opens_database_connection" ] and not mcp_professional_source_governance["api_writes_database"] and not mcp_professional_source_governance["api_writes_file"] and not mcp_professional_source_governance["payload_persisted"] and not mcp_professional_source_governance["scheduler_attached"] ), "mcp_fetch_target_source_governance_review_preview_safe": bool( mcp_fetch_target_source_governance_review["mode"] == "mcp_fetch_target_source_governance_review_preview" and not mcp_fetch_target_source_governance_review[ "network_request_allowed" ] and not mcp_fetch_target_source_governance_review[ "external_network_executed" ] and not mcp_fetch_target_source_governance_review["fetch_executed"] and not mcp_fetch_target_source_governance_review["payload_persisted"] and not mcp_fetch_target_source_governance_review[ "bridge_review_persisted" ] and not mcp_fetch_target_source_governance_review[ "api_fetches_robots_txt" ] and not mcp_fetch_target_source_governance_review["api_fetches_sitemap"] and not mcp_fetch_target_source_governance_review[ "api_fetches_source_url" ] and not mcp_fetch_target_source_governance_review[ "api_opens_database_connection" ] and not mcp_fetch_target_source_governance_review[ "api_writes_database" ] and not mcp_fetch_target_source_governance_review["api_writes_file"] and not mcp_fetch_target_source_governance_review["api_executes_cli"] and not mcp_fetch_target_source_governance_review["scheduler_attached"] ), "candidate_queue_writer_postwrite_smoke_planned_safe": bool( candidate_queue_writer_postwrite_smoke["mode"] == "candidate_queue_writer_postwrite_smoke_planned" and not candidate_queue_writer_postwrite_smoke["read_only_query_executed"] and not candidate_queue_writer_postwrite_smoke["database_connection_opened"] and not candidate_queue_writer_postwrite_smoke["database_write_executed"] and not candidate_queue_writer_postwrite_smoke["database_commit_executed"] and not candidate_queue_writer_postwrite_smoke["scheduler_attached"] ), "candidate_queue_writer_operator_drill_preview_safe": bool( candidate_queue_writer_operator_drill["mode"] == "candidate_queue_writer_operator_drill_preview" and not candidate_queue_writer_operator_drill["api_executes_cli"] and not candidate_queue_writer_operator_drill["api_reads_approval_token"] and not candidate_queue_writer_operator_drill["database_connection_opened"] and not candidate_queue_writer_operator_drill["database_write_executed"] and not candidate_queue_writer_operator_drill["database_commit_executed"] and not candidate_queue_writer_operator_drill["scheduler_attached"] ), "candidate_queue_writer_run_package_preview_safe": bool( candidate_queue_writer_run_package["mode"] == "candidate_queue_writer_run_package_preview" and not candidate_queue_writer_run_package["package_artifact_created"] and not candidate_queue_writer_run_package["api_writes_file"] and not candidate_queue_writer_run_package["api_executes_cli"] and not candidate_queue_writer_run_package["api_reads_approval_token"] and not candidate_queue_writer_run_package["database_connection_opened"] and not candidate_queue_writer_run_package["database_write_executed"] and not candidate_queue_writer_run_package["database_commit_executed"] and not candidate_queue_writer_run_package["scheduler_attached"] ), "candidate_queue_writer_run_readiness_preview_safe": bool( candidate_queue_writer_run_readiness["mode"] == "candidate_queue_writer_run_readiness_preview" and not candidate_queue_writer_run_readiness["ready_for_api_database_write"] and not candidate_queue_writer_run_readiness["api_executes_cli"] and not candidate_queue_writer_run_readiness["api_reads_approval_token"] and not candidate_queue_writer_run_readiness["api_writes_file"] and not candidate_queue_writer_run_readiness["database_connection_opened"] and not candidate_queue_writer_run_readiness["database_write_executed"] and not candidate_queue_writer_run_readiness["database_commit_executed"] and not candidate_queue_writer_run_readiness["scheduler_attached"] ), "candidate_queue_writer_run_receipt_preview_safe": _run_review_preview_safe(candidate_queue_writer_run_receipt, "candidate_queue_writer_run_receipt_preview"), "candidate_queue_writer_run_closeout_preview_safe": _run_review_preview_safe(candidate_queue_writer_run_closeout, "candidate_queue_writer_run_closeout_preview"), "candidate_queue_review_handoff_preview_safe": _run_review_preview_safe(candidate_queue_review_handoff, "candidate_queue_review_handoff_preview"), "candidate_queue_review_inventory_preview_safe": _run_review_preview_safe(candidate_queue_review_inventory, "candidate_queue_review_inventory_preview"), "candidate_queue_review_decision_preview_safe": _run_review_preview_safe(candidate_queue_review_decision, "candidate_queue_review_decision_preview"), "candidate_queue_review_decision_approval_preview_safe": _run_review_preview_safe(candidate_queue_review_decision_approval, "candidate_queue_review_decision_approval_preview"), "candidate_queue_review_decision_transaction_preview_safe": _run_review_preview_safe(candidate_queue_review_decision_transaction, "candidate_queue_review_decision_transaction_preview"), "candidate_queue_review_decision_writer_preflight_safe": _run_review_preview_safe(candidate_queue_review_decision_writer_preflight, "candidate_queue_review_decision_writer_preflight_preview"), "candidate_queue_review_decision_writer_postwrite_smoke_planned_safe": _run_review_preview_safe(candidate_queue_review_decision_writer_postwrite_smoke, "candidate_queue_review_decision_writer_postwrite_smoke_planned"), "candidate_queue_review_decision_writer_operator_drill_preview_safe": _run_review_preview_safe(candidate_queue_review_decision_writer_operator_drill, "candidate_queue_review_decision_writer_operator_drill_preview"), "candidate_queue_review_decision_writer_run_package_preview_safe": _run_review_preview_safe(candidate_queue_review_decision_writer_run_package, "candidate_queue_review_decision_writer_run_package_preview"), "candidate_queue_review_decision_writer_run_readiness_preview_safe": _run_review_preview_safe(candidate_queue_review_decision_writer_run_readiness, "candidate_queue_review_decision_writer_run_readiness_preview"), "candidate_queue_review_decision_writer_run_receipt_preview_safe": _run_review_preview_safe(candidate_queue_review_decision_writer_run_receipt, "candidate_queue_review_decision_writer_run_receipt_preview"), "candidate_queue_review_decision_writer_run_closeout_preview_safe": _run_review_preview_safe(candidate_queue_review_decision_writer_run_closeout, "candidate_queue_review_decision_writer_run_closeout_preview"), "candidate_queue_review_decision_post_closeout_inventory_preview_safe": _run_review_preview_safe(candidate_queue_review_decision_post_closeout_inventory, "candidate_queue_review_decision_post_closeout_inventory_preview"), "candidate_queue_review_completion_archive_preview_safe": _run_review_preview_safe(candidate_queue_review_completion_archive, "candidate_queue_review_completion_archive_preview"), "candidate_queue_review_archive_summary_preview_safe": _run_review_preview_safe(candidate_queue_review_archive_summary, "candidate_queue_review_archive_summary_preview"), "candidate_queue_review_ai_summary_preflight_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_preflight, "candidate_queue_review_ai_summary_preflight_preview"), "candidate_queue_review_ai_summary_run_package_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_run_package, "candidate_queue_review_ai_summary_run_package_preview"), "candidate_queue_review_ai_summary_output_receipt_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_output_receipt, "candidate_queue_review_ai_summary_output_receipt_preview"), "candidate_queue_review_ai_summary_persistence_preflight_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_preflight, "candidate_queue_review_ai_summary_persistence_preflight_preview"), "candidate_queue_review_ai_summary_persistence_transaction_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_transaction, "candidate_queue_review_ai_summary_persistence_transaction_preview"), "candidate_queue_review_ai_summary_persistence_writer_preflight_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_writer_preflight, "candidate_queue_review_ai_summary_persistence_writer_preflight_preview"), "candidate_queue_review_ai_summary_persistence_run_package_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_run_package, "candidate_queue_review_ai_summary_persistence_run_package_preview"), "candidate_queue_review_ai_summary_persistence_run_readiness_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_run_readiness, "candidate_queue_review_ai_summary_persistence_run_readiness_preview"), "candidate_queue_review_ai_summary_persistence_run_receipt_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_run_receipt, "candidate_queue_review_ai_summary_persistence_run_receipt_preview"), "candidate_queue_review_ai_summary_persistence_run_closeout_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_run_closeout, "candidate_queue_review_ai_summary_persistence_run_closeout_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_preview"), "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout_preview_safe": _run_review_preview_safe(candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout_preview"), "candidate_queue_review_decision_writer_cli_status_safe": _run_review_preview_safe(candidate_queue_review_decision_writer_status, "candidate_queue_review_decision_writer_cli_blocked"), "match_review_plan_preview_safe": bool( match_review_plan["mode"] == "match_review_plan_preview" and not match_review_plan["review_queue_created"] and not match_review_plan["auto_confirm_executed"] and not match_review_plan["database_write_executed"] ), "opportunity_plan_preview_safe": bool( opportunity_plan["mode"] == "opportunity_plan_preview" and not opportunity_plan["opportunity_queue_created"] and not opportunity_plan["threat_alert_dispatched"] and not opportunity_plan["database_write_executed"] ), "opportunity_scoring_plan_preview_safe": bool( opportunity_scoring_plan["mode"] == "opportunity_scoring_plan_preview" and not opportunity_scoring_plan["scoring_job_created"] and not opportunity_scoring_plan["score_calculation_executed"] and not opportunity_scoring_plan["database_write_executed"] ), "opportunity_evidence_plan_preview_safe": bool( opportunity_evidence_plan["mode"] == "opportunity_evidence_plan_preview" and not opportunity_evidence_plan["evidence_query_executed"] and not opportunity_evidence_plan["evidence_bundle_created"] and not opportunity_evidence_plan["database_write_executed"] ), "opportunity_alert_plan_preview_safe": bool( opportunity_alert_plan["mode"] == "opportunity_alert_plan_preview" and not opportunity_alert_plan["alert_candidate_created"] and not opportunity_alert_plan["review_queue_contract_written"] and not opportunity_alert_plan["review_queue_table_created"] and not opportunity_alert_plan["review_action_executed"] and not opportunity_alert_plan["approval_record_written"] and not opportunity_alert_plan["telegram_dispatched"] and not opportunity_alert_plan["database_write_executed"] and not opportunity_alert_plan["llm_call_executed"] ), "migration_apply_drill_preview_safe": bool( migration_apply_drill["mode"] == "migration_apply_drill_preview" and not migration_apply_drill["migration_executed"] and not migration_apply_drill["rollback_executed"] and not migration_apply_drill["database_write_executed"] and not migration_apply_drill["database_commit_executed"] and not migration_apply_drill["api_executes_migration"] and not migration_apply_drill["api_executes_rollback"] ), "migration_catalog_review_preview_safe": bool( migration_catalog_review["mode"] == "migration_catalog_review_preview" and not migration_catalog_review["migration_executed"] and not migration_catalog_review["rollback_executed"] and not migration_catalog_review["database_write_executed"] and not migration_catalog_review["database_commit_executed"] and not migration_catalog_review["api_executes_migration"] and not migration_catalog_review["api_executes_rollback"] ), "migration_live_smoke_preview_safe": bool( migration_live_smoke["mode"] == "migration_live_smoke_preview" and not migration_live_smoke["migration_executed"] and not migration_live_smoke["rollback_executed"] and not migration_live_smoke["database_write_executed"] and not migration_live_smoke["database_commit_executed"] and not migration_live_smoke["api_executes_migration"] and not migration_live_smoke["api_executes_rollback"] ), "live_db_inventory_preview_safe": bool( live_db_inventory["mode"] == "live_db_inventory_planned" and not live_db_inventory["read_only_query_executed"] and not live_db_inventory["database_write_executed"] and not live_db_inventory["database_commit_executed"] and not live_db_inventory["migration_executed"] and not live_db_inventory["external_network_executed"] and not live_db_inventory["scheduler_attached"] ), } ready_for_production_deploy = all(checks.values()) blocked_reasons = [ reason for reason, blocked in ( ("readiness_checks_not_all_passed", not ready_for_production_deploy), ("production_deploy_not_executed_by_api", True), ("git_commit_not_created_by_api", True), ("git_push_not_executed_by_api", True), ("backup_must_be_verified_by_operator", True), ("production_smoke_must_be_verified_by_operator", True), ) if blocked ] required_manual_steps = [ { "key": "review_worktree_scope", "label": "審核 worktree,只納入市場情報相關變更,排除 unrelated dirty files", "status": "required", }, { "key": "run_backup_system", "label": "重大更新前執行 python backup_system.py", "status": "required", }, { "key": "commit_market_intel_changes_only", "label": "只 commit 市場情報模組、ADR/TODO 與必要測試", "status": "operator_optional", }, { "key": "push_reviewed_branch_or_main", "label": "推送已審核分支或 main,再進入部署 SOP", "status": "operator_optional", }, { "key": "run_deployment_sop", "label": "依 deployment SOP app-only 部署,不碰 momo-db", "status": "required", }, { "key": "verify_health_endpoint", "label": "部署後先驗證 /health,不使用首頁作為探測", "status": "required", }, { "key": "verify_market_intel_page_after_deploy", "label": "驗證 /market_intel 與市場情報 API 仍維持 blocked dry-run", "status": "required", }, ] fallback_plan = [ { "key": "feature_flag_kill_switch", "label": "MARKET_INTEL_ENABLED、MARKET_INTEL_CRAWLER_ENABLED、MARKET_INTEL_WRITE_ENABLED 保持全關,可立即停用新功能面", "trigger": "任何 UI/API 異常或非預期連外行為", }, { "key": "app_only_rollback", "label": "回退到上一個已知正常版本後,只 recreate momo-app,避免影響 momo-db 資料生命週期", "trigger": "部署後 /health 或 /market_intel smoke 失敗", }, { "key": "scheduler_detached", "label": "市場情報 scheduler 尚未掛載;異常時不需停爬蟲排程,因為本階段沒有排程入口", "trigger": "排程或外部流量疑慮", }, { "key": "database_write_blocked", "label": "API/UI writer 仍不寫 DB;真寫入只允許 CLI 在完整 gate 通過後執行", "trigger": "queue writer、seed writer 或 schema smoke 異常", }, ] safe_deploy_boundaries = [ { "key": "no_remove_orphans", "label": "禁止使用 docker compose --remove-orphans", }, { "key": "no_momo_db_lifecycle_change", "label": "禁止 stop/rm/recreate momo-db 或變更資料生命週期", }, { "key": "health_probe_only", "label": "HTTP health / blackbox / CD 探測只打 /health", }, { "key": "flags_default_off", "label": "市場情報三個 feature flags 預設維持 OFF", }, ] return { "phase": service.phase, "mode": "app_only_release_gate", "production_deployed": False, "git_committed": False, "git_pushed": False, "ready_for_production_deploy": ready_for_production_deploy, "deployment_actions_executed": False, "execution_boundary": { "api_executes_git": False, "api_executes_backup": False, "api_executes_scp": False, "api_executes_ssh": False, "api_recreates_container": False, "api_runs_migration": False, "api_writes_database": False, }, "checks": checks, "blocked_reasons": blocked_reasons, "requires_backup_before_major_update": True, "backup_command": "python backup_system.py", "required_manual_steps": required_manual_steps, "fallback_plan": fallback_plan, "safe_deploy_boundaries": safe_deploy_boundaries, "production_smoke_targets": list(PRODUCTION_SMOKE_TARGETS), "canonical_ai_smoke_targets": list(AI_CONTROLLED_CANONICAL_SMOKE_TARGETS), "legacy_compatibility_smoke_targets": list(PRODUCTION_SMOKE_TARGETS), "ai_controlled_route_aliases": [alias.as_dict() for alias in AI_CONTROLLED_ROUTE_ALIASES], "status": status.to_dict(), "schema_smoke": schema_smoke, "writer_plan_summary": { "operation_count": writer_plan["operation_count"], "writes_executed": writer_plan["writes_executed"], "would_write_database": writer_plan["would_write_database"], }, "write_approval_runbook": service.build_write_approval_runbook(), "migration_blueprint": service.build_migration_blueprint(), "migration_apply_drill": migration_apply_drill, "migration_catalog_review": migration_catalog_review, "migration_live_smoke": migration_live_smoke, "live_db_inventory": live_db_inventory, "seed_writer_cli_status": service.build_seed_writer_cli_status(), "schema_db_probe": service.build_schema_db_probe(), "platform_seed_db_diff": service.build_platform_seed_db_diff(), "legacy_source_bridge": service.build_legacy_source_bridge(), "mcp_readiness": service.build_mcp_readiness(), "mcp_tool_contract": service.build_mcp_tool_contract(), "mcp_deploy_preflight": mcp_deploy_preflight, "mcp_activation_runbook": mcp_activation_runbook, "mcp_fetch_gate": mcp_fetch_gate, "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, mcp_fetch_handoff_key(): mcp_fetch_handoff, "mcp_fetch_target_review": mcp_fetch_target_review, "mcp_fetch_run_package": mcp_fetch_run_package, "mcp_fetch_run_readiness": mcp_fetch_run_readiness, "mcp_fetch_run_receipt": mcp_fetch_run_receipt, "mcp_fetch_result_parser_review": mcp_fetch_result_parser_review, "mcp_fetch_candidate_handoff_review": mcp_fetch_candidate_handoff_review, "mcp_fetch_candidate_queue_review": mcp_fetch_candidate_queue_review, "mcp_fetch_candidate_queue_writer_preflight": mcp_fetch_candidate_queue_writer_preflight, "mcp_fetch_candidate_queue_writer_cli_review": mcp_fetch_candidate_queue_writer_cli_review, "mcp_fetch_candidate_queue_writer_run_package_review": mcp_fetch_candidate_queue_writer_run_package_review, "mcp_fetch_candidate_queue_writer_run_readiness": mcp_fetch_candidate_queue_writer_run_readiness, "mcp_fetch_candidate_queue_writer_run_receipt_review": mcp_fetch_candidate_queue_writer_run_receipt_review, "mcp_fetch_candidate_queue_writer_run_closeout_review": mcp_fetch_candidate_queue_writer_run_closeout_review, "mcp_fetch_candidate_queue_writer_post_closeout_inventory_review": mcp_fetch_candidate_queue_writer_post_closeout_inventory_review, "mcp_fetch_candidate_queue_writer_review_handoff": mcp_fetch_candidate_queue_writer_review_handoff, "mcp_fetch_candidate_queue_writer_review_inventory": mcp_fetch_candidate_queue_writer_review_inventory, "mcp_fetch_candidate_queue_writer_review_decision": mcp_fetch_candidate_queue_writer_review_decision, "mcp_fetch_candidate_queue_writer_review_decision_approval": mcp_fetch_candidate_queue_writer_review_decision_approval, "mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight": mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight, "mcp_professional_source_governance": mcp_professional_source_governance, "mcp_fetch_target_source_governance_review": mcp_fetch_target_source_governance_review, "scheduler_plan": scheduler_plan, sample_payload_key("plan"): sample_plan, sample_payload_key("acceptance"): sample_acceptance, sample_payload_key("review"): sample_review, sample_payload_key("review_evaluation"): sample_review_evaluation, sample_payload_key("candidate_handoff"): sample_candidate_handoff, sample_payload_key("candidate_queue_draft"): sample_candidate_queue_draft, sample_payload_key("candidate_queue_approval"): sample_candidate_queue_approval, sample_payload_key("candidate_queue_transaction"): sample_candidate_queue_transaction, "candidate_queue_writer_preflight": candidate_queue_writer_preflight, "candidate_queue_writer_cli_status": candidate_queue_writer_cli_status, "candidate_queue_writer_postwrite_smoke": candidate_queue_writer_postwrite_smoke, "candidate_queue_writer_operator_drill": candidate_queue_writer_operator_drill, "candidate_queue_writer_run_package": candidate_queue_writer_run_package, "candidate_queue_writer_run_readiness": candidate_queue_writer_run_readiness, "candidate_queue_writer_run_receipt": candidate_queue_writer_run_receipt, "candidate_queue_writer_run_closeout": candidate_queue_writer_run_closeout, "candidate_queue_review_handoff": candidate_queue_review_handoff, "candidate_queue_review_inventory": candidate_queue_review_inventory, "candidate_queue_review_decision": candidate_queue_review_decision, "candidate_queue_review_decision_approval": candidate_queue_review_decision_approval, "candidate_queue_review_decision_transaction": candidate_queue_review_decision_transaction, "candidate_queue_review_decision_writer_preflight": candidate_queue_review_decision_writer_preflight, "candidate_queue_review_decision_writer_postwrite_smoke": candidate_queue_review_decision_writer_postwrite_smoke, "candidate_queue_review_decision_writer_operator_drill": candidate_queue_review_decision_writer_operator_drill, "candidate_queue_review_decision_writer_run_package": candidate_queue_review_decision_writer_run_package, "candidate_queue_review_decision_writer_run_readiness": candidate_queue_review_decision_writer_run_readiness, "candidate_queue_review_decision_writer_run_receipt": candidate_queue_review_decision_writer_run_receipt, "candidate_queue_review_decision_writer_run_closeout": candidate_queue_review_decision_writer_run_closeout, "candidate_queue_review_decision_post_closeout_inventory": candidate_queue_review_decision_post_closeout_inventory, "candidate_queue_review_completion_archive": candidate_queue_review_completion_archive, "candidate_queue_review_archive_summary": candidate_queue_review_archive_summary, "candidate_queue_review_ai_summary_preflight": candidate_queue_review_ai_summary_preflight, "candidate_queue_review_ai_summary_run_package": candidate_queue_review_ai_summary_run_package, "candidate_queue_review_ai_summary_output_receipt": candidate_queue_review_ai_summary_output_receipt, "candidate_queue_review_ai_summary_persistence_preflight": candidate_queue_review_ai_summary_persistence_preflight, "candidate_queue_review_ai_summary_persistence_transaction": candidate_queue_review_ai_summary_persistence_transaction, "candidate_queue_review_ai_summary_persistence_writer_preflight": candidate_queue_review_ai_summary_persistence_writer_preflight, "candidate_queue_review_ai_summary_persistence_run_package": candidate_queue_review_ai_summary_persistence_run_package, "candidate_queue_review_ai_summary_persistence_run_readiness": candidate_queue_review_ai_summary_persistence_run_readiness, "candidate_queue_review_ai_summary_persistence_run_receipt": candidate_queue_review_ai_summary_persistence_run_receipt, "candidate_queue_review_ai_summary_persistence_run_closeout": candidate_queue_review_ai_summary_persistence_run_closeout, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate": candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package": candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness": candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt": candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout": candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive": candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary": candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary, "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout": candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_final_closeout, "candidate_queue_review_decision_writer_status": candidate_queue_review_decision_writer_status, "match_review_plan": match_review_plan, "opportunity_plan": opportunity_plan, "opportunity_scoring_plan": opportunity_scoring_plan, "opportunity_evidence_plan": opportunity_evidence_plan, "opportunity_alert_plan": opportunity_alert_plan, }