diff --git a/TODO_NEXT_STEPS.txt b/TODO_NEXT_STEPS.txt
index 34a028f..ee51a85 100644
--- a/TODO_NEXT_STEPS.txt
+++ b/TODO_NEXT_STEPS.txt
@@ -4,6 +4,7 @@
================================================================================
【已完成】
+ - V10.355 補市場情報 candidate queue review AI summary Telegram dispatch report catalog record archive summary gate:新增 read-only report catalog record archive summary builder、POST endpoint、UI 按鈕與 deployment readiness smoke target,在 archive gate 後整理 catalog record identity、artifact traceability、DB commit/post-write smoke、archive manifest/retention policy 與後續 final closeout separate gate;API/UI 不讀 approval/Telegram token、不呼叫 LLM、不產報表、不派送 Telegram、不開 DB、不寫檔、不執行 CLI、不寫 catalog record、不 commit、不更新 review_state、不掛 scheduler。
- V10.354 補市場情報 candidate queue review AI summary Telegram dispatch report catalog record archive gate:新增 read-only report catalog record archive builder、POST endpoint、UI 按鈕與 deployment readiness smoke target,在 closeout gate 後審核 closeout/commit/run receipt/writer output/post-write smoke/backup 封存證據、archive manifest/retention policy 與後續 archive summary separate gate;API/UI 不讀 approval/Telegram token、不呼叫 LLM、不產報表、不派送 Telegram、不開 DB、不寫檔、不執行 CLI、不寫 catalog record、不 commit、不更新 review_state、不掛 scheduler。
- V10.353 補市場情報 candidate queue review AI summary Telegram dispatch report catalog record closeout gate:新增 read-only report catalog record closeout builder、POST endpoint、UI 按鈕與 deployment readiness smoke target,在 commit gate 後審核 catalog record identity、DB commit/post-write smoke 證據、操作員 closeout 確認與後續 archive separate gate;API/UI 不讀 approval/Telegram token、不呼叫 LLM、不補產報表、不派送 Telegram、不開 DB、不寫檔、不執行 CLI、不寫 catalog record、不 commit、不更新 review_state、不掛 scheduler。
- V10.352 補市場情報 candidate queue review AI summary Telegram dispatch report catalog record commit gate:新增 read-only report catalog record commit builder、POST endpoint、UI 按鈕與 deployment readiness smoke target,在 run receipt 後審核外部 CLI catalog record DB commit、post-write smoke、操作員 commit gate 確認與後續 closeout separate gate;API/UI 不讀 approval/Telegram token、不呼叫 LLM、不補產報表、不派送 Telegram、不開 DB、不寫檔、不執行 CLI、不寫 catalog record、不 commit、不更新 review_state、不掛 scheduler。
diff --git a/config.py b/config.py
index 26a42c8..b87e7b7 100644
--- a/config.py
+++ b/config.py
@@ -323,7 +323,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
# ==========================================
# 系統版本與路徑
# ==========================================
-SYSTEM_VERSION = "V10.354"
+SYSTEM_VERSION = "V10.355"
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
public_url = PUBLIC_URL # 用於模板顯示
diff --git a/docs/memory/history_logs.md b/docs/memory/history_logs.md
index f311ee8..fa9b3bf 100644
--- a/docs/memory/history_logs.md
+++ b/docs/memory/history_logs.md
@@ -12,6 +12,10 @@
## 📅 詳細更新日誌 (考古存檔)
+### 2026-05-21:市場情報 Telegram dispatch report catalog record archive summary gate
+- **V10.355 report catalog record archive summary gate**: 新增 `candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary` service、POST endpoint、UI 按鈕與 deployment readiness smoke target,在 archive gate 後整理 catalog record identity、artifact traceability、DB commit/post-write smoke、archive manifest/retention policy 與後續 final closeout separate gate。
+- **只讀安全邊界**: 本階段只放行到後續 report catalog record final closeout gate;API/UI 不讀 approval/Telegram token、不呼叫 LLM、不產報表、不派送 Telegram、不開 DB、不寫檔、不執行 CLI、不寫 catalog record、不 commit、不更新 `review_state`、不掛 scheduler。
+
### 2026-05-21:市場情報 Telegram dispatch report catalog record archive gate
- **V10.354 report catalog record archive gate**: 新增 `candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive` service、POST endpoint、UI 按鈕與 deployment readiness smoke target,在 closeout gate 後審核 closeout/commit/run receipt/writer output/post-write smoke/backup 封存證據、archive manifest/retention policy 與後續 archive summary separate gate。
- **只讀安全邊界**: 本階段只放行到後續 report catalog record archive summary gate;API/UI 不讀 approval/Telegram token、不呼叫 LLM、不產報表、不派送 Telegram、不開 DB、不寫檔、不執行 CLI、不寫 catalog record、不 commit、不更新 `review_state`、不掛 scheduler。
diff --git a/routes/market_intel_review_report_routes.py b/routes/market_intel_review_report_routes.py
index 4e8435d..0c9f7ff 100644
--- a/routes/market_intel_review_report_routes.py
+++ b/routes/market_intel_review_report_routes.py
@@ -52,6 +52,9 @@ from services.market_intel.candidate_queue_review_ai_summary_persistence_telegra
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_closeout import (
build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout,
)
@@ -745,6 +748,61 @@ def _build_ai_summary_persistence_telegram_dispatch_report_catalog_record_archiv
)
+def _extract_report_catalog_record_archive_summary_payload(
+ sample_result,
+ operator_evidence,
+):
+ operator_evidence = _as_dict(operator_evidence)
+ sample_result = _as_dict(sample_result)
+ return _as_dict(
+ operator_evidence.get("market_intel_report_catalog_record_archive_summary")
+ or operator_evidence.get(
+ "telegram_dispatch_report_catalog_record_archive_summary"
+ )
+ or operator_evidence.get("report_catalog_record_archive_summary")
+ or operator_evidence.get("catalog_record_archive_summary")
+ or sample_result.get("market_intel_report_catalog_record_archive_summary")
+ or sample_result.get("telegram_dispatch_report_catalog_record_archive_summary")
+ or sample_result.get("report_catalog_record_archive_summary")
+ or sample_result.get("catalog_record_archive_summary")
+ )
+
+
+def _build_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary(
+ *,
+ service,
+ sample_result,
+ operator_evidence,
+ writer_output,
+ smoke_result,
+ payload_error,
+ limit,
+ execute_requested,
+ apply_real_write,
+):
+ report_catalog_record_archive = _build_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive(
+ service=service,
+ sample_result=sample_result,
+ operator_evidence=operator_evidence,
+ writer_output=writer_output,
+ smoke_result=smoke_result,
+ payload_error=payload_error,
+ limit=limit,
+ execute_requested=execute_requested,
+ apply_real_write=apply_real_write,
+ )
+ return build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary(
+ telegram_dispatch_report_catalog_record_archive=report_catalog_record_archive,
+ report_catalog_record_archive_summary=_extract_report_catalog_record_archive_summary_payload(
+ sample_result,
+ operator_evidence,
+ ),
+ operator_evidence=operator_evidence,
+ execute_requested=execute_requested,
+ apply_real_write=apply_real_write,
+ )
+
+
@market_intel_review_bp.route(
"/api/market_intel/manual_sample_review/"
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input",
@@ -1231,3 +1289,31 @@ def market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_tel
)
data["phase"] = service.phase
return jsonify(data), 400 if payload_error else 200
+
+
+@market_intel_review_bp.route(
+ "/api/market_intel/manual_sample_review/"
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary",
+ methods=["POST"],
+)
+@login_required
+def market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary():
+ service = MarketIntelService()
+ execute_requested = request.args.get("execute", "false").lower() == "true"
+ apply_real_write = request.args.get("apply_real_write", "false").lower() == "true"
+ sample_result, operator_evidence, writer_output, smoke_result, payload_error, limit = (
+ _extract_run_payload()
+ )
+ data = _build_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary(
+ service=service,
+ sample_result=sample_result,
+ operator_evidence=operator_evidence,
+ writer_output=writer_output,
+ smoke_result=smoke_result,
+ payload_error=payload_error,
+ limit=limit,
+ execute_requested=execute_requested,
+ apply_real_write=apply_real_write,
+ )
+ data["phase"] = service.phase
+ return jsonify(data), 400 if payload_error else 200
diff --git a/services/market_intel/candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary.py b/services/market_intel/candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary.py
new file mode 100644
index 0000000..e5a10d2
--- /dev/null
+++ b/services/market_intel/candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary.py
@@ -0,0 +1,691 @@
+"""候選審核 queue AI summary Telegram dispatch report catalog record archive summary gate。
+
+本模組只在 catalog record archive 通過後整理長期查閱摘要;不讀 approval
+或 Telegram token、不呼叫 LLM、不派送 Telegram、不開 DB、不寫檔、不執行
+CLI、不補寫 catalog record、不執行 commit、不更新 review_state、不掛 scheduler。
+"""
+
+from services.market_intel.candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive import (
+ FALSE_RESPONSE_KEYS as REPORT_CATALOG_RECORD_ARCHIVE_FALSE_RESPONSE_KEYS,
+ SAFE_APPROVAL_ENV_VAR,
+ SAFE_TOKEN_METADATA_KEYS,
+ TARGET_COLUMN,
+ TARGET_TABLE,
+ _as_dict,
+ _as_list,
+ _contains_forbidden_token_key,
+ _has_text,
+ _safe_int,
+ _safe_text,
+ _strip_safe_token_boolean_keys,
+)
+
+
+REQUIRED_ARCHIVE_BOUNDARIES = {
+ "do_not_read_approval_token_from_report_catalog_record_archive_api",
+ "do_not_read_telegram_token_from_report_catalog_record_archive_api",
+ "do_not_call_llm_from_report_catalog_record_archive",
+ "do_not_generate_report_from_report_catalog_record_archive_api",
+ "do_not_write_report_catalog_record_archive_artifact_from_api",
+ "do_not_execute_catalog_record_cli_from_report_catalog_record_archive_api",
+ "do_not_write_report_catalog_record_from_report_catalog_record_archive_api",
+ "do_not_commit_catalog_record_from_report_catalog_record_archive_api",
+ "do_not_dispatch_telegram_from_report_catalog_record_archive_api",
+ "do_not_open_database_connection_from_report_catalog_record_archive",
+ "do_not_update_review_state_from_report_catalog_record_archive",
+ "do_not_attach_scheduler_from_report_catalog_record_archive",
+ "future_market_intel_report_catalog_record_archive_summary_must_use_separate_gate",
+}
+FALSE_RESPONSE_KEYS = tuple(
+ dict.fromkeys(
+ REPORT_CATALOG_RECORD_ARCHIVE_FALSE_RESPONSE_KEYS
+ + (
+ "telegram_dispatch_report_catalog_record_archive_summary_gate_file_written",
+ "report_catalog_record_archive_summary_gate_file_written",
+ "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",
+ )
+ )
+)
+
+
+def _archive_summary(telegram_dispatch_report_catalog_record_archive):
+ archive = _as_dict(telegram_dispatch_report_catalog_record_archive)
+ closeout = _as_dict(archive.get("telegram_dispatch_report_catalog_record_closeout"))
+ operator = _as_dict(
+ archive.get("operator_telegram_dispatch_report_catalog_record_archive")
+ )
+ promotion = _as_dict(archive.get("promotion_gate"))
+ safe_boundaries = set(str(item) for item in _as_list(archive.get("safe_boundaries")))
+ missing_boundaries = sorted(REQUIRED_ARCHIVE_BOUNDARIES - safe_boundaries)
+ blocked_keys = [key for key in FALSE_RESPONSE_KEYS if bool(archive.get(key))]
+
+ return {
+ "provided": bool(archive),
+ "mode": archive.get("mode"),
+ "target_operation": archive.get("target_operation"),
+ "archive_passed": bool(
+ archive.get("telegram_dispatch_report_catalog_record_archive_passed")
+ or archive.get(
+ "summary_persistence_telegram_dispatch_report_catalog_record_archive_passed"
+ )
+ or archive.get("report_catalog_record_archive_passed")
+ ),
+ "ready_for_next_manual_phase": bool(archive.get("ready_for_next_manual_phase")),
+ "ready_for_market_intel_report_catalog_record_archive_summary": bool(
+ archive.get("ready_for_market_intel_report_catalog_record_archive_summary")
+ ),
+ "ready_for_market_intel_report_catalog_record_archive": bool(
+ archive.get("ready_for_market_intel_report_catalog_record_archive")
+ ),
+ "statement_count": _safe_int(archive.get("statement_count")),
+ "expected_summary_payload_hash": _safe_text(
+ archive.get("expected_summary_payload_hash")
+ or closeout.get("expected_summary_payload_hash"),
+ 80,
+ ),
+ "writer_record_family": _safe_text(closeout.get("writer_record_family"), 80),
+ "writer_catalog_record_key": _safe_text(
+ closeout.get("writer_catalog_record_key"), 160
+ ),
+ "writer_target_table": closeout.get("writer_target_table"),
+ "writer_target_column": closeout.get("writer_target_column"),
+ "writer_statement_count": _safe_int(closeout.get("writer_statement_count")),
+ "writer_database_commit_executed": bool(
+ closeout.get("writer_database_commit_executed")
+ ),
+ "writer_hash_match": bool(closeout.get("writer_hash_match")),
+ "smoke_read_only_query_executed": bool(
+ closeout.get("smoke_read_only_query_executed")
+ ),
+ "smoke_postwrite_smoke_passed": bool(
+ closeout.get("smoke_postwrite_smoke_passed")
+ ),
+ "smoke_hash_match": bool(closeout.get("smoke_hash_match")),
+ "closeout_passed": bool(closeout.get("closeout_passed")),
+ "closeout_artifact_path_recorded": bool(
+ closeout.get("operator_closeout_artifact_path")
+ ),
+ "commit_artifact_path_recorded": bool(
+ closeout.get("operator_commit_artifact_path_recorded")
+ ),
+ "run_receipt_artifact_path_recorded": bool(
+ closeout.get("operator_run_receipt_artifact_path_recorded")
+ ),
+ "writer_output_artifact_path_recorded": bool(
+ closeout.get("operator_writer_output_artifact_path_recorded")
+ ),
+ "postwrite_smoke_artifact_path_recorded": bool(
+ closeout.get("operator_postwrite_smoke_artifact_path_recorded")
+ ),
+ "backup_artifact_path_recorded": bool(
+ closeout.get("operator_backup_artifact_path_recorded")
+ ),
+ "archive_artifact_path": operator.get("report_catalog_record_archive_artifact_path"),
+ "archive_closeout_artifact_path_recorded": bool(
+ operator.get("report_catalog_record_closeout_artifact_path_recorded")
+ ),
+ "archive_commit_artifact_path_recorded": bool(
+ operator.get("report_catalog_record_commit_artifact_path_recorded")
+ ),
+ "archive_run_receipt_artifact_path_recorded": bool(
+ operator.get("report_catalog_record_run_receipt_artifact_path_recorded")
+ ),
+ "archive_writer_output_artifact_path_recorded": bool(
+ operator.get("catalog_record_writer_output_artifact_path_recorded")
+ ),
+ "archive_postwrite_smoke_artifact_path_recorded": bool(
+ operator.get("catalog_record_postwrite_smoke_artifact_path_recorded")
+ ),
+ "archive_backup_artifact_path_recorded": bool(
+ operator.get("catalog_record_backup_artifact_path_recorded")
+ ),
+ "operator_confirmed_archive_gate": bool(
+ operator.get("operator_confirmed_report_catalog_record_archive_gate")
+ ),
+ "operator_confirmed_closeout_reviewed": bool(
+ operator.get("operator_confirmed_report_catalog_record_closeout_reviewed")
+ ),
+ "operator_confirmed_db_commit_observed": bool(
+ operator.get("operator_confirmed_catalog_record_db_commit_observed")
+ ),
+ "operator_confirmed_no_followup_db_write_required": bool(
+ operator.get(
+ "operator_confirmed_catalog_record_no_followup_db_write_required"
+ )
+ ),
+ "operator_confirmed_archive_manifest_reviewed": bool(
+ operator.get("operator_confirmed_catalog_record_archive_manifest_reviewed")
+ ),
+ "operator_confirmed_archive_retention_policy_recorded": bool(
+ operator.get(
+ "operator_confirmed_catalog_record_archive_retention_policy_recorded"
+ )
+ ),
+ "operator_confirmed_archive_summary_requires_separate_gate": bool(
+ operator.get(
+ "operator_confirmed_catalog_record_archive_summary_requires_separate_gate"
+ )
+ ),
+ "promotion_allowed": bool(promotion.get("allowed")),
+ "promotion_next_manual_phase": promotion.get("next_manual_phase"),
+ "promotion_archive_summary_separate_gate": bool(
+ promotion.get("report_catalog_record_archive_summary_requires_separate_gate")
+ ),
+ "promotion_api_must_not_generate_report": bool(
+ promotion.get("api_must_not_generate_report")
+ ),
+ "promotion_api_must_not_write_file": bool(
+ promotion.get("api_must_not_write_file")
+ ),
+ "promotion_api_must_not_execute_cli": bool(
+ promotion.get("api_must_not_execute_cli")
+ ),
+ "promotion_api_must_not_write_catalog_record": bool(
+ promotion.get("api_must_not_write_catalog_record")
+ ),
+ "promotion_api_must_not_write_database": bool(
+ promotion.get("api_must_not_write_database")
+ ),
+ "promotion_api_must_not_commit_catalog_record": bool(
+ promotion.get("api_must_not_commit_catalog_record")
+ ),
+ "promotion_api_must_not_dispatch_telegram": bool(
+ promotion.get("api_must_not_dispatch_telegram")
+ ),
+ "safe_boundaries_complete": not missing_boundaries,
+ "missing_safe_boundaries": missing_boundaries,
+ "forbidden_token_key_detected": _contains_forbidden_token_key(
+ _strip_safe_token_boolean_keys(archive)
+ ),
+ "blocked_response_keys_true": blocked_keys,
+ **{key: bool(archive.get(key)) for key in FALSE_RESPONSE_KEYS},
+ }
+
+
+def _operator_summary(operator_evidence, report_catalog_record_archive_summary=None):
+ operator_evidence = _as_dict(operator_evidence)
+ summary_payload = _as_dict(report_catalog_record_archive_summary)
+ return {
+ "provided_keys": sorted(operator_evidence.keys()),
+ "report_catalog_record_archive_summary_artifact_path": _safe_text(
+ operator_evidence.get("report_catalog_record_archive_summary_artifact_path")
+ or operator_evidence.get(
+ "telegram_dispatch_report_catalog_record_archive_summary_artifact_path"
+ )
+ or operator_evidence.get(
+ "market_intel_report_catalog_record_archive_summary_artifact_path"
+ )
+ or summary_payload.get("report_catalog_record_archive_summary_artifact_path"),
+ 300,
+ ),
+ "report_catalog_record_archive_artifact_path_recorded": _has_text(
+ operator_evidence.get("report_catalog_record_archive_artifact_path")
+ or summary_payload.get("report_catalog_record_archive_artifact_path")
+ ),
+ "report_catalog_record_closeout_artifact_path_recorded": _has_text(
+ operator_evidence.get("report_catalog_record_closeout_artifact_path")
+ or summary_payload.get("report_catalog_record_closeout_artifact_path")
+ ),
+ "report_catalog_record_commit_artifact_path_recorded": _has_text(
+ operator_evidence.get("report_catalog_record_commit_artifact_path")
+ or summary_payload.get("report_catalog_record_commit_artifact_path")
+ ),
+ "report_catalog_record_run_receipt_artifact_path_recorded": _has_text(
+ operator_evidence.get("report_catalog_record_run_receipt_artifact_path")
+ or summary_payload.get("report_catalog_record_run_receipt_artifact_path")
+ ),
+ "catalog_record_writer_output_artifact_path_recorded": _has_text(
+ operator_evidence.get("catalog_record_writer_output_artifact_path")
+ or operator_evidence.get("writer_output_json_path")
+ or summary_payload.get("catalog_record_writer_output_artifact_path")
+ ),
+ "catalog_record_postwrite_smoke_artifact_path_recorded": _has_text(
+ operator_evidence.get("catalog_record_postwrite_smoke_artifact_path")
+ or operator_evidence.get("postwrite_smoke_json_path")
+ or summary_payload.get("catalog_record_postwrite_smoke_artifact_path")
+ ),
+ "catalog_record_backup_artifact_path_recorded": _has_text(
+ operator_evidence.get("catalog_record_backup_artifact_path")
+ or operator_evidence.get("backup_artifact_path")
+ or summary_payload.get("catalog_record_backup_artifact_path")
+ ),
+ "operator_confirmed_report_catalog_record_archive_summary_gate": bool(
+ operator_evidence.get(
+ "operator_confirmed_report_catalog_record_archive_summary_gate"
+ )
+ or operator_evidence.get(
+ "operator_confirmed_market_intel_report_catalog_record_archive_summary"
+ )
+ or summary_payload.get(
+ "operator_confirmed_report_catalog_record_archive_summary_gate"
+ )
+ ),
+ "operator_confirmed_report_catalog_record_archive_reviewed": bool(
+ operator_evidence.get(
+ "operator_confirmed_report_catalog_record_archive_reviewed"
+ )
+ or operator_evidence.get(
+ "operator_confirmed_catalog_record_archive_reviewed"
+ )
+ or summary_payload.get(
+ "operator_confirmed_report_catalog_record_archive_reviewed"
+ )
+ ),
+ "operator_confirmed_catalog_record_traceability_reviewed": bool(
+ operator_evidence.get(
+ "operator_confirmed_catalog_record_traceability_reviewed"
+ )
+ or operator_evidence.get(
+ "operator_confirmed_report_catalog_record_traceability_reviewed"
+ )
+ or summary_payload.get(
+ "operator_confirmed_catalog_record_traceability_reviewed"
+ )
+ ),
+ "operator_confirmed_catalog_record_archive_summary_read_only": bool(
+ operator_evidence.get(
+ "operator_confirmed_catalog_record_archive_summary_read_only"
+ )
+ or operator_evidence.get("operator_confirmed_summary_is_read_only")
+ or summary_payload.get(
+ "operator_confirmed_catalog_record_archive_summary_read_only"
+ )
+ ),
+ "operator_confirmed_catalog_record_final_closeout_requires_separate_gate": bool(
+ operator_evidence.get(
+ "operator_confirmed_catalog_record_final_closeout_requires_separate_gate"
+ )
+ or operator_evidence.get(
+ "operator_confirmed_report_catalog_record_final_closeout_requires_separate_gate"
+ )
+ or summary_payload.get(
+ "operator_confirmed_catalog_record_final_closeout_requires_separate_gate"
+ )
+ ),
+ "operator_confirmed_no_token_in_report_catalog_record_archive_summary": bool(
+ operator_evidence.get(
+ "operator_confirmed_no_token_in_report_catalog_record_archive_summary"
+ )
+ or operator_evidence.get("operator_confirmed_no_token_in_artifacts")
+ or summary_payload.get(
+ "operator_confirmed_no_token_in_report_catalog_record_archive_summary"
+ )
+ ),
+ "operator_confirmed_no_api_report_generation": bool(
+ operator_evidence.get("operator_confirmed_no_api_report_generation")
+ or operator_evidence.get("operator_confirmed_no_api_report_write")
+ or summary_payload.get("operator_confirmed_no_api_report_generation")
+ ),
+ "operator_confirmed_no_api_file_write": bool(
+ operator_evidence.get("operator_confirmed_no_api_file_write")
+ or summary_payload.get("operator_confirmed_no_api_file_write")
+ ),
+ "operator_confirmed_no_api_cli_execution": bool(
+ operator_evidence.get("operator_confirmed_no_api_cli_execution")
+ or operator_evidence.get("operator_confirmed_no_api_execute_cli")
+ or summary_payload.get("operator_confirmed_no_api_cli_execution")
+ ),
+ "operator_confirmed_no_api_catalog_record_write": bool(
+ operator_evidence.get("operator_confirmed_no_api_catalog_record_write")
+ or operator_evidence.get("operator_confirmed_no_api_db_write")
+ or summary_payload.get("operator_confirmed_no_api_catalog_record_write")
+ ),
+ "operator_confirmed_no_api_telegram_dispatch": bool(
+ operator_evidence.get("operator_confirmed_no_api_telegram_dispatch")
+ or summary_payload.get("operator_confirmed_no_api_telegram_dispatch")
+ ),
+ "operator_confirmed_no_api_db_write": bool(
+ operator_evidence.get("operator_confirmed_no_api_db_write")
+ or summary_payload.get("operator_confirmed_no_api_db_write")
+ ),
+ "operator_confirmed_no_llm_call": bool(
+ operator_evidence.get("operator_confirmed_no_llm_call")
+ or summary_payload.get("operator_confirmed_no_llm_call")
+ ),
+ "operator_confirmed_no_scheduler_attach": bool(
+ operator_evidence.get("operator_confirmed_no_scheduler_attach")
+ or summary_payload.get("operator_confirmed_no_scheduler_attach")
+ ),
+ "archive_summary_notes_recorded": _has_text(
+ operator_evidence.get("report_catalog_record_archive_summary_notes")
+ or operator_evidence.get("catalog_record_archive_summary_notes")
+ or summary_payload.get("notes")
+ ),
+ "safe_token_metadata_only": all(
+ key in SAFE_TOKEN_METADATA_KEYS or key == "approval_env_var"
+ for key in _strip_safe_token_boolean_keys(operator_evidence)
+ if "token" in str(key).lower() or str(key).lower() == "approval_env_var"
+ )
+ and operator_evidence.get("approval_env_var", SAFE_APPROVAL_ENV_VAR)
+ == SAFE_APPROVAL_ENV_VAR,
+ "forbidden_token_submitted_to_api": _contains_forbidden_token_key(
+ operator_evidence
+ )
+ or _contains_forbidden_token_key(summary_payload),
+ }
+
+
+def _summary_sections(archive, operator):
+ artifact_count = sum(
+ 1
+ for key in (
+ "archive_artifact_path",
+ "archive_closeout_artifact_path_recorded",
+ "archive_commit_artifact_path_recorded",
+ "archive_run_receipt_artifact_path_recorded",
+ "archive_writer_output_artifact_path_recorded",
+ "archive_postwrite_smoke_artifact_path_recorded",
+ "archive_backup_artifact_path_recorded",
+ )
+ if archive[key]
+ )
+ return [
+ {
+ "key": "catalog_record_archive_summary_identity",
+ "title": "Catalog record archive summary identity",
+ "facts": [
+ f"family={archive['writer_record_family'] or 'missing'}",
+ f"record_key={archive['writer_catalog_record_key'] or 'missing'}",
+ f"statement_count={archive['writer_statement_count']}",
+ ],
+ },
+ {
+ "key": "catalog_record_archive_summary_traceability",
+ "title": "Catalog record archive summary traceability",
+ "facts": [
+ f"artifact_path_count={artifact_count}",
+ f"archive_passed={archive['archive_passed']}",
+ f"summary_path={operator['report_catalog_record_archive_summary_artifact_path'] or 'missing'}",
+ ],
+ },
+ {
+ "key": "catalog_record_archive_summary_integrity",
+ "title": "Catalog record archive summary integrity",
+ "facts": [
+ f"db_commit={archive['writer_database_commit_executed']}",
+ f"smoke_passed={archive['smoke_postwrite_smoke_passed']}",
+ f"manifest_reviewed={archive['operator_confirmed_archive_manifest_reviewed']}",
+ f"retention_recorded={archive['operator_confirmed_archive_retention_policy_recorded']}",
+ ],
+ },
+ {
+ "key": "catalog_record_archive_summary_safety",
+ "title": "Catalog record archive summary safety",
+ "facts": [
+ "report_generated=false",
+ "api_cli_executed=false",
+ "api_database_write_executed=false",
+ "catalog_record_archive_summary_executed=false",
+ "scheduler_attached=false",
+ ],
+ },
+ ]
+
+
+def _summary_gates(archive, operator, apply_real_write):
+ return [
+ {
+ "key": "report_catalog_record_archive_passed",
+ "label": "上一關 report catalog record archive gate 已通過",
+ "passed": bool(
+ archive["provided"]
+ and archive["mode"]
+ == "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_preview"
+ and archive["archive_passed"]
+ and archive["ready_for_next_manual_phase"]
+ and archive["ready_for_market_intel_report_catalog_record_archive_summary"]
+ and not archive["ready_for_market_intel_report_catalog_record_archive"]
+ ),
+ },
+ {
+ "key": "report_catalog_record_archive_catalog_record_evidence_retained",
+ "label": "archive payload 保留 catalog record identity、DB commit 與 post-write smoke 證據",
+ "passed": bool(
+ archive["writer_catalog_record_key"]
+ and archive["writer_target_table"] == TARGET_TABLE
+ and archive["writer_target_column"] == TARGET_COLUMN
+ and archive["writer_statement_count"] > 0
+ and archive["writer_database_commit_executed"]
+ and archive["writer_hash_match"]
+ and archive["smoke_read_only_query_executed"]
+ and archive["smoke_postwrite_smoke_passed"]
+ and archive["smoke_hash_match"]
+ ),
+ },
+ {
+ "key": "report_catalog_record_archive_artifacts_verified",
+ "label": "archive payload 保留 closeout、commit、run receipt、writer output、post-write smoke、backup 與 archive artifact trace",
+ "passed": bool(
+ archive["closeout_passed"]
+ and archive["closeout_artifact_path_recorded"]
+ and archive["commit_artifact_path_recorded"]
+ and archive["run_receipt_artifact_path_recorded"]
+ and archive["writer_output_artifact_path_recorded"]
+ and archive["postwrite_smoke_artifact_path_recorded"]
+ and archive["backup_artifact_path_recorded"]
+ and archive["archive_artifact_path"]
+ and archive["archive_closeout_artifact_path_recorded"]
+ and archive["archive_commit_artifact_path_recorded"]
+ and archive["archive_run_receipt_artifact_path_recorded"]
+ and archive["archive_writer_output_artifact_path_recorded"]
+ and archive["archive_postwrite_smoke_artifact_path_recorded"]
+ and archive["archive_backup_artifact_path_recorded"]
+ ),
+ },
+ {
+ "key": "report_catalog_record_archive_operator_evidence_retained",
+ "label": "archive payload 保留操作員 archive、manifest、retention policy 與 archive summary separate gate 確認",
+ "passed": bool(
+ archive["operator_confirmed_archive_gate"]
+ and archive["operator_confirmed_closeout_reviewed"]
+ and archive["operator_confirmed_db_commit_observed"]
+ and archive["operator_confirmed_no_followup_db_write_required"]
+ and archive["operator_confirmed_archive_manifest_reviewed"]
+ and archive["operator_confirmed_archive_retention_policy_recorded"]
+ and archive["operator_confirmed_archive_summary_requires_separate_gate"]
+ ),
+ },
+ {
+ "key": "report_catalog_record_archive_promotion_gate",
+ "label": "archive promotion gate 僅放行到 catalog record archive summary 且要求獨立 gate",
+ "passed": bool(
+ archive["promotion_allowed"]
+ and archive["promotion_next_manual_phase"]
+ == "market_intel_report_catalog_record_archive_summary"
+ and archive["promotion_archive_summary_separate_gate"]
+ and archive["promotion_api_must_not_generate_report"]
+ and archive["promotion_api_must_not_write_file"]
+ and archive["promotion_api_must_not_execute_cli"]
+ and archive["promotion_api_must_not_write_catalog_record"]
+ and archive["promotion_api_must_not_write_database"]
+ and archive["promotion_api_must_not_commit_catalog_record"]
+ and archive["promotion_api_must_not_dispatch_telegram"]
+ ),
+ },
+ {
+ "key": "report_catalog_record_archive_api_side_effects_blocked",
+ "label": "上一關 archive top-level API 沒有執行 CLI、寫檔、寫 DB、commit、派 Telegram 或掛 scheduler",
+ "passed": bool(
+ not archive["api_executes_cli"]
+ and not archive["api_writes_file"]
+ and not archive["api_writes_database"]
+ and not archive["api_dispatches_telegram"]
+ and not archive["database_write_executed"]
+ and not archive["catalog_record_archive_executed"]
+ and not archive["scheduler_attached"]
+ and not archive["blocked_response_keys_true"]
+ ),
+ },
+ {
+ "key": "report_catalog_record_archive_safe_boundaries_complete",
+ "label": "上一關 archive safe boundaries 完整且未夾帶 token key",
+ "passed": bool(
+ archive["safe_boundaries_complete"]
+ and not archive["forbidden_token_key_detected"]
+ ),
+ },
+ {
+ "key": "report_catalog_record_archive_summary_operator_confirmed",
+ "label": "操作員確認 archive summary gate、完整 traceability、read-only summary 與 final closeout separate gate",
+ "passed": bool(
+ operator["report_catalog_record_archive_summary_artifact_path"]
+ and operator["report_catalog_record_archive_artifact_path_recorded"]
+ and operator["report_catalog_record_closeout_artifact_path_recorded"]
+ and operator["report_catalog_record_commit_artifact_path_recorded"]
+ and operator["report_catalog_record_run_receipt_artifact_path_recorded"]
+ and operator["catalog_record_writer_output_artifact_path_recorded"]
+ and operator["catalog_record_postwrite_smoke_artifact_path_recorded"]
+ and operator["catalog_record_backup_artifact_path_recorded"]
+ and operator[
+ "operator_confirmed_report_catalog_record_archive_summary_gate"
+ ]
+ and operator[
+ "operator_confirmed_report_catalog_record_archive_reviewed"
+ ]
+ and operator["operator_confirmed_catalog_record_traceability_reviewed"]
+ and operator[
+ "operator_confirmed_catalog_record_archive_summary_read_only"
+ ]
+ and operator[
+ "operator_confirmed_catalog_record_final_closeout_requires_separate_gate"
+ ]
+ ),
+ },
+ {
+ "key": "report_catalog_record_archive_summary_runtime_boundaries_confirmed",
+ "label": "操作員確認本 API 不產報表、不寫檔、不執行 CLI、不寫 DB、不派 Telegram、不呼叫 LLM、不掛 scheduler",
+ "passed": bool(
+ operator[
+ "operator_confirmed_no_token_in_report_catalog_record_archive_summary"
+ ]
+ and operator["operator_confirmed_no_api_report_generation"]
+ and operator["operator_confirmed_no_api_file_write"]
+ and operator["operator_confirmed_no_api_cli_execution"]
+ and operator["operator_confirmed_no_api_catalog_record_write"]
+ and operator["operator_confirmed_no_api_telegram_dispatch"]
+ and operator["operator_confirmed_no_api_db_write"]
+ and operator["operator_confirmed_no_llm_call"]
+ and operator["operator_confirmed_no_scheduler_attach"]
+ ),
+ },
+ {
+ "key": "report_catalog_record_archive_summary_no_token_submitted_to_api",
+ "label": "archive summary gate payload 不得包含 approval 或 Telegram token key",
+ "passed": not operator["forbidden_token_submitted_to_api"],
+ },
+ {
+ "key": "report_catalog_record_archive_summary_apply_real_write_not_requested_from_api",
+ "label": "API/UI report catalog record archive summary gate 不接受 apply_real_write",
+ "passed": not apply_real_write,
+ },
+ ]
+
+
+def build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary(
+ *,
+ telegram_dispatch_report_catalog_record_archive,
+ report_catalog_record_archive_summary=None,
+ operator_evidence=None,
+ execute_requested=False,
+ apply_real_write=False,
+):
+ """建立 Telegram dispatch report catalog record archive summary gate;不執行副作用。"""
+ archive = _archive_summary(telegram_dispatch_report_catalog_record_archive)
+ operator = _operator_summary(operator_evidence, report_catalog_record_archive_summary)
+ sections = _summary_sections(archive, operator)
+ gates = _summary_gates(archive, operator, bool(apply_real_write))
+ blocked_reasons = [gate["key"] for gate in gates if not gate["passed"]]
+ summary_passed = bool(not blocked_reasons)
+
+ return {
+ "mode": "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_preview",
+ "target_table": TARGET_TABLE,
+ "target_column": TARGET_COLUMN,
+ "target_json_path": [
+ "market_intel_ai_summary",
+ "telegram_dispatch_report_catalog_record_archive_summary",
+ ],
+ "target_operation": "summarize_manual_market_intel_report_catalog_record_archive",
+ "execute_requested": bool(execute_requested),
+ "apply_real_write_requested": bool(apply_real_write),
+ "report_catalog_record_archive_summary_reviewed": True,
+ "telegram_dispatch_report_catalog_record_archive_summary_passed": summary_passed,
+ "summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_passed": summary_passed,
+ "report_catalog_record_archive_summary_passed": summary_passed,
+ "ready_for_next_manual_phase": summary_passed,
+ "ready_for_market_intel_report_catalog_record_final_closeout": summary_passed,
+ "ready_for_market_intel_report_catalog_record_archive_summary": False,
+ "ready_for_market_intel_report_catalog_record_archive": False,
+ "ready_for_market_intel_report_catalog_record_closeout": False,
+ "ready_for_market_intel_report_catalog_record_commit": False,
+ "ready_for_market_intel_report_catalog_record_cli_run": False,
+ "ready_for_cli_operator_run": False,
+ "ready_for_real_write": False,
+ "ready_for_report_generation": False,
+ "ready_for_telegram_dispatch": False,
+ "ready_for_api_database_write": False,
+ "ready_for_scheduler_attach": False,
+ "ready_for_llm_call": False,
+ "api_executes_cli": False,
+ "api_executes_llm": False,
+ "api_dispatches_telegram": False,
+ "api_reads_approval_token": False,
+ "api_writes_file": False,
+ "api_writes_database": False,
+ "api_updates_review_state": False,
+ **{key: False for key in FALSE_RESPONSE_KEYS},
+ "statement_count": archive["writer_statement_count"] or archive["statement_count"],
+ "expected_summary_payload_hash": archive["expected_summary_payload_hash"],
+ "blocked_reasons": blocked_reasons,
+ "gates": gates,
+ "telegram_dispatch_report_catalog_record_archive": archive,
+ "telegram_dispatch_report_catalog_record_archive_summary_sections": sections,
+ "operator_telegram_dispatch_report_catalog_record_archive_summary": operator,
+ "promotion_gate": {
+ "allowed": summary_passed,
+ "next_manual_phase": "market_intel_report_catalog_record_final_closeout",
+ "requires_real_db_write": False,
+ "requires_cli_run": False,
+ "requires_scheduler_attach": False,
+ "requires_operator_approval": True,
+ "requires_postwrite_smoke": False,
+ "api_must_not_generate_report": True,
+ "api_must_not_write_file": True,
+ "api_must_not_execute_cli": True,
+ "api_must_not_write_catalog_record": True,
+ "api_must_not_write_database": True,
+ "api_must_not_dispatch_telegram": True,
+ "api_must_not_commit_catalog_record": True,
+ "report_catalog_record_final_closeout_requires_separate_gate": True,
+ },
+ "next_operator_steps": [
+ "保存 report catalog record archive summary artifact path",
+ "確認 archive summary 只整理 catalog record identity、traceability、integrity 與 runtime safety",
+ "只在 archive summary gate 通過後進入 report catalog record final closeout gate",
+ "不得從 API/UI 產報表、寫檔、補寫 catalog record、commit、派送 Telegram 或掛 scheduler",
+ ],
+ "safe_boundaries": [
+ "do_not_read_approval_token_from_report_catalog_record_archive_summary_api",
+ "do_not_read_telegram_token_from_report_catalog_record_archive_summary_api",
+ "do_not_call_llm_from_report_catalog_record_archive_summary",
+ "do_not_generate_report_from_report_catalog_record_archive_summary_api",
+ "do_not_write_report_catalog_record_archive_summary_artifact_from_api",
+ "do_not_execute_catalog_record_cli_from_report_catalog_record_archive_summary_api",
+ "do_not_write_report_catalog_record_from_report_catalog_record_archive_summary_api",
+ "do_not_commit_catalog_record_from_report_catalog_record_archive_summary_api",
+ "do_not_dispatch_telegram_from_report_catalog_record_archive_summary_api",
+ "do_not_open_database_connection_from_report_catalog_record_archive_summary",
+ "do_not_update_review_state_from_report_catalog_record_archive_summary",
+ "do_not_attach_scheduler_from_report_catalog_record_archive_summary",
+ "future_market_intel_report_catalog_record_final_closeout_must_use_separate_gate",
+ "report_catalog_record_archive_summary_preview_only",
+ "no_remove_orphans",
+ "no_momo_db_lifecycle_change",
+ ],
+ }
diff --git a/services/market_intel/deployment_readiness.py b/services/market_intel/deployment_readiness.py
index da0ad87..60f2a7a 100644
--- a/services/market_intel/deployment_readiness.py
+++ b/services/market_intel/deployment_readiness.py
@@ -54,6 +54,7 @@ from services.market_intel.candidate_queue_review_ai_summary_persistence_telegra
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_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
@@ -85,7 +86,7 @@ BLOCKED_RUN_REVIEW_KEYS = (
"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_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",
"summary_persistence_record_written",
"metadata_patch_written",
"transaction_file_written",
@@ -118,6 +119,14 @@ PRODUCTION_SMOKE_TARGETS = (
)
+ PRODUCTION_SMOKE_TARGETS[-1:]
)
+PRODUCTION_SMOKE_TARGETS = (
+ PRODUCTION_SMOKE_TARGETS[:-1]
+ + (
+ "/api/market_intel/manual_sample_review/"
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary",
+ )
+ + PRODUCTION_SMOKE_TARGETS[-1:]
+)
def _run_review_preview_safe(payload, mode):
return bool(payload["mode"] == mode and all(not payload.get(key) for key in BLOCKED_RUN_REVIEW_KEYS))
def build_deployment_readiness_preview(*, service, market_intel_tables, schema_smoke_builder):
@@ -297,6 +306,7 @@ def build_deployment_readiness_preview(*, service, market_intel_tables, schema_s
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)
checks = {
"schema_smoke_passed": bool(schema_smoke["passed"]),
"feature_flags_default_safe": bool(
@@ -558,6 +568,7 @@ def build_deployment_readiness_preview(*, service, market_intel_tables, schema_s
"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_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"
@@ -835,6 +846,7 @@ def build_deployment_readiness_preview(*, service, market_intel_tables, schema_s
"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_decision_writer_status": candidate_queue_review_decision_writer_status,
"match_review_plan": match_review_plan,
"opportunity_plan": opportunity_plan,
diff --git a/services/market_intel/phase.py b/services/market_intel/phase.py
index 5db849d..ce7d72d 100644
--- a/services/market_intel/phase.py
+++ b/services/market_intel/phase.py
@@ -1,3 +1,3 @@
"""市場情報 rollout phase 單一來源。"""
-MARKET_INTEL_PHASE = "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+MARKET_INTEL_PHASE = "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
diff --git a/templates/market_intel/disabled.html b/templates/market_intel/disabled.html
index 5d1fd2e..ff9d18a 100644
--- a/templates/market_intel/disabled.html
+++ b/templates/market_intel/disabled.html
@@ -778,6 +778,9 @@
+
@@ -1165,6 +1168,7 @@
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordCommit = sampleReviewRoot ? sampleReviewRoot.querySelector('[data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-commit]') : null;
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordCloseout = sampleReviewRoot ? sampleReviewRoot.querySelector('[data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-closeout]') : null;
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchive = sampleReviewRoot ? sampleReviewRoot.querySelector('[data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-archive]') : null;
+ const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveSummary = sampleReviewRoot ? sampleReviewRoot.querySelector('[data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-archive-summary]') : null;
const sampleReviewEndpoint = "{{ url_for('market_intel.market_intel_manual_sample_review') }}";
const sampleReviewEvaluateEndpoint = "{{ url_for('market_intel.market_intel_manual_sample_review_evaluate') }}";
const sampleCandidateHandoffEndpoint = "{{ url_for('market_intel.market_intel_manual_sample_candidate_handoff') }}";
@@ -1229,6 +1233,7 @@
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordCommitEndpoint = "{{ url_for('market_intel_review.market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit') }}";
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordCloseoutEndpoint = "{{ url_for('market_intel_review.market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout') }}";
const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveEndpoint = "{{ url_for('market_intel_review.market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive') }}";
+ const sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveSummaryEndpoint = "{{ url_for('market_intel_review.market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary') }}";
const schedulerMeta = schedulerRoot ? schedulerRoot.querySelector('[data-market-intel-scheduler-meta]') : null;
const schedulerBody = schedulerRoot ? schedulerRoot.querySelector('[data-market-intel-scheduler-body]') : null;
const schedulerRefresh = schedulerRoot ? schedulerRoot.querySelector('[data-market-intel-scheduler-refresh]') : null;
@@ -9483,6 +9488,154 @@
}
};
+ const renderCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveSummary = data => {
+ const blockers = (data.blocked_reasons || []).join(' / ');
+ const gates = data.gates || [];
+ const archive = data.telegram_dispatch_report_catalog_record_archive || {};
+ const operator = data.operator_telegram_dispatch_report_catalog_record_archive_summary || {};
+ const promotion = data.promotion_gate || {};
+ const sections = data.telegram_dispatch_report_catalog_record_archive_summary_sections || [];
+ sampleReviewMeta.innerHTML = [
+ `mode=${data.mode || 'unknown'}`,
+ `summary=${data.telegram_dispatch_report_catalog_record_archive_summary_passed ? 'pass' : 'blocked'}`,
+ `archive=${archive.archive_passed ? 'pass' : 'blocked'}`,
+ `final=${data.ready_for_market_intel_report_catalog_record_final_closeout ? 'ready' : 'blocked'}`,
+ `file=${data.catalog_record_archive_summary_file_written ? 'written' : 'blocked'}`
+ ].map(item => `${escapeHtml(item)}`).join('');
+ sampleReviewBody.innerHTML = `
+
此卡只審核 Telegram dispatch report catalog record archive summary gate;API/UI 不讀 token、不產報表、不寫檔、不執行 CLI、不開 DB、不寫 catalog record、不執行 commit、不派 Telegram、不掛 scheduler。${blockers ? `阻擋:${escapeHtml(blockers)}` : ''}
+
+
+
SUMMARY GATES
+
${
+ gates.map(item => `
+
+
+ ${escapeHtml(item.key)}
+ ${escapeHtml(item.label)}
+
+
${item.passed ? 'PASS' : 'BLOCK'}
+
+ `).join('') || '
尚未提供 archive summary gate。
'
+ }
+
+
+
ARCHIVE
+
+ ${[
+ ['provided', archive.provided],
+ ['mode', archive.mode || 'missing'],
+ ['passed', archive.archive_passed],
+ ['record_key', archive.writer_catalog_record_key || 'missing'],
+ ['summary_ready', archive.ready_for_market_intel_report_catalog_record_archive_summary],
+ ['safe_boundaries', archive.safe_boundaries_complete]
+ ].map(([key, value]) => `
+
+
${escapeHtml(key)}
+
${escapeHtml(String(value))}
+
+ `).join('')}
+
+
+
+
SECTIONS
+
${
+ sections.map(section => `
+
+ ${escapeHtml(section.key || 'section')}
+ ${escapeHtml((section.facts || []).join(' / '))}
+
+ `).join('') || '
尚未提供 summary sections。
'
+ }
+
+
+
OPERATOR
+
+ ${[
+ ['summary_path', operator.report_catalog_record_archive_summary_artifact_path || 'missing'],
+ ['archive_path', operator.report_catalog_record_archive_artifact_path_recorded],
+ ['closeout_path', operator.report_catalog_record_closeout_artifact_path_recorded],
+ ['traceability', operator.operator_confirmed_catalog_record_traceability_reviewed],
+ ['summary_gate', operator.operator_confirmed_report_catalog_record_archive_summary_gate],
+ ['final_gate', operator.operator_confirmed_catalog_record_final_closeout_requires_separate_gate]
+ ].map(([key, value]) => `
+
+
${escapeHtml(key)}
+
${escapeHtml(String(value))}
+
+ `).join('')}
+
+
+
+
RUNTIME
+
+ ${[
+ ['api_report', data.ready_for_report_generation],
+ ['api_file', data.api_writes_file],
+ ['api_cli', data.api_executes_cli],
+ ['api_db', data.api_writes_database],
+ ['summary_exec', data.catalog_record_archive_summary_executed],
+ ['scheduler', data.scheduler_attached]
+ ].map(([key, value]) => `
+
+
${escapeHtml(key)}
+
${escapeHtml(String(value))}
+
+ `).join('')}
+
+
+
+
PROMOTION
+
+ ${[
+ ['next_phase', promotion.next_manual_phase || 'missing'],
+ ['final_gate', promotion.report_catalog_record_final_closeout_requires_separate_gate],
+ ['api_commit', promotion.api_must_not_commit_catalog_record],
+ ['api_write', promotion.api_must_not_write_database],
+ ['api_telegram', promotion.api_must_not_dispatch_telegram]
+ ].map(([key, value]) => `
+
+
${escapeHtml(key)}
+
${escapeHtml(String(value))}
+
+ `).join('')}
+
+
+
+ `;
+ };
+
+ const loadCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveSummary = async () => {
+ if (!sampleReviewMeta || !sampleReviewBody || !sampleReviewInput) return;
+ let parsed;
+ try {
+ parsed = JSON.parse(sampleReviewInput.value || '{}');
+ } catch (error) {
+ sampleReviewMeta.innerHTML = 'json_error';
+ sampleReviewBody.innerHTML = `JSON 格式錯誤:${escapeHtml(error.message)}
`;
+ return;
+ }
+ const body = parsed && parsed.sample_result ? parsed : { sample_result: parsed };
+ sampleReviewBody.innerHTML = '審核 queue review AI summary Telegram dispatch report catalog record archive summary gate 中...
';
+ try {
+ const response = await fetch(`${sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveSummaryEndpoint}?execute=false&apply_real_write=false`, {
+ method: 'POST',
+ credentials: 'same-origin',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': csrfToken
+ },
+ body: JSON.stringify(body)
+ });
+ const data = await response.json();
+ if (!response.ok && !data.mode) throw new Error(`HTTP ${response.status}`);
+ renderCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveSummary(data);
+ } catch (error) {
+ sampleReviewMeta.innerHTML = 'error';
+ sampleReviewBody.innerHTML = `queue review AI summary Telegram dispatch report catalog record archive summary gate 失敗:${escapeHtml(error.message)}
`;
+ }
+ };
+
const renderCandidateQueueReviewDecisionWriter = data => {
const blockers = (data.blocked_reasons || []).join(' / ');
const summary = data.statement_summary || {};
@@ -11276,6 +11429,9 @@
if (sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchive) {
sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchive.addEventListener('click', loadCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchive);
}
+ if (sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveSummary) {
+ sampleCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveSummary.addEventListener('click', loadCandidateQueueReviewAiSummaryPersistenceTelegramDispatchReportCatalogRecordArchiveSummary);
+ }
if (schedulerRefresh) {
schedulerRefresh.addEventListener('click', loadScheduler);
}
diff --git a/tests/test_market_intel_skeleton.py b/tests/test_market_intel_skeleton.py
index 24063c4..1724a4e 100644
--- a/tests/test_market_intel_skeleton.py
+++ b/tests/test_market_intel_skeleton.py
@@ -1355,6 +1355,14 @@ def test_market_intel_preview_template_uses_safe_fetch_false_endpoint():
"data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-archive"
in template
)
+ assert (
+ "market_intel_review.market_intel_manual_sample_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ in template
+ )
+ assert (
+ "data-market-intel-sample-candidate-queue-review-ai-summary-persistence-telegram-dispatch-report-catalog-record-archive-summary"
+ in template
+ )
assert "X-CSRFToken" in template
assert "market_intel.market_intel_scheduler_plan" in template
assert "market_intel.market_intel_match_review_plan" in template
@@ -1391,7 +1399,7 @@ def test_legacy_source_bridge_default_is_planned_only():
bridge = MarketIntelService().build_legacy_source_bridge()
assert bridge["mode"] == "legacy_source_bridge_planned"
- assert bridge["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert bridge["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert bridge["execute_requested"] is False
assert bridge["read_only_query_executed"] is False
assert bridge["database_connection_opened"] is False
@@ -1549,7 +1557,7 @@ def test_mcp_tool_contract_preview_is_read_only_and_whitelisted():
contract = MarketIntelService().build_mcp_tool_contract()
assert contract["mode"] == "mcp_tool_contract_preview"
- assert contract["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert contract["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert contract["caller"] == "market_intel"
assert contract["contract_ready"] is True
assert contract["blocked_reasons"] == []
@@ -1682,7 +1690,7 @@ def test_mcp_activation_runbook_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "mcp_activation_runbook_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["deployment_actions_executed"] is False
assert data["docker_command_executed"] is False
assert data["ssh_command_executed"] is False
@@ -1695,7 +1703,7 @@ def test_mcp_fetch_gate_default_blocks_external_fetch():
gate = MarketIntelService().build_mcp_fetch_gate(fetch_requested=True)
assert gate["mode"] == "mcp_fetch_gate_planned"
- assert gate["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert gate["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert gate["fetch_requested"] is True
assert gate["manual_fetch_gate_open"] is False
assert gate["network_request_allowed"] is False
@@ -1765,7 +1773,7 @@ def test_mcp_fetch_gate_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "mcp_fetch_gate_planned"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["fetch_requested"] is False
assert data["network_request_allowed"] is False
assert data["external_network_executed"] is False
@@ -1777,7 +1785,7 @@ def test_manual_sample_plan_preview_blocks_fetch_and_write():
plan = MarketIntelService().build_manual_sample_plan()
assert plan["mode"] == "manual_sample_fetch_plan_preview"
- assert plan["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert plan["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert plan["ready_for_manual_sample_fetch"] is False
assert plan["sample_fetch_executed"] is False
assert plan["external_network_executed"] is False
@@ -1825,7 +1833,7 @@ def test_manual_sample_plan_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "manual_sample_fetch_plan_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["sample_fetch_executed"] is False
assert data["external_network_executed"] is False
assert data["database_write_executed"] is False
@@ -1836,7 +1844,7 @@ def test_manual_sample_acceptance_preview_blocks_candidate_import():
acceptance = MarketIntelService().build_manual_sample_acceptance()
assert acceptance["mode"] == "manual_sample_acceptance_preview"
- assert acceptance["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert acceptance["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert acceptance["contract_ready"] is True
assert acceptance["sample_result_loaded"] is False
assert acceptance["sample_result_accepted"] is False
@@ -1878,7 +1886,7 @@ def test_manual_sample_acceptance_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "manual_sample_acceptance_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["sample_result_loaded"] is False
assert data["candidate_import_allowed"] is False
assert data["external_network_executed"] is False
@@ -1890,7 +1898,7 @@ def test_manual_sample_review_preview_is_planned_until_result_loaded():
review = MarketIntelService().build_manual_sample_review()
assert review["mode"] == "manual_sample_review_preview"
- assert review["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert review["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert review["contract_ready"] is True
assert review["sample_result_loaded"] is False
assert review["sample_result_reviewed"] is False
@@ -2001,7 +2009,7 @@ def test_manual_sample_review_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "manual_sample_review_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["sample_result_loaded"] is False
assert data["sample_result_reviewed"] is False
assert data["candidate_import_allowed"] is False
@@ -2040,7 +2048,7 @@ def test_manual_sample_review_evaluation_preview_accepts_payload_without_persist
)
assert review["mode"] == "manual_sample_review_evaluation_preview"
- assert review["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert review["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert review["review_request_type"] == "operator_posted_json"
assert review["payload_received"] is True
assert review["payload_valid_json_object"] is True
@@ -2102,7 +2110,7 @@ def test_manual_sample_review_evaluate_route_is_post_only_and_no_write():
assert response.status_code == 200
assert data["mode"] == "manual_sample_review_evaluation_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["payload_received"] is True
assert data["payload_valid_json_object"] is True
assert data["payload_persisted"] is False
@@ -2182,7 +2190,7 @@ def test_manual_sample_candidate_handoff_preview_creates_candidates_without_pers
)
assert handoff["mode"] == "manual_sample_candidate_handoff_preview"
- assert handoff["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert handoff["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert handoff["payload_received"] is True
assert handoff["payload_valid_json_object"] is True
assert handoff["payload_persisted"] is False
@@ -2246,7 +2254,7 @@ def test_manual_sample_candidate_handoff_route_is_post_only_and_no_write():
assert response.status_code == 200
assert data["mode"] == "manual_sample_candidate_handoff_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["payload_received"] is True
assert data["handoff_ready"] is True
assert data["candidate_handoff_created"] is True
@@ -2305,7 +2313,7 @@ def test_manual_sample_candidate_queue_draft_preview_builds_review_items_without
)
assert queue_draft["mode"] == "manual_sample_candidate_queue_draft_preview"
- assert queue_draft["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert queue_draft["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert queue_draft["payload_received"] is True
assert queue_draft["payload_valid_json_object"] is True
assert queue_draft["payload_persisted"] is False
@@ -2379,7 +2387,7 @@ def test_manual_sample_candidate_queue_draft_route_is_post_only_and_no_write():
assert response.status_code == 200
assert data["mode"] == "manual_sample_candidate_queue_draft_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["payload_received"] is True
assert data["handoff_ready"] is True
assert data["queue_draft_ready"] is True
@@ -2442,7 +2450,7 @@ def test_manual_sample_candidate_queue_approval_preview_blocks_write_and_maps_ro
)
assert approval["mode"] == "manual_sample_candidate_queue_approval_preview"
- assert approval["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert approval["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert approval["payload_received"] is True
assert approval["payload_valid_json_object"] is True
assert approval["payload_persisted"] is False
@@ -2520,7 +2528,7 @@ def test_manual_sample_candidate_queue_approval_route_is_post_only_and_no_write(
assert response.status_code == 200
assert data["mode"] == "manual_sample_candidate_queue_approval_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["payload_received"] is True
assert data["approval_preview_created"] is True
assert data["approval_request_created"] is False
@@ -2583,7 +2591,7 @@ def test_manual_sample_candidate_queue_transaction_preview_blocks_execution():
)
assert transaction["mode"] == "manual_sample_candidate_queue_transaction_preview"
- assert transaction["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert transaction["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert transaction["payload_received"] is True
assert transaction["payload_valid_json_object"] is True
assert transaction["payload_persisted"] is False
@@ -2663,7 +2671,7 @@ def test_manual_sample_candidate_queue_transaction_route_is_post_only_and_no_wri
assert response.status_code == 200
assert data["mode"] == "manual_sample_candidate_queue_transaction_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["payload_received"] is True
assert data["transaction_preview_created"] is True
assert data["transaction_ready"] is False
@@ -8374,7 +8382,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_input_ready"] is False
assert data["summary_persistence_telegram_dispatch_report_input_ready"] is False
@@ -8449,7 +8457,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_summary_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_archive_summary_ready"] is False
assert (
@@ -8721,7 +8729,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_input_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_input_ready"] is False
assert data["summary_persistence_telegram_dispatch_report_input_ready"] is False
@@ -9009,7 +9017,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_package_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_run_package_ready"] is False
assert (
@@ -9319,7 +9327,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_readiness_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_run_readiness_ready"] is False
assert (
@@ -9622,7 +9630,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_run_receipt_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_run_receipt_passed"] is False
assert (
@@ -9881,7 +9889,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_closeout_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_closeout_passed"] is False
assert (
@@ -10154,7 +10162,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_archive_passed"] is False
assert (
@@ -10402,7 +10410,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_archive_summary_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_archive_summary_passed"] is False
assert (
@@ -10632,7 +10640,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_handoff_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_handoff_passed"] is False
assert data["summary_persistence_telegram_dispatch_report_catalog_handoff_passed"] is False
@@ -10869,7 +10877,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_index_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_index_passed"] is False
assert data["summary_persistence_telegram_dispatch_report_catalog_index_passed"] is False
@@ -11111,7 +11119,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_write_preflight_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_write_preflight_passed"] is False
assert (
@@ -11387,7 +11395,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_write_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_record_write_passed"] is False
assert (
@@ -11664,7 +11672,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_package_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_record_run_package_passed"] is False
assert (
@@ -11943,7 +11951,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_readiness_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_record_run_readiness_passed"] is False
assert (
@@ -12272,7 +12280,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_run_receipt_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_record_run_receipt_passed"] is False
assert (
@@ -12534,7 +12542,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_commit_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_record_commit_passed"] is False
assert (
@@ -12798,7 +12806,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_closeout_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_record_closeout_passed"] is False
assert (
@@ -13068,7 +13076,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_report_catalog_record_archive_passed"] is False
assert (
@@ -13110,6 +13118,295 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_
assert TEST_APPROVAL_TOKEN not in payload
+def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_contract_only():
+ 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,
+ )
+
+ archive = {
+ "mode": "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_preview",
+ "target_operation": "review_manual_market_intel_report_catalog_record_archive",
+ "telegram_dispatch_report_catalog_record_archive_passed": True,
+ "summary_persistence_telegram_dispatch_report_catalog_record_archive_passed": True,
+ "report_catalog_record_archive_passed": True,
+ "ready_for_next_manual_phase": True,
+ "ready_for_market_intel_report_catalog_record_archive_summary": True,
+ "ready_for_market_intel_report_catalog_record_archive": False,
+ "statement_count": 1,
+ "expected_summary_payload_hash": "f" * 64,
+ "api_executes_cli": False,
+ "api_writes_file": False,
+ "api_writes_database": False,
+ "api_dispatches_telegram": False,
+ "database_write_executed": False,
+ "catalog_record_archive_executed": False,
+ "scheduler_attached": False,
+ "telegram_dispatch_report_catalog_record_closeout": {
+ "writer_record_family": "market_intel_telegram_dispatch_audit_report",
+ "writer_catalog_record_key": "market-intel-report-20260520",
+ "writer_target_table": "market_alert_review_queue",
+ "writer_target_column": "metadata_json",
+ "writer_statement_count": 1,
+ "writer_database_commit_executed": True,
+ "writer_hash_match": True,
+ "smoke_read_only_query_executed": True,
+ "smoke_postwrite_smoke_passed": True,
+ "smoke_hash_match": True,
+ "closeout_passed": True,
+ "operator_closeout_artifact_path": (
+ "artifacts/market_intel/catalog-record-closeout-gate.json"
+ ),
+ "operator_commit_artifact_path_recorded": True,
+ "operator_run_receipt_artifact_path_recorded": True,
+ "operator_writer_output_artifact_path_recorded": True,
+ "operator_postwrite_smoke_artifact_path_recorded": True,
+ "operator_backup_artifact_path_recorded": True,
+ },
+ "operator_telegram_dispatch_report_catalog_record_archive": {
+ "report_catalog_record_archive_artifact_path": (
+ "artifacts/market_intel/catalog-record-archive-gate.json"
+ ),
+ "report_catalog_record_closeout_artifact_path_recorded": True,
+ "report_catalog_record_commit_artifact_path_recorded": True,
+ "report_catalog_record_run_receipt_artifact_path_recorded": True,
+ "catalog_record_writer_output_artifact_path_recorded": True,
+ "catalog_record_postwrite_smoke_artifact_path_recorded": True,
+ "catalog_record_backup_artifact_path_recorded": True,
+ "operator_confirmed_report_catalog_record_archive_gate": True,
+ "operator_confirmed_report_catalog_record_closeout_reviewed": True,
+ "operator_confirmed_catalog_record_db_commit_observed": True,
+ "operator_confirmed_catalog_record_no_followup_db_write_required": True,
+ "operator_confirmed_catalog_record_archive_manifest_reviewed": True,
+ "operator_confirmed_catalog_record_archive_retention_policy_recorded": True,
+ "operator_confirmed_catalog_record_archive_summary_requires_separate_gate": True,
+ },
+ "promotion_gate": {
+ "allowed": True,
+ "next_manual_phase": "market_intel_report_catalog_record_archive_summary",
+ "report_catalog_record_archive_summary_requires_separate_gate": True,
+ "api_must_not_generate_report": True,
+ "api_must_not_write_file": True,
+ "api_must_not_execute_cli": True,
+ "api_must_not_write_catalog_record": True,
+ "api_must_not_write_database": True,
+ "api_must_not_commit_catalog_record": True,
+ "api_must_not_dispatch_telegram": True,
+ },
+ "safe_boundaries": [
+ "do_not_read_approval_token_from_report_catalog_record_archive_api",
+ "do_not_read_telegram_token_from_report_catalog_record_archive_api",
+ "do_not_call_llm_from_report_catalog_record_archive",
+ "do_not_generate_report_from_report_catalog_record_archive_api",
+ "do_not_write_report_catalog_record_archive_artifact_from_api",
+ "do_not_execute_catalog_record_cli_from_report_catalog_record_archive_api",
+ "do_not_write_report_catalog_record_from_report_catalog_record_archive_api",
+ "do_not_commit_catalog_record_from_report_catalog_record_archive_api",
+ "do_not_dispatch_telegram_from_report_catalog_record_archive_api",
+ "do_not_open_database_connection_from_report_catalog_record_archive",
+ "do_not_update_review_state_from_report_catalog_record_archive",
+ "do_not_attach_scheduler_from_report_catalog_record_archive",
+ "future_market_intel_report_catalog_record_archive_summary_must_use_separate_gate",
+ ],
+ }
+ operator_evidence = {
+ "report_catalog_record_archive_summary_artifact_path": (
+ "artifacts/market_intel/catalog-record-archive-summary-gate.json"
+ ),
+ "report_catalog_record_archive_artifact_path": (
+ "artifacts/market_intel/catalog-record-archive-gate.json"
+ ),
+ "report_catalog_record_closeout_artifact_path": (
+ "artifacts/market_intel/catalog-record-closeout-gate.json"
+ ),
+ "report_catalog_record_commit_artifact_path": (
+ "artifacts/market_intel/catalog-record-commit-gate.json"
+ ),
+ "report_catalog_record_run_receipt_artifact_path": (
+ "artifacts/market_intel/catalog-record-run-receipt.json"
+ ),
+ "catalog_record_writer_output_artifact_path": (
+ "artifacts/market_intel/catalog-record-writer-output.json"
+ ),
+ "catalog_record_postwrite_smoke_artifact_path": (
+ "artifacts/market_intel/catalog-record-postwrite-smoke.json"
+ ),
+ "catalog_record_backup_artifact_path": (
+ "artifacts/market_intel/catalog-record-backup.json"
+ ),
+ "operator_confirmed_report_catalog_record_archive_summary_gate": True,
+ "operator_confirmed_report_catalog_record_archive_reviewed": True,
+ "operator_confirmed_catalog_record_traceability_reviewed": True,
+ "operator_confirmed_catalog_record_archive_summary_read_only": True,
+ "operator_confirmed_catalog_record_final_closeout_requires_separate_gate": True,
+ "operator_confirmed_no_token_in_report_catalog_record_archive_summary": True,
+ "operator_confirmed_no_api_report_generation": True,
+ "operator_confirmed_no_api_file_write": True,
+ "operator_confirmed_no_api_cli_execution": True,
+ "operator_confirmed_no_api_catalog_record_write": True,
+ "operator_confirmed_no_api_telegram_dispatch": True,
+ "operator_confirmed_no_api_db_write": True,
+ "operator_confirmed_no_llm_call": True,
+ "operator_confirmed_no_scheduler_attach": True,
+ "catalog_record_archive_summary_notes": "manual archive summary reviewed",
+ }
+
+ summary = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary(
+ telegram_dispatch_report_catalog_record_archive=archive,
+ operator_evidence=operator_evidence,
+ execute_requested=True,
+ )
+ token_leak = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary(
+ telegram_dispatch_report_catalog_record_archive=archive,
+ operator_evidence={**operator_evidence, "telegram_token": TEST_APPROVAL_TOKEN},
+ )
+ apply_write = build_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary(
+ telegram_dispatch_report_catalog_record_archive=archive,
+ operator_evidence=operator_evidence,
+ apply_real_write=True,
+ )
+
+ assert summary["mode"] == (
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_preview"
+ )
+ assert summary["target_operation"] == (
+ "summarize_manual_market_intel_report_catalog_record_archive"
+ )
+ assert summary["telegram_dispatch_report_catalog_record_archive_summary_passed"] is True
+ assert (
+ summary[
+ "summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_passed"
+ ]
+ is True
+ )
+ assert summary["report_catalog_record_archive_summary_passed"] is True
+ assert summary["ready_for_market_intel_report_catalog_record_final_closeout"] is True
+ assert summary["ready_for_market_intel_report_catalog_record_archive_summary"] is False
+ assert summary["ready_for_market_intel_report_catalog_record_archive"] is False
+ assert summary["ready_for_real_write"] is False
+ assert summary["ready_for_report_generation"] is False
+ assert summary["ready_for_api_database_write"] is False
+ assert summary["api_executes_cli"] is False
+ assert summary["api_writes_file"] is False
+ assert summary["api_writes_database"] is False
+ assert summary["catalog_record_written"] is False
+ assert summary["catalog_record_archive_summary_gate_file_written"] is False
+ assert summary["catalog_record_archive_summary_executed"] is False
+ assert summary["catalog_record_final_closeout_gate_file_written"] is False
+ assert summary["database_connection_opened"] is False
+ assert summary["database_write_executed"] is False
+ assert summary["scheduler_attached"] is False
+ assert summary["blocked_reasons"] == []
+ assert summary["telegram_dispatch_report_catalog_record_archive"][
+ "writer_database_commit_executed"
+ ] is True
+ assert summary["promotion_gate"]["next_manual_phase"] == (
+ "market_intel_report_catalog_record_final_closeout"
+ )
+ assert (
+ summary["promotion_gate"][
+ "report_catalog_record_final_closeout_requires_separate_gate"
+ ]
+ is True
+ )
+ assert (
+ token_leak[
+ "telegram_dispatch_report_catalog_record_archive_summary_passed"
+ ]
+ is False
+ )
+ assert (
+ "report_catalog_record_archive_summary_no_token_submitted_to_api"
+ in token_leak["blocked_reasons"]
+ )
+ assert (
+ "report_catalog_record_archive_summary_apply_real_write_not_requested_from_api"
+ in apply_write["blocked_reasons"]
+ )
+ assert (
+ "do_not_commit_catalog_record_from_report_catalog_record_archive_summary_api"
+ in summary["safe_boundaries"]
+ )
+ assert TEST_APPROVAL_TOKEN not in json.dumps(
+ token_leak,
+ ensure_ascii=False,
+ sort_keys=True,
+ )
+
+
+def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_route_is_post_only_and_no_write():
+ from routes.market_intel_routes import market_intel_bp
+ from routes.market_intel_review_routes import market_intel_review_bp
+
+ app = Flask(__name__)
+ app.secret_key = "test-secret"
+ app.register_blueprint(market_intel_bp)
+ app.register_blueprint(market_intel_review_bp)
+ client = app.test_client()
+ with client.session_transaction() as session:
+ session["logged_in"] = True
+
+ get_response = client.get(
+ "/api/market_intel/manual_sample_review/"
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ )
+ response = client.post(
+ "/api/market_intel/manual_sample_review/"
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ "?execute=true&apply_real_write=true",
+ json={"sample_result": {}},
+ )
+ data = response.get_json()
+ payload = json.dumps(data, ensure_ascii=False, sort_keys=True)
+
+ assert get_response.status_code == 405
+ assert response.status_code == 200
+ assert data["mode"] == (
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_preview"
+ )
+ assert data["phase"] == (
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ )
+ assert data["telegram_dispatch_report_catalog_record_archive_summary_passed"] is False
+ assert (
+ data[
+ "summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_passed"
+ ]
+ is False
+ )
+ assert data["report_catalog_record_archive_summary_passed"] is False
+ assert data["ready_for_market_intel_report_catalog_record_final_closeout"] is False
+ assert data["ready_for_market_intel_report_catalog_record_archive_summary"] is False
+ assert data["ready_for_real_write"] is False
+ assert data["ready_for_report_generation"] is False
+ assert data["ready_for_api_database_write"] is False
+ assert data["api_executes_cli"] is False
+ assert data["api_writes_file"] is False
+ assert data["api_writes_database"] is False
+ assert data["catalog_record_written"] is False
+ assert data["catalog_record_archive_summary_gate_file_written"] is False
+ assert data["catalog_record_archive_summary_executed"] is False
+ assert data["catalog_record_final_closeout_gate_file_written"] is False
+ assert data["database_connection_opened"] is False
+ assert data["database_write_executed"] is False
+ assert data["scheduler_attached"] is False
+ assert data["telegram_dispatch_report_catalog_record_archive"]["mode"] == (
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_preview"
+ )
+ assert "report_catalog_record_archive_passed" in data["blocked_reasons"]
+ assert "report_catalog_record_archive_summary_operator_confirmed" in data[
+ "blocked_reasons"
+ ]
+ assert (
+ "report_catalog_record_archive_summary_apply_real_write_not_requested_from_api"
+ in data["blocked_reasons"]
+ )
+ assert (
+ "do_not_commit_catalog_record_from_report_catalog_record_archive_summary_api"
+ in data["safe_boundaries"]
+ )
+ assert TEST_APPROVAL_TOKEN not in payload
+
+
def test_candidate_queue_writer_preflight_route_is_post_only_and_no_write():
from routes.market_intel_routes import market_intel_bp
@@ -13152,7 +13449,7 @@ def test_candidate_queue_writer_preflight_route_is_post_only_and_no_write():
assert response.status_code == 200
assert data["mode"] == "candidate_queue_writer_preflight_planned"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["read_only_query_executed"] is False
assert data["database_connection_opened"] is False
@@ -13209,7 +13506,7 @@ def test_candidate_queue_writer_status_route_never_leaks_approval_token(monkeypa
assert response.status_code == 200
assert data["mode"] == "candidate_queue_writer_cli_blocked"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is True
assert data["apply_real_write_requested"] is True
assert data["approval_token_present"] is False
@@ -13298,7 +13595,7 @@ def test_candidate_queue_writer_postwrite_smoke_route_is_post_only_and_no_write(
assert response.status_code == 200
assert data["mode"] == "candidate_queue_writer_postwrite_smoke_planned"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["read_only_query_executed"] is False
assert data["database_connection_opened"] is False
@@ -13352,7 +13649,7 @@ def test_candidate_queue_writer_operator_drill_route_is_post_only_and_no_write()
assert response.status_code == 200
assert data["mode"] == "candidate_queue_writer_operator_drill_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["operator_drill_ready"] is True
assert data["api_executes_cli"] is False
assert data["api_reads_approval_token"] is False
@@ -13408,7 +13705,7 @@ def test_candidate_queue_writer_run_package_route_is_post_only_and_no_write():
assert response.status_code == 200
assert data["mode"] == "candidate_queue_writer_run_package_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["package_ready"] is True
assert data["package_artifact_created"] is False
assert data["api_writes_file"] is False
@@ -13474,7 +13771,7 @@ def test_candidate_queue_writer_run_readiness_route_is_post_only_and_no_write():
assert response.status_code == 200
assert data["mode"] == "candidate_queue_writer_run_readiness_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["ready_for_cli_operator_run"] is True
assert data["ready_for_api_database_write"] is False
assert data["api_executes_cli"] is False
@@ -13776,7 +14073,7 @@ def test_candidate_queue_writer_run_receipt_route_accepts_inline_payload_no_writ
assert response.status_code == 200
assert data["mode"] == "candidate_queue_writer_run_receipt_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["receipt_passed"] is True
assert data["ready_for_api_database_write"] is False
assert data["ready_for_scheduler_attach"] is False
@@ -13824,7 +14121,7 @@ def test_candidate_queue_writer_run_closeout_route_is_post_only_and_no_write():
assert response.status_code == 200
assert data["mode"] == "candidate_queue_writer_run_closeout_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["closeout_passed"] is True
assert data["ready_for_next_manual_phase"] is True
assert data["ready_for_api_database_write"] is False
@@ -13873,7 +14170,7 @@ def test_candidate_queue_review_handoff_route_is_post_only_and_no_write():
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_handoff_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["handoff_ready"] is True
assert data["ready_for_manual_queue_review"] is True
assert data["ready_for_api_database_write"] is False
@@ -13931,7 +14228,7 @@ def test_candidate_queue_review_inventory_route_is_post_only_and_no_write():
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_inventory_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["review_inventory_ready"] is False
assert data["ready_for_human_decision_review"] is False
@@ -13997,7 +14294,7 @@ def test_candidate_queue_review_decision_route_is_post_only_and_no_write():
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_decision_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["decision_ready"] is False
assert data["ready_for_human_decision_record"] is False
assert data["ready_for_api_review_state_update"] is False
@@ -14068,7 +14365,7 @@ def test_candidate_queue_review_decision_approval_route_is_post_only_and_no_writ
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_decision_approval_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["approval_ready"] is False
assert data["ready_for_review_state_transaction_preview"] is False
assert data["ready_for_cli_decision_writer"] is False
@@ -14144,7 +14441,7 @@ def test_candidate_queue_review_decision_transaction_route_is_post_only_and_no_w
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_decision_transaction_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["transaction_preview_created"] is False
assert data["transaction_ready"] is False
assert data["ready_for_manual_shell_update_window"] is False
@@ -14226,7 +14523,7 @@ def test_candidate_queue_review_decision_writer_status_route_is_post_only_and_no
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_decision_writer_cli_blocked"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is True
assert data["apply_real_write_requested"] is True
assert data["approval_token_present"] is False
@@ -14312,7 +14609,7 @@ def test_candidate_queue_review_decision_writer_preflight_route_is_post_only_and
assert data["mode"] == (
"candidate_queue_review_decision_writer_preflight_preview"
)
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is True
assert data["apply_real_write_requested"] is True
assert data["read_only_query_executed"] is False
@@ -14395,7 +14692,7 @@ def test_candidate_queue_review_decision_writer_postwrite_smoke_route_is_post_on
assert data["mode"] == (
"candidate_queue_review_decision_writer_postwrite_smoke_planned"
)
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["read_only_query_executed"] is False
assert data["database_connection_opened"] is False
@@ -14478,7 +14775,7 @@ def test_candidate_queue_review_decision_writer_operator_drill_route_is_post_onl
assert data["mode"] == (
"candidate_queue_review_decision_writer_operator_drill_preview"
)
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["operator_drill_ready"] is False
assert data["ready_for_api_review_state_update"] is False
assert data["ready_for_api_database_write"] is False
@@ -14564,7 +14861,7 @@ def test_candidate_queue_review_decision_writer_run_package_route_is_post_only_a
assert data["mode"] == (
"candidate_queue_review_decision_writer_run_package_preview"
)
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["package_ready"] is False
assert data["package_artifact_created"] is False
assert data["ready_for_api_review_state_update"] is False
@@ -14655,7 +14952,7 @@ def test_candidate_queue_review_decision_writer_run_readiness_route_is_post_only
"candidate_queue_review_decision_writer_run_readiness_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["ready_for_cli_operator_run"] is False
assert data["ready_for_api_review_state_update"] is False
@@ -14765,7 +15062,7 @@ def test_candidate_queue_review_decision_writer_run_receipt_route_is_post_only_a
"candidate_queue_review_decision_writer_run_receipt_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["receipt_passed"] is False
assert data["ready_for_api_review_state_update"] is False
@@ -14851,7 +15148,7 @@ def test_candidate_queue_review_decision_writer_run_closeout_route_is_post_only_
"candidate_queue_review_decision_writer_run_closeout_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["closeout_passed"] is False
assert data["ready_for_api_review_state_update"] is False
@@ -14908,7 +15205,7 @@ def test_candidate_queue_review_decision_post_closeout_inventory_route_is_post_o
"candidate_queue_review_decision_post_closeout_inventory_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["post_closeout_inventory_ready"] is False
assert data["ready_for_api_review_state_update"] is False
@@ -14961,7 +15258,7 @@ def test_candidate_queue_review_completion_archive_route_is_post_only_and_no_wri
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_completion_archive_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["review_completion_archive_ready"] is False
assert data["archive_manifest_ready"] is False
assert data["ready_for_api_review_state_update"] is False
@@ -15014,7 +15311,7 @@ def test_candidate_queue_review_archive_summary_route_is_post_only_and_no_write(
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_archive_summary_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["archive_summary_ready"] is False
assert data["summary_input_ready"] is False
assert data["ready_for_ai_summary_generation"] is False
@@ -15075,7 +15372,7 @@ def test_candidate_queue_review_ai_summary_preflight_route_is_post_only_and_no_w
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_ai_summary_preflight_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["ai_summary_preflight_ready"] is False
assert data["ready_for_manual_ollama_summary_run"] is False
assert data["ready_for_ai_summary_generation"] is False
@@ -15144,7 +15441,7 @@ def test_candidate_queue_review_ai_summary_run_package_route_is_post_only_and_no
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_ai_summary_run_package_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["ai_summary_run_package_ready"] is False
assert data["ready_for_manual_ollama_summary_run"] is False
assert data["ready_for_ai_summary_generation"] is False
@@ -15216,7 +15513,7 @@ def test_candidate_queue_review_ai_summary_output_receipt_route_is_post_only_and
assert get_response.status_code == 405
assert response.status_code == 200
assert data["mode"] == "candidate_queue_review_ai_summary_output_receipt_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["ai_summary_output_receipt_ready"] is False
assert data["ready_for_summary_persistence_review"] is False
assert data["manual_ai_summary_output_provided"] is False
@@ -15289,7 +15586,7 @@ def test_candidate_queue_review_ai_summary_persistence_preflight_route_is_post_o
"candidate_queue_review_ai_summary_persistence_preflight_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["summary_persistence_preflight_ready"] is False
assert data["ready_for_summary_transaction_preview"] is False
@@ -15360,7 +15657,7 @@ def test_candidate_queue_review_ai_summary_persistence_transaction_route_is_post
"candidate_queue_review_ai_summary_persistence_transaction_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["summary_persistence_transaction_ready"] is False
assert data["ready_for_summary_persistence_writer_gate"] is False
@@ -15425,7 +15722,7 @@ def test_candidate_queue_review_ai_summary_persistence_writer_preflight_route_is
"candidate_queue_review_ai_summary_persistence_writer_preflight_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["summary_persistence_writer_preflight_ready"] is False
assert data["ready_for_summary_persistence_run_package"] is False
@@ -15496,7 +15793,7 @@ def test_candidate_queue_review_ai_summary_persistence_run_package_route_is_post
"candidate_queue_review_ai_summary_persistence_run_package_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["package_ready"] is False
assert data["ready_for_summary_persistence_run_readiness"] is False
@@ -15569,7 +15866,7 @@ def test_candidate_queue_review_ai_summary_persistence_run_readiness_route_is_po
"candidate_queue_review_ai_summary_persistence_run_readiness_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["run_readiness_ready"] is False
assert data["summary_persistence_run_readiness_ready"] is False
@@ -15646,7 +15943,7 @@ def test_candidate_queue_review_ai_summary_persistence_run_receipt_route_is_post
"candidate_queue_review_ai_summary_persistence_run_receipt_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["run_receipt_passed"] is False
assert data["summary_persistence_run_receipt_passed"] is False
@@ -15723,7 +16020,7 @@ def test_candidate_queue_review_ai_summary_persistence_run_closeout_route_is_pos
"candidate_queue_review_ai_summary_persistence_run_closeout_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["closeout_passed"] is False
assert data["summary_persistence_closeout_passed"] is False
@@ -15800,7 +16097,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate_ro
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_gate_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_gate_passed"] is False
assert data["summary_persistence_telegram_dispatch_gate_passed"] is False
@@ -15874,7 +16171,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_pac
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_package_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_run_package_ready"] is False
assert data["summary_persistence_telegram_dispatch_run_package_ready"] is False
@@ -15953,7 +16250,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_rea
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_readiness_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_run_readiness_ready"] is False
assert (
@@ -16040,7 +16337,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_rec
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_run_receipt_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_run_receipt_passed"] is False
assert data["summary_persistence_telegram_dispatch_run_receipt_passed"] is False
@@ -16121,7 +16418,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeou
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_closeout_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_closeout_passed"] is False
assert data["summary_persistence_telegram_dispatch_closeout_passed"] is False
@@ -16203,7 +16500,7 @@ def test_candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_archive_preview"
)
assert data["phase"] == (
- "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
)
assert data["telegram_dispatch_archive_ready"] is False
assert data["summary_persistence_telegram_dispatch_archive_ready"] is False
@@ -16286,7 +16583,7 @@ def test_candidate_queue_writer_run_receipt_route_is_post_only_and_no_write():
assert response.status_code == 200
assert data["mode"] == "candidate_queue_writer_run_receipt_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["receipt_passed"] is True
assert data["ready_for_next_manual_review"] is True
assert data["ready_for_api_database_write"] is False
@@ -16311,7 +16608,7 @@ def test_scheduler_plan_preview_blocks_job_attachment():
plan = MarketIntelService().build_scheduler_plan()
assert plan["mode"] == "scheduler_attach_plan_preview"
- assert plan["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert plan["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert plan["ready_to_attach_scheduler"] is False
assert plan["scheduler_attached"] is False
assert plan["scheduler_registration_executed"] is False
@@ -16349,7 +16646,7 @@ def test_scheduler_plan_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "scheduler_attach_plan_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["scheduler_registration_executed"] is False
assert data["crawler_job_started"] is False
assert data["external_network_executed"] is False
@@ -16360,7 +16657,7 @@ def test_match_review_plan_preview_blocks_auto_confirm():
plan = MarketIntelService().build_match_review_plan()
assert plan["mode"] == "match_review_plan_preview"
- assert plan["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert plan["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert plan["ready_for_review_queue"] is False
assert plan["review_queue_created"] is False
assert plan["auto_match_executed"] is False
@@ -16396,7 +16693,7 @@ def test_match_review_plan_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "match_review_plan_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["review_queue_created"] is False
assert data["auto_confirm_executed"] is False
assert data["external_network_executed"] is False
@@ -16407,7 +16704,7 @@ def test_opportunity_plan_preview_blocks_alerts_and_ai_summary():
plan = MarketIntelService().build_opportunity_plan()
assert plan["mode"] == "opportunity_plan_preview"
- assert plan["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert plan["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert plan["ready_for_opportunity_queue"] is False
assert plan["opportunity_queue_created"] is False
assert plan["threat_alert_dispatched"] is False
@@ -16448,7 +16745,7 @@ def test_opportunity_plan_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "opportunity_plan_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["opportunity_queue_created"] is False
assert data["threat_alert_dispatched"] is False
assert data["ai_summary_generated"] is False
@@ -16459,7 +16756,7 @@ def test_opportunity_scoring_plan_preview_blocks_scoring_and_alerts():
plan = MarketIntelService().build_opportunity_scoring_plan()
assert plan["mode"] == "opportunity_scoring_plan_preview"
- assert plan["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert plan["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert plan["ready_for_scoring_job"] is False
assert plan["scoring_job_created"] is False
assert plan["score_calculation_executed"] is False
@@ -16507,7 +16804,7 @@ def test_opportunity_scoring_plan_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "opportunity_scoring_plan_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["scoring_job_created"] is False
assert data["score_calculation_executed"] is False
assert data["sample_scores_generated"] is False
@@ -16519,7 +16816,7 @@ def test_opportunity_evidence_plan_preview_blocks_queries_and_alerts():
plan = MarketIntelService().build_opportunity_evidence_plan()
assert plan["mode"] == "opportunity_evidence_plan_preview"
- assert plan["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert plan["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert plan["ready_for_evidence_bundle"] is False
assert plan["evidence_bundle_created"] is False
assert plan["evidence_query_executed"] is False
@@ -16565,7 +16862,7 @@ def test_opportunity_evidence_plan_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "opportunity_evidence_plan_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["evidence_bundle_created"] is False
assert data["evidence_query_executed"] is False
assert data["sample_evidence_generated"] is False
@@ -16578,7 +16875,7 @@ def test_opportunity_alert_plan_preview_blocks_dispatch_and_llm_calls():
plan = MarketIntelService().build_opportunity_alert_plan()
assert plan["mode"] == "opportunity_alert_plan_preview"
- assert plan["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert plan["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert plan["ready_for_alert_candidates"] is False
assert plan["alert_candidate_created"] is False
assert plan["alert_queue_created"] is False
@@ -16663,7 +16960,7 @@ def test_opportunity_alert_plan_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "opportunity_alert_plan_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["alert_candidate_created"] is False
assert data["alert_queue_created"] is False
assert data["review_queue_created"] is False
@@ -16741,7 +17038,7 @@ def test_mcp_deploy_preflight_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "mcp_external_deploy_preflight_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["deployment_actions_executed"] is False
assert data["docker_command_executed"] is False
assert data["ssh_command_executed"] is False
@@ -16756,7 +17053,7 @@ def test_mcp_readiness_default_is_planned_only(monkeypatch):
readiness = MarketIntelService().build_mcp_readiness()
assert readiness["mode"] == "mcp_readiness_planned"
- assert readiness["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert readiness["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert readiness["execute_requested"] is False
assert readiness["router_enabled"] is False
assert readiness["external_mcp_complete"] is False
@@ -17466,6 +17763,12 @@ def test_deployment_readiness_reports_app_only_release_gate():
]
is True
)
+ assert (
+ readiness["checks"][
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_preview_safe"
+ ]
+ is True
+ )
assert (
readiness["checks"][
"candidate_queue_review_decision_writer_cli_status_safe"
@@ -17780,6 +18083,11 @@ def test_deployment_readiness_reports_app_only_release_gate():
"candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
in readiness["production_smoke_targets"]
)
+ assert (
+ "/api/market_intel/manual_sample_review/"
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ in readiness["production_smoke_targets"]
+ )
assert (
"/api/market_intel/manual_sample_review/"
"candidate_queue_review_decision_writer_status"
@@ -21207,6 +21515,48 @@ def test_deployment_readiness_reports_app_only_release_gate():
]["scheduler_attached"]
is False
)
+ assert (
+ readiness[
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ ]["mode"]
+ == "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary_preview"
+ )
+ assert (
+ readiness[
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ ]["telegram_dispatch_report_catalog_record_archive_summary_passed"]
+ is False
+ )
+ assert (
+ readiness[
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ ]["ready_for_market_intel_report_catalog_record_final_closeout"]
+ is False
+ )
+ assert (
+ readiness[
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ ]["catalog_record_archive_summary_gate_file_written"]
+ is False
+ )
+ assert (
+ readiness[
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ ]["catalog_record_archive_summary_executed"]
+ is False
+ )
+ assert (
+ readiness[
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ ]["database_write_executed"]
+ is False
+ )
+ assert (
+ readiness[
+ "candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
+ ]["scheduler_attached"]
+ is False
+ )
assert (
readiness["candidate_queue_review_decision_writer_status"]["mode"]
== "candidate_queue_review_decision_writer_cli_blocked"
@@ -21357,7 +21707,7 @@ def test_migration_apply_drill_planned_is_safe_and_manual_only():
drill = MarketIntelService().build_migration_apply_drill()
assert drill["mode"] == "migration_apply_drill_preview"
- assert drill["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert drill["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert drill["execute_requested"] is False
assert drill["schema_state"] == "planned_no_db_probe"
assert drill["drill_ready_for_operator_review"] is True
@@ -21472,7 +21822,7 @@ def test_migration_apply_drill_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "migration_apply_drill_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["migration_executed"] is False
assert data["rollback_executed"] is False
@@ -21484,7 +21834,7 @@ def test_migration_catalog_review_planned_is_safe_and_diagnostic():
review = MarketIntelService().build_migration_catalog_review()
assert review["mode"] == "migration_catalog_review_preview"
- assert review["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert review["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert review["execute_requested"] is False
assert review["catalog_state"] == "planned_no_probe"
assert review["seed_state"] == "planned_no_probe"
@@ -21599,7 +21949,7 @@ def test_migration_catalog_review_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "migration_catalog_review_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["catalog_state"] == "planned_no_probe"
assert data["migration_executed"] is False
@@ -21612,7 +21962,7 @@ def test_migration_live_smoke_planned_is_preview_only():
smoke = MarketIntelService().build_migration_live_smoke()
assert smoke["mode"] == "migration_live_smoke_preview"
- assert smoke["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert smoke["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert smoke["execute_requested"] is False
assert smoke["smoke_result"] == "planned_no_execution"
assert smoke["live_smoke_passed"] is False
@@ -21674,7 +22024,7 @@ def test_migration_live_smoke_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "migration_live_smoke_preview"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["smoke_result"] == "planned_no_execution"
assert data["migration_executed"] is False
@@ -21687,7 +22037,7 @@ def test_live_db_inventory_planned_is_preview_only():
inventory = MarketIntelService().build_live_db_inventory()
assert inventory["mode"] == "live_db_inventory_planned"
- assert inventory["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert inventory["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert inventory["execute_requested"] is False
assert inventory["read_only_query_executed"] is False
assert inventory["database_connection_opened"] is False
@@ -21831,7 +22181,7 @@ def test_live_db_inventory_route_is_preview_only():
assert response.status_code == 200
assert data["mode"] == "live_db_inventory_planned"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["read_only_query_executed"] is False
assert data["database_write_executed"] is False
@@ -22067,7 +22417,7 @@ def test_candidate_queue_writer_cli_script_outputs_blocked_gate(tmp_path):
assert result.returncode == 0
assert data["mode"] == "candidate_queue_writer_cli_blocked"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["apply_real_write_requested"] is False
assert data["writes_executed"] is False
@@ -22096,7 +22446,7 @@ def test_review_decision_writer_cli_script_outputs_blocked_gate_without_login_en
assert result.returncode == 0
assert data["mode"] == "candidate_queue_review_decision_writer_cli_blocked"
- assert data["phase"] == "phase_113_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive"
+ assert data["phase"] == "phase_114_candidate_queue_review_ai_summary_persistence_telegram_dispatch_report_catalog_record_archive_summary"
assert data["execute_requested"] is False
assert data["apply_real_write_requested"] is False
assert data["approval_token_present"] is False