feat(market-intel): add opportunity evidence plan preview
All checks were successful
CD Pipeline / deploy (push) Successful in 1m4s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m4s
This commit is contained in:
@@ -320,7 +320,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
|
||||
# ==========================================
|
||||
# 系統版本與路徑
|
||||
# ==========================================
|
||||
SYSTEM_VERSION = "V10.194"
|
||||
SYSTEM_VERSION = "V10.195"
|
||||
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
|
||||
public_url = PUBLIC_URL # 用於模板顯示
|
||||
|
||||
|
||||
@@ -161,6 +161,7 @@ EwoooC 目前已有 MOMO EDM / 節慶活動資料、`promo_products`、PChome
|
||||
- 2026-05-18 追加 match review plan preview:`services.market_intel.match_review_plan` 與 `/api/market_intel/match_review_plan` 定義商品比對訊號、分數門檻、`needs_review → confirmed/rejected` HITL 流程與安全邊界。此階段不建立 review queue、不自動 confirmed、不寫 `market_product_matches`、不呼叫 MCP;價格只能作為輔助訊號,不能單獨決定同品比對。
|
||||
- 2026-05-18 追加 opportunity plan preview:`services.market_intel.opportunity_plan` 與 `/api/market_intel/opportunity_plan` 定義競品低價威脅、促銷缺口、深折重疊、活動即將結束四類規則與分級策略。此階段不建立 opportunity queue、不派送 Telegram、不產生 AI 摘要、不寫 DB;高風險項必須先有 confirmed match 與 DB evidence 才能升級。
|
||||
- 2026-05-18 追加 opportunity scoring plan preview:`services.market_intel.opportunity_scoring` 與 `/api/market_intel/opportunity_scoring_plan` 定義價差、折扣深度、比對可信度、活動急迫性與資料新鮮度五個 scoring dimensions、分級門檻、evidence tables 與人工升級順序。此階段不計分、不產生 sample scores、不建立 scoring job、不寫 DB、不派送 Telegram、不產生 AI 摘要。
|
||||
- 2026-05-18 追加 opportunity evidence plan preview:`services.market_intel.opportunity_evidence` 與 `/api/market_intel/opportunity_evidence_plan` 定義 scoring / alert / AI 摘要必須攜帶的 campaign、market product、match review、MOMO reference、scoring trace 五段 evidence bundle contract。此階段不查 DB、不產生 sample evidence、不建立 alert candidate、不派送 Telegram、不產生 AI 摘要。
|
||||
|
||||
### Phase 4:Coupang / Shopee Adapter
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
| `edm_routes.py` | EDM 與節慶儀表板 | `/edm`, `/festival` |
|
||||
| `monthly_routes.py` | 月結分析 | `/monthly_summary_analysis`, `/api/monthly_summary_data` |
|
||||
| `daily_sales_routes.py` | 當日業績 | `/daily_sales`, `/daily_sales/export*` |
|
||||
| `market_intel_routes.py` | 市場情報 Phase 36 opportunity scoring plan preview | `/market_intel`, `/market_intel/*`, `/api/market_intel/status`, `/api/market_intel/schema`, `/api/market_intel/schema_smoke`, `/api/market_intel/schema_db_probe`, `/api/market_intel/platform_seed_db_diff`, `/api/market_intel/legacy_source_bridge`, `/api/market_intel/mcp_readiness`, `/api/market_intel/mcp_tool_contract`, `/api/market_intel/mcp_deploy_preflight`, `/api/market_intel/mcp_activation_runbook`, `/api/market_intel/mcp_fetch_gate`, `/api/market_intel/scheduler_plan`, `/api/market_intel/match_review_plan`, `/api/market_intel/opportunity_plan`, `/api/market_intel/opportunity_scoring_plan`, `/api/market_intel/adapters`, `/api/market_intel/dry_run_plan`, `/api/market_intel/discovery_plan`, `/api/market_intel/manual_discovery`, `/api/market_intel/candidate_preview`, `/api/market_intel/platform_seed_plan`, `/api/market_intel/platform_seed_write_guard`, `/api/market_intel/platform_seed_writer_plan`, `/api/market_intel/migration_blueprint`, `/api/market_intel/seed_writer_cli_status`, `/api/market_intel/write_approval_runbook`, `/api/market_intel/deployment_readiness` |
|
||||
| `market_intel_routes.py` | 市場情報 Phase 37 opportunity evidence plan preview | `/market_intel`, `/market_intel/*`, `/api/market_intel/status`, `/api/market_intel/schema`, `/api/market_intel/schema_smoke`, `/api/market_intel/schema_db_probe`, `/api/market_intel/platform_seed_db_diff`, `/api/market_intel/legacy_source_bridge`, `/api/market_intel/mcp_readiness`, `/api/market_intel/mcp_tool_contract`, `/api/market_intel/mcp_deploy_preflight`, `/api/market_intel/mcp_activation_runbook`, `/api/market_intel/mcp_fetch_gate`, `/api/market_intel/scheduler_plan`, `/api/market_intel/match_review_plan`, `/api/market_intel/opportunity_plan`, `/api/market_intel/opportunity_scoring_plan`, `/api/market_intel/opportunity_evidence_plan`, `/api/market_intel/adapters`, `/api/market_intel/dry_run_plan`, `/api/market_intel/discovery_plan`, `/api/market_intel/manual_discovery`, `/api/market_intel/candidate_preview`, `/api/market_intel/platform_seed_plan`, `/api/market_intel/platform_seed_write_guard`, `/api/market_intel/platform_seed_writer_plan`, `/api/market_intel/migration_blueprint`, `/api/market_intel/seed_writer_cli_status`, `/api/market_intel/write_approval_runbook`, `/api/market_intel/deployment_readiness` |
|
||||
| `api_routes.py` | 通用任務與查詢 API | `/api/run_task`, `/api/history/*` |
|
||||
| `export_routes.py` | 匯出功能 | `/api/export/*` |
|
||||
| `import_routes.py` | 匯入功能 | `/api/import_excel`, `/api/import/monthly_summary` |
|
||||
|
||||
@@ -175,6 +175,12 @@ def market_intel_opportunity_scoring_plan():
|
||||
return jsonify(_service().build_opportunity_scoring_plan())
|
||||
|
||||
|
||||
@market_intel_bp.route("/api/market_intel/opportunity_evidence_plan")
|
||||
@login_required
|
||||
def market_intel_opportunity_evidence_plan():
|
||||
return jsonify(_service().build_opportunity_evidence_plan())
|
||||
|
||||
|
||||
@market_intel_bp.route("/api/market_intel/adapters")
|
||||
@login_required
|
||||
def market_intel_adapters():
|
||||
|
||||
256
services/market_intel/opportunity_evidence.py
Normal file
256
services/market_intel/opportunity_evidence.py
Normal file
@@ -0,0 +1,256 @@
|
||||
"""市場情報機會與威脅 evidence bundle preview。
|
||||
|
||||
只定義未來 scoring / alert / AI 摘要必須攜帶的可追溯證據包;
|
||||
不查 DB、不產生 sample evidence、不建立 queue、不派送 Telegram。
|
||||
"""
|
||||
|
||||
|
||||
EVIDENCE_SECTIONS = (
|
||||
{
|
||||
"key": "campaign_context",
|
||||
"label": "活動脈絡",
|
||||
"source_tables": [
|
||||
"market_campaigns",
|
||||
"market_campaign_snapshots",
|
||||
"market_crawler_runs",
|
||||
],
|
||||
"required_fields": [
|
||||
"campaign_id",
|
||||
"platform_code",
|
||||
"campaign_name",
|
||||
"campaign_url",
|
||||
"status",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"snapshot_id",
|
||||
"batch_id",
|
||||
],
|
||||
"purpose": "確認活動存在、時間狀態與爬取批次。",
|
||||
},
|
||||
{
|
||||
"key": "market_product_snapshot",
|
||||
"label": "競品商品快照",
|
||||
"source_tables": [
|
||||
"market_campaign_products",
|
||||
"market_product_price_history",
|
||||
],
|
||||
"required_fields": [
|
||||
"market_product_id",
|
||||
"platform_product_id",
|
||||
"product_url",
|
||||
"name",
|
||||
"price",
|
||||
"original_price",
|
||||
"discount_rate",
|
||||
"coupon_text",
|
||||
"rank_position",
|
||||
"crawled_at",
|
||||
],
|
||||
"purpose": "確認競品活動商品與當下價格、折扣、排序訊號。",
|
||||
},
|
||||
{
|
||||
"key": "match_review_state",
|
||||
"label": "商品比對審核狀態",
|
||||
"source_tables": [
|
||||
"market_product_matches",
|
||||
],
|
||||
"required_fields": [
|
||||
"match_id",
|
||||
"momo_i_code",
|
||||
"match_score",
|
||||
"match_status",
|
||||
"match_reason_json",
|
||||
"reviewed_at",
|
||||
"reviewed_by",
|
||||
],
|
||||
"purpose": "確認是否可把競品商品升級為同品或高信心候選。",
|
||||
},
|
||||
{
|
||||
"key": "momo_reference",
|
||||
"label": "MOMO 參考商品",
|
||||
"source_tables": [
|
||||
"products",
|
||||
"price_records",
|
||||
"daily_sales_snapshot",
|
||||
],
|
||||
"required_fields": [
|
||||
"momo_i_code",
|
||||
"product_name",
|
||||
"brand",
|
||||
"reference_price",
|
||||
"latest_price_seen_at",
|
||||
"sales_signal_at",
|
||||
],
|
||||
"purpose": "確認我方價格與銷售訊號,避免只靠競品資料判讀。",
|
||||
},
|
||||
{
|
||||
"key": "scoring_trace",
|
||||
"label": "分數計算軌跡",
|
||||
"source_tables": [
|
||||
"market_product_price_history",
|
||||
"market_product_matches",
|
||||
],
|
||||
"required_fields": [
|
||||
"dimension_scores",
|
||||
"total_score",
|
||||
"threshold_level",
|
||||
"formula_version",
|
||||
"computed_from_batch_id",
|
||||
],
|
||||
"purpose": "讓人工審核、AI 摘要與 Telegram 候選都能追溯分數來源。",
|
||||
},
|
||||
)
|
||||
|
||||
ALERT_ESCALATION_GATES = (
|
||||
{
|
||||
"key": "confirmed_or_reviewed_match",
|
||||
"label": "必須有 confirmed 或 needs_review 高信心比對證據",
|
||||
"required_for": ["high", "critical"],
|
||||
},
|
||||
{
|
||||
"key": "fresh_price_snapshot",
|
||||
"label": "競品價格快照需在有效時間窗內",
|
||||
"required_for": ["medium", "high", "critical"],
|
||||
},
|
||||
{
|
||||
"key": "momo_reference_price",
|
||||
"label": "必須有可追溯的 MOMO 參考價",
|
||||
"required_for": ["high", "critical"],
|
||||
},
|
||||
{
|
||||
"key": "campaign_still_active",
|
||||
"label": "活動仍為 active 或 upcoming,ended 不得進即時告警",
|
||||
"required_for": ["medium", "high", "critical"],
|
||||
},
|
||||
{
|
||||
"key": "operator_approval",
|
||||
"label": "人工批准後才可進 Telegram 或 AI 摘要候選",
|
||||
"required_for": ["critical"],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def _schema_tables(schema_smoke):
|
||||
expected_tables = schema_smoke.get("expected_tables") or []
|
||||
if expected_tables:
|
||||
return set(expected_tables)
|
||||
smoke = schema_smoke.get("schema_smoke") or schema_smoke
|
||||
return {
|
||||
item.get("table")
|
||||
for item in smoke.get("tables", [])
|
||||
if item.get("table")
|
||||
}
|
||||
|
||||
|
||||
def build_opportunity_evidence_plan_preview(
|
||||
*,
|
||||
runtime_status,
|
||||
opportunity_plan,
|
||||
scoring_plan,
|
||||
match_review_plan,
|
||||
legacy_source_bridge,
|
||||
schema_smoke,
|
||||
):
|
||||
"""建立 evidence bundle 計畫;不查資料、不產生範例 evidence。"""
|
||||
available_tables = _schema_tables(schema_smoke)
|
||||
required_market_tables = {
|
||||
table
|
||||
for section in EVIDENCE_SECTIONS
|
||||
for table in section["source_tables"]
|
||||
if table.startswith("market_")
|
||||
}
|
||||
required_market_tables_declared = required_market_tables <= available_tables
|
||||
scoring_preview_safe = (
|
||||
scoring_plan.get("mode") == "opportunity_scoring_plan_preview"
|
||||
and not scoring_plan.get("score_calculation_executed")
|
||||
and not scoring_plan.get("scoring_job_created")
|
||||
and not scoring_plan.get("database_write_executed")
|
||||
)
|
||||
opportunity_preview_safe = (
|
||||
opportunity_plan.get("mode") == "opportunity_plan_preview"
|
||||
and not opportunity_plan.get("opportunity_queue_created")
|
||||
and not opportunity_plan.get("threat_alert_dispatched")
|
||||
)
|
||||
match_review_preview_safe = (
|
||||
match_review_plan.get("mode") == "match_review_plan_preview"
|
||||
and not match_review_plan.get("auto_confirm_executed")
|
||||
and not match_review_plan.get("database_write_executed")
|
||||
)
|
||||
legacy_bridge_safe = (
|
||||
legacy_source_bridge.get("mode") == "legacy_source_bridge_planned"
|
||||
and not legacy_source_bridge.get("read_only_query_executed")
|
||||
and not legacy_source_bridge.get("database_write_executed")
|
||||
)
|
||||
gate_checks = {
|
||||
"opportunity_plan_preview_safe": opportunity_preview_safe,
|
||||
"scoring_plan_preview_safe": scoring_preview_safe,
|
||||
"match_review_preview_safe": match_review_preview_safe,
|
||||
"legacy_bridge_planned_safe": legacy_bridge_safe,
|
||||
"schema_smoke_passed": bool(
|
||||
(schema_smoke.get("schema_smoke") or schema_smoke).get("passed")
|
||||
),
|
||||
"required_market_tables_declared": required_market_tables_declared,
|
||||
"confirmed_match_evidence_available": bool(
|
||||
match_review_plan.get("ready_for_review_queue")
|
||||
),
|
||||
"scoring_trace_available": bool(scoring_plan.get("ready_for_scoring_job")),
|
||||
"database_write_still_blocked": not bool(
|
||||
runtime_status.database_write_allowed
|
||||
),
|
||||
"manual_operator_approval": False,
|
||||
}
|
||||
blocked_reasons = [
|
||||
key for key, passed in gate_checks.items()
|
||||
if not passed
|
||||
]
|
||||
|
||||
return {
|
||||
"mode": "opportunity_evidence_plan_preview",
|
||||
"ready_for_evidence_bundle": False,
|
||||
"evidence_bundle_created": False,
|
||||
"evidence_query_executed": False,
|
||||
"sample_evidence_generated": False,
|
||||
"alert_candidate_created": False,
|
||||
"telegram_dispatched": False,
|
||||
"ai_summary_generated": False,
|
||||
"database_session_created": False,
|
||||
"database_write_executed": False,
|
||||
"database_commit_executed": False,
|
||||
"external_network_executed": False,
|
||||
"scheduler_attached": False,
|
||||
"writes_executed": False,
|
||||
"would_write_database": False,
|
||||
"section_count": len(EVIDENCE_SECTIONS),
|
||||
"sections": list(EVIDENCE_SECTIONS),
|
||||
"escalation_gates": list(ALERT_ESCALATION_GATES),
|
||||
"required_market_tables": sorted(required_market_tables),
|
||||
"gate_checks": gate_checks,
|
||||
"blocked_reasons": blocked_reasons,
|
||||
"bundle_contract": {
|
||||
"identity": "platform_code + campaign_id + market_product_id + match_id",
|
||||
"freshness_window_hours": 24,
|
||||
"dedupe_key": "rule_key + momo_i_code + platform_product_id + campaign_id + crawled_at_date",
|
||||
"must_include": [
|
||||
"rule_key",
|
||||
"threshold_level",
|
||||
"total_score",
|
||||
"evidence_sections",
|
||||
"source_batch_id",
|
||||
],
|
||||
},
|
||||
"operator_sequence": [
|
||||
"先確認 scoring plan 只基於正式 market_* evidence",
|
||||
"建立 evidence bundle 時逐一附上來源 table 與 primary key",
|
||||
"缺任一高風險 evidence 時只能降級為 watch",
|
||||
"人工審核通過後才可建立 alert candidate",
|
||||
"AI 摘要與 Telegram 候選必須引用 bundle id 與 source_batch_id",
|
||||
],
|
||||
"safe_boundaries": [
|
||||
"do_not_query_database_from_evidence_preview",
|
||||
"do_not_generate_placeholder_evidence",
|
||||
"do_not_create_alert_candidate_from_preview",
|
||||
"do_not_dispatch_telegram_from_evidence_preview",
|
||||
"do_not_generate_ai_summary_from_evidence_preview",
|
||||
"do_not_escalate_without_bundle_contract",
|
||||
],
|
||||
}
|
||||
@@ -27,6 +27,9 @@ from services.market_intel.mcp_deploy_preflight import build_mcp_deploy_prefligh
|
||||
from services.market_intel.mcp_fetch_gate import build_mcp_fetch_gate_preview
|
||||
from services.market_intel.mcp_readiness import build_mcp_readiness_plan
|
||||
from services.market_intel.migration_blueprint import build_migration_blueprint
|
||||
from services.market_intel.opportunity_evidence import (
|
||||
build_opportunity_evidence_plan_preview,
|
||||
)
|
||||
from services.market_intel.opportunity_plan import build_opportunity_plan_preview
|
||||
from services.market_intel.opportunity_scoring import (
|
||||
build_opportunity_scoring_plan_preview,
|
||||
@@ -74,7 +77,7 @@ class MarketIntelRuntimeStatus:
|
||||
class MarketIntelService:
|
||||
"""市場情報入口服務,先集中 feature gate 與安全狀態。"""
|
||||
|
||||
phase = "phase_36_opportunity_scoring_plan_preview"
|
||||
phase = "phase_37_opportunity_evidence_plan_preview"
|
||||
|
||||
def get_runtime_status(self) -> MarketIntelRuntimeStatus:
|
||||
return MarketIntelRuntimeStatus(
|
||||
@@ -422,6 +425,20 @@ class MarketIntelService:
|
||||
plan["phase"] = self.phase
|
||||
return plan
|
||||
|
||||
def build_opportunity_evidence_plan(self):
|
||||
"""回報機會與威脅 evidence bundle 計畫;不查詢、不造樣本。"""
|
||||
schema_smoke = self.build_schema_smoke()
|
||||
plan = build_opportunity_evidence_plan_preview(
|
||||
runtime_status=self.get_runtime_status(),
|
||||
opportunity_plan=self.build_opportunity_plan(),
|
||||
scoring_plan=self.build_opportunity_scoring_plan(),
|
||||
match_review_plan=self.build_match_review_plan(),
|
||||
legacy_source_bridge=self.build_legacy_source_bridge(),
|
||||
schema_smoke=schema_smoke,
|
||||
)
|
||||
plan["phase"] = self.phase
|
||||
return plan
|
||||
|
||||
def build_platform_seed_writer_plan(self, platform_code="all"):
|
||||
"""建立 platform seed writer dry-run plan,不建立 DB session。"""
|
||||
seed_plan = self.build_platform_seed_plan(platform_code=platform_code)
|
||||
@@ -505,6 +522,7 @@ class MarketIntelService:
|
||||
match_review_plan = self.build_match_review_plan()
|
||||
opportunity_plan = self.build_opportunity_plan()
|
||||
opportunity_scoring_plan = self.build_opportunity_scoring_plan()
|
||||
opportunity_evidence_plan = self.build_opportunity_evidence_plan()
|
||||
checks = {
|
||||
"schema_smoke_passed": bool(schema_smoke["passed"]),
|
||||
"feature_flags_default_safe": bool(
|
||||
@@ -574,6 +592,13 @@ class MarketIntelService:
|
||||
and not opportunity_scoring_plan["score_calculation_executed"]
|
||||
and not opportunity_scoring_plan["database_write_executed"]
|
||||
),
|
||||
"opportunity_evidence_plan_preview_safe": bool(
|
||||
opportunity_evidence_plan["mode"]
|
||||
== "opportunity_evidence_plan_preview"
|
||||
and not opportunity_evidence_plan["evidence_query_executed"]
|
||||
and not opportunity_evidence_plan["evidence_bundle_created"]
|
||||
and not opportunity_evidence_plan["database_write_executed"]
|
||||
),
|
||||
}
|
||||
ready_for_production_deploy = all(checks.values())
|
||||
blocked_reasons = [
|
||||
@@ -706,6 +731,7 @@ class MarketIntelService:
|
||||
"/api/market_intel/match_review_plan",
|
||||
"/api/market_intel/opportunity_plan",
|
||||
"/api/market_intel/opportunity_scoring_plan",
|
||||
"/api/market_intel/opportunity_evidence_plan",
|
||||
],
|
||||
"status": status.to_dict(),
|
||||
"schema_smoke": schema_smoke,
|
||||
@@ -729,4 +755,5 @@ class MarketIntelService:
|
||||
"match_review_plan": match_review_plan,
|
||||
"opportunity_plan": opportunity_plan,
|
||||
"opportunity_scoring_plan": opportunity_scoring_plan,
|
||||
"opportunity_evidence_plan": opportunity_evidence_plan,
|
||||
}
|
||||
|
||||
@@ -558,6 +558,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="market-intel-panel" data-market-intel-opportunity-evidence>
|
||||
<div class="market-intel-preview-head">
|
||||
<div>
|
||||
<p class="market-intel-muted momo-mono mb-1">OPPORTUNITY / EVIDENCE BUNDLE</p>
|
||||
<h2 class="market-intel-preview-title">機會威脅證據包</h2>
|
||||
</div>
|
||||
<button class="market-intel-icon-button" type="button" title="重新整理機會威脅證據包" data-market-intel-opportunity-evidence-refresh>
|
||||
<i class="fas fa-rotate-right" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="market-intel-preview-meta" data-market-intel-opportunity-evidence-meta>
|
||||
<span class="market-intel-pill">loading</span>
|
||||
</div>
|
||||
<div data-market-intel-opportunity-evidence-body>
|
||||
<div class="market-intel-empty">讀取機會威脅證據包中...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="market-intel-panel" data-market-intel-migration>
|
||||
<div class="market-intel-preview-head">
|
||||
<div>
|
||||
@@ -631,10 +649,11 @@
|
||||
const matchReviewRoot = document.querySelector('[data-market-intel-match-review]');
|
||||
const opportunityRoot = document.querySelector('[data-market-intel-opportunity]');
|
||||
const opportunityScoringRoot = document.querySelector('[data-market-intel-opportunity-scoring]');
|
||||
const opportunityEvidenceRoot = document.querySelector('[data-market-intel-opportunity-evidence]');
|
||||
const migrationRoot = document.querySelector('[data-market-intel-migration]');
|
||||
const approvalRoot = document.querySelector('[data-market-intel-approval]');
|
||||
const deployRoot = document.querySelector('[data-market-intel-deploy]');
|
||||
if (!root && !writerRoot && !cliRoot && !dbProbeRoot && !seedDiffRoot && !legacyBridgeRoot && !mcpReadinessRoot && !mcpPreflightRoot && !mcpActivationRoot && !mcpFetchGateRoot && !schedulerRoot && !matchReviewRoot && !opportunityRoot && !opportunityScoringRoot && !migrationRoot && !approvalRoot && !deployRoot) return;
|
||||
if (!root && !writerRoot && !cliRoot && !dbProbeRoot && !seedDiffRoot && !legacyBridgeRoot && !mcpReadinessRoot && !mcpPreflightRoot && !mcpActivationRoot && !mcpFetchGateRoot && !schedulerRoot && !matchReviewRoot && !opportunityRoot && !opportunityScoringRoot && !opportunityEvidenceRoot && !migrationRoot && !approvalRoot && !deployRoot) return;
|
||||
|
||||
const meta = root ? root.querySelector('[data-market-intel-preview-meta]') : null;
|
||||
const body = root ? root.querySelector('[data-market-intel-preview-body]') : null;
|
||||
@@ -692,6 +711,10 @@
|
||||
const opportunityScoringBody = opportunityScoringRoot ? opportunityScoringRoot.querySelector('[data-market-intel-opportunity-scoring-body]') : null;
|
||||
const opportunityScoringRefresh = opportunityScoringRoot ? opportunityScoringRoot.querySelector('[data-market-intel-opportunity-scoring-refresh]') : null;
|
||||
const opportunityScoringEndpoint = "{{ url_for('market_intel.market_intel_opportunity_scoring_plan') }}";
|
||||
const opportunityEvidenceMeta = opportunityEvidenceRoot ? opportunityEvidenceRoot.querySelector('[data-market-intel-opportunity-evidence-meta]') : null;
|
||||
const opportunityEvidenceBody = opportunityEvidenceRoot ? opportunityEvidenceRoot.querySelector('[data-market-intel-opportunity-evidence-body]') : null;
|
||||
const opportunityEvidenceRefresh = opportunityEvidenceRoot ? opportunityEvidenceRoot.querySelector('[data-market-intel-opportunity-evidence-refresh]') : null;
|
||||
const opportunityEvidenceEndpoint = "{{ url_for('market_intel.market_intel_opportunity_evidence_plan') }}";
|
||||
const migrationMeta = migrationRoot ? migrationRoot.querySelector('[data-market-intel-migration-meta]') : null;
|
||||
const migrationBody = migrationRoot ? migrationRoot.querySelector('[data-market-intel-migration-body]') : null;
|
||||
const migrationRefresh = migrationRoot ? migrationRoot.querySelector('[data-market-intel-migration-refresh]') : null;
|
||||
@@ -1815,6 +1838,126 @@
|
||||
}
|
||||
};
|
||||
|
||||
const renderOpportunityEvidenceMeta = data => {
|
||||
opportunityEvidenceMeta.innerHTML = [
|
||||
`mode=${data.mode || 'unknown'}`,
|
||||
`ready=${data.ready_for_evidence_bundle ? 'yes' : 'no'}`,
|
||||
`sections=${data.section_count || 0}`,
|
||||
`query=${data.evidence_query_executed ? 'yes' : 'no'}`,
|
||||
`bundle=${data.evidence_bundle_created ? 'created' : 'blocked'}`
|
||||
].map(item => `<span class="market-intel-pill">${escapeHtml(item)}</span>`).join('');
|
||||
};
|
||||
|
||||
const renderOpportunityEvidenceBody = data => {
|
||||
const blockers = (data.blocked_reasons || []).join(' / ');
|
||||
const checks = Object.entries(data.gate_checks || {});
|
||||
const sections = data.sections || [];
|
||||
const gates = data.escalation_gates || [];
|
||||
const tables = data.required_market_tables || [];
|
||||
const sequence = data.operator_sequence || [];
|
||||
const contract = data.bundle_contract || {};
|
||||
const renderCheck = ([name, passed]) => `
|
||||
<div class="market-intel-check">
|
||||
<div>
|
||||
<strong>${escapeHtml(name)}</strong>
|
||||
</div>
|
||||
<span>${passed ? 'PASS' : 'BLOCK'}</span>
|
||||
</div>
|
||||
`;
|
||||
const renderSection = item => `
|
||||
<article class="market-intel-operation">
|
||||
<strong>${escapeHtml(item.key)}</strong>
|
||||
<small>${escapeHtml(item.label)}</small>
|
||||
<small>${escapeHtml((item.source_tables || []).join(' + '))}</small>
|
||||
<small>${escapeHtml((item.required_fields || []).join(' / '))}</small>
|
||||
</article>
|
||||
`;
|
||||
opportunityEvidenceBody.innerHTML = `
|
||||
<div class="market-intel-empty mb-3">目前只定義 evidence bundle contract;不查 DB、不產生 sample evidence、不建立 alert candidate、不派送 Telegram、不產生 AI 摘要。${blockers ? `阻擋:${escapeHtml(blockers)}` : ''}</div>
|
||||
<div class="market-intel-empty mb-3">dedupe=${escapeHtml(contract.dedupe_key || '')} / freshness=${escapeHtml(contract.freshness_window_hours || 'n/a')}h</div>
|
||||
<div class="market-intel-deploy-grid">
|
||||
<div data-market-intel-opportunity-evidence-checks>
|
||||
<p class="market-intel-deploy-section-title">EVIDENCE GATES</p>
|
||||
<div class="market-intel-check-list">${
|
||||
checks.length
|
||||
? checks.map(renderCheck).join('')
|
||||
: '<div class="market-intel-empty">尚未提供 evidence gate。</div>'
|
||||
}</div>
|
||||
</div>
|
||||
<div data-market-intel-opportunity-evidence-sections>
|
||||
<p class="market-intel-deploy-section-title">BUNDLE SECTIONS</p>
|
||||
<div class="market-intel-operation-list">${
|
||||
sections.length
|
||||
? sections.map(renderSection).join('')
|
||||
: '<div class="market-intel-empty">尚未提供 evidence section。</div>'
|
||||
}</div>
|
||||
</div>
|
||||
<div data-market-intel-opportunity-evidence-escalation>
|
||||
<p class="market-intel-deploy-section-title">ESCALATION GATES</p>
|
||||
<div class="market-intel-check-list">${
|
||||
gates.length
|
||||
? gates.map(item => `
|
||||
<div class="market-intel-check">
|
||||
<div>
|
||||
<strong>${escapeHtml(item.key)}</strong>
|
||||
<small>${escapeHtml(item.label)}</small>
|
||||
</div>
|
||||
<span>${escapeHtml((item.required_for || []).join('/'))}</span>
|
||||
</div>
|
||||
`).join('')
|
||||
: '<div class="market-intel-empty">尚未提供升級 gate。</div>'
|
||||
}</div>
|
||||
</div>
|
||||
<div data-market-intel-opportunity-evidence-tables>
|
||||
<p class="market-intel-deploy-section-title">REQUIRED TABLES</p>
|
||||
<div class="market-intel-check-list">${
|
||||
tables.length
|
||||
? tables.map(item => `
|
||||
<div class="market-intel-check">
|
||||
<div>
|
||||
<strong>${escapeHtml(item)}</strong>
|
||||
</div>
|
||||
<span>REQUIRED</span>
|
||||
</div>
|
||||
`).join('')
|
||||
: '<div class="market-intel-empty">尚未提供 required tables。</div>'
|
||||
}</div>
|
||||
</div>
|
||||
<div data-market-intel-opportunity-evidence-sequence>
|
||||
<p class="market-intel-deploy-section-title">OPERATOR SEQUENCE</p>
|
||||
<div class="market-intel-check-list">${
|
||||
sequence.length
|
||||
? sequence.map((item, index) => `
|
||||
<div class="market-intel-check">
|
||||
<div>
|
||||
<strong>${escapeHtml(`step_${index + 1}`)}</strong>
|
||||
<small>${escapeHtml(item)}</small>
|
||||
</div>
|
||||
<span>REQUIRED</span>
|
||||
</div>
|
||||
`).join('')
|
||||
: '<div class="market-intel-empty">尚未提供操作順序。</div>'
|
||||
}</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
};
|
||||
|
||||
const loadOpportunityEvidence = async () => {
|
||||
if (!opportunityEvidenceMeta || !opportunityEvidenceBody) return;
|
||||
opportunityEvidenceBody.innerHTML = '<div class="market-intel-empty">讀取機會威脅證據包中...</div>';
|
||||
try {
|
||||
const response = await fetch(opportunityEvidenceEndpoint, { credentials: 'same-origin' });
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
const data = await response.json();
|
||||
renderOpportunityEvidenceMeta(data);
|
||||
renderOpportunityEvidenceBody(data);
|
||||
} catch (error) {
|
||||
opportunityEvidenceMeta.innerHTML = '<span class="market-intel-pill">error</span>';
|
||||
opportunityEvidenceBody.innerHTML = `<div class="market-intel-empty">機會威脅證據包讀取失敗:${escapeHtml(error.message)}</div>`;
|
||||
}
|
||||
};
|
||||
|
||||
const renderMigrationMeta = data => {
|
||||
const seedWriter = data.command_plan && data.command_plan.seed_writer_command
|
||||
? data.command_plan.seed_writer_command
|
||||
@@ -2091,6 +2234,9 @@
|
||||
if (opportunityScoringRefresh) {
|
||||
opportunityScoringRefresh.addEventListener('click', loadOpportunityScoring);
|
||||
}
|
||||
if (opportunityEvidenceRefresh) {
|
||||
opportunityEvidenceRefresh.addEventListener('click', loadOpportunityEvidence);
|
||||
}
|
||||
if (migrationRefresh) {
|
||||
migrationRefresh.addEventListener('click', loadMigration);
|
||||
}
|
||||
@@ -2114,6 +2260,7 @@
|
||||
loadMatchReview();
|
||||
loadOpportunity();
|
||||
loadOpportunityScoring();
|
||||
loadOpportunityEvidence();
|
||||
loadMigration();
|
||||
loadApproval();
|
||||
loadDeploy();
|
||||
|
||||
@@ -464,6 +464,12 @@ def test_market_intel_preview_template_uses_safe_fetch_false_endpoint():
|
||||
assert "data-market-intel-opportunity-scoring-thresholds" in template
|
||||
assert "data-market-intel-opportunity-scoring-evidence" in template
|
||||
assert "data-market-intel-opportunity-scoring-sequence" in template
|
||||
assert "data-market-intel-opportunity-evidence" in template
|
||||
assert "data-market-intel-opportunity-evidence-checks" in template
|
||||
assert "data-market-intel-opportunity-evidence-sections" in template
|
||||
assert "data-market-intel-opportunity-evidence-escalation" in template
|
||||
assert "data-market-intel-opportunity-evidence-tables" in template
|
||||
assert "data-market-intel-opportunity-evidence-sequence" in template
|
||||
assert "data-market-intel-migration" in template
|
||||
assert "data-market-intel-migration-tables" in template
|
||||
assert "data-market-intel-approval" in template
|
||||
@@ -485,6 +491,7 @@ def test_market_intel_preview_template_uses_safe_fetch_false_endpoint():
|
||||
assert "market_intel.market_intel_match_review_plan" in template
|
||||
assert "market_intel.market_intel_opportunity_plan" in template
|
||||
assert "market_intel.market_intel_opportunity_scoring_plan" in template
|
||||
assert "market_intel.market_intel_opportunity_evidence_plan" in template
|
||||
assert "market_intel.market_intel_migration_blueprint" in template
|
||||
assert "market_intel.market_intel_write_approval_runbook" in template
|
||||
assert "market_intel.market_intel_deployment_readiness" in template
|
||||
@@ -510,7 +517,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_36_opportunity_scoring_plan_preview"
|
||||
assert bridge["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert bridge["execute_requested"] is False
|
||||
assert bridge["read_only_query_executed"] is False
|
||||
assert bridge["database_connection_opened"] is False
|
||||
@@ -668,7 +675,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_36_opportunity_scoring_plan_preview"
|
||||
assert contract["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert contract["caller"] == "market_intel"
|
||||
assert contract["contract_ready"] is True
|
||||
assert contract["blocked_reasons"] == []
|
||||
@@ -801,7 +808,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_36_opportunity_scoring_plan_preview"
|
||||
assert data["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert data["deployment_actions_executed"] is False
|
||||
assert data["docker_command_executed"] is False
|
||||
assert data["ssh_command_executed"] is False
|
||||
@@ -814,7 +821,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_36_opportunity_scoring_plan_preview"
|
||||
assert gate["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert gate["fetch_requested"] is True
|
||||
assert gate["manual_fetch_gate_open"] is False
|
||||
assert gate["network_request_allowed"] is False
|
||||
@@ -884,7 +891,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_36_opportunity_scoring_plan_preview"
|
||||
assert data["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert data["fetch_requested"] is False
|
||||
assert data["network_request_allowed"] is False
|
||||
assert data["external_network_executed"] is False
|
||||
@@ -896,7 +903,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_36_opportunity_scoring_plan_preview"
|
||||
assert plan["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert plan["ready_to_attach_scheduler"] is False
|
||||
assert plan["scheduler_attached"] is False
|
||||
assert plan["scheduler_registration_executed"] is False
|
||||
@@ -934,7 +941,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_36_opportunity_scoring_plan_preview"
|
||||
assert data["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert data["scheduler_registration_executed"] is False
|
||||
assert data["crawler_job_started"] is False
|
||||
assert data["external_network_executed"] is False
|
||||
@@ -945,7 +952,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_36_opportunity_scoring_plan_preview"
|
||||
assert plan["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert plan["ready_for_review_queue"] is False
|
||||
assert plan["review_queue_created"] is False
|
||||
assert plan["auto_match_executed"] is False
|
||||
@@ -981,7 +988,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_36_opportunity_scoring_plan_preview"
|
||||
assert data["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert data["review_queue_created"] is False
|
||||
assert data["auto_confirm_executed"] is False
|
||||
assert data["external_network_executed"] is False
|
||||
@@ -992,7 +999,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_36_opportunity_scoring_plan_preview"
|
||||
assert plan["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert plan["ready_for_opportunity_queue"] is False
|
||||
assert plan["opportunity_queue_created"] is False
|
||||
assert plan["threat_alert_dispatched"] is False
|
||||
@@ -1033,7 +1040,7 @@ def test_opportunity_plan_route_is_preview_only():
|
||||
|
||||
assert response.status_code == 200
|
||||
assert data["mode"] == "opportunity_plan_preview"
|
||||
assert data["phase"] == "phase_36_opportunity_scoring_plan_preview"
|
||||
assert data["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert data["opportunity_queue_created"] is False
|
||||
assert data["threat_alert_dispatched"] is False
|
||||
assert data["ai_summary_generated"] is False
|
||||
@@ -1044,7 +1051,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_36_opportunity_scoring_plan_preview"
|
||||
assert plan["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert plan["ready_for_scoring_job"] is False
|
||||
assert plan["scoring_job_created"] is False
|
||||
assert plan["score_calculation_executed"] is False
|
||||
@@ -1092,7 +1099,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_36_opportunity_scoring_plan_preview"
|
||||
assert data["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert data["scoring_job_created"] is False
|
||||
assert data["score_calculation_executed"] is False
|
||||
assert data["sample_scores_generated"] is False
|
||||
@@ -1100,6 +1107,65 @@ def test_opportunity_scoring_plan_route_is_preview_only():
|
||||
assert data["external_network_executed"] is False
|
||||
|
||||
|
||||
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_37_opportunity_evidence_plan_preview"
|
||||
assert plan["ready_for_evidence_bundle"] is False
|
||||
assert plan["evidence_bundle_created"] is False
|
||||
assert plan["evidence_query_executed"] is False
|
||||
assert plan["sample_evidence_generated"] is False
|
||||
assert plan["alert_candidate_created"] is False
|
||||
assert plan["telegram_dispatched"] is False
|
||||
assert plan["ai_summary_generated"] is False
|
||||
assert plan["database_session_created"] is False
|
||||
assert plan["database_write_executed"] is False
|
||||
assert plan["database_commit_executed"] is False
|
||||
assert plan["external_network_executed"] is False
|
||||
assert plan["scheduler_attached"] is False
|
||||
assert plan["writes_executed"] is False
|
||||
assert plan["would_write_database"] is False
|
||||
assert plan["section_count"] == 5
|
||||
assert {item["key"] for item in plan["sections"]} == {
|
||||
"campaign_context",
|
||||
"market_product_snapshot",
|
||||
"match_review_state",
|
||||
"momo_reference",
|
||||
"scoring_trace",
|
||||
}
|
||||
assert "confirmed_match_evidence_available" in plan["blocked_reasons"]
|
||||
assert "scoring_trace_available" in plan["blocked_reasons"]
|
||||
assert "manual_operator_approval" in plan["blocked_reasons"]
|
||||
assert "do_not_query_database_from_evidence_preview" in plan["safe_boundaries"]
|
||||
assert "do_not_generate_placeholder_evidence" in plan["safe_boundaries"]
|
||||
assert plan["bundle_contract"]["freshness_window_hours"] == 24
|
||||
|
||||
|
||||
def test_opportunity_evidence_plan_route_is_preview_only():
|
||||
from routes.market_intel_routes import market_intel_bp
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = "test-secret"
|
||||
app.register_blueprint(market_intel_bp)
|
||||
client = app.test_client()
|
||||
with client.session_transaction() as session:
|
||||
session["logged_in"] = True
|
||||
|
||||
response = client.get("/api/market_intel/opportunity_evidence_plan")
|
||||
data = response.get_json()
|
||||
|
||||
assert response.status_code == 200
|
||||
assert data["mode"] == "opportunity_evidence_plan_preview"
|
||||
assert data["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert data["evidence_bundle_created"] is False
|
||||
assert data["evidence_query_executed"] is False
|
||||
assert data["sample_evidence_generated"] is False
|
||||
assert data["alert_candidate_created"] is False
|
||||
assert data["database_write_executed"] is False
|
||||
assert data["external_network_executed"] is False
|
||||
|
||||
|
||||
def test_mcp_deploy_preflight_blocks_without_required_env():
|
||||
preflight = build_mcp_deploy_preflight_plan(env={})
|
||||
|
||||
@@ -1163,7 +1229,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_36_opportunity_scoring_plan_preview"
|
||||
assert data["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert data["deployment_actions_executed"] is False
|
||||
assert data["docker_command_executed"] is False
|
||||
assert data["ssh_command_executed"] is False
|
||||
@@ -1178,7 +1244,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_36_opportunity_scoring_plan_preview"
|
||||
assert readiness["phase"] == "phase_37_opportunity_evidence_plan_preview"
|
||||
assert readiness["execute_requested"] is False
|
||||
assert readiness["router_enabled"] is False
|
||||
assert readiness["external_mcp_complete"] is False
|
||||
@@ -1569,6 +1635,7 @@ def test_deployment_readiness_reports_app_only_release_gate():
|
||||
assert readiness["checks"]["match_review_plan_preview_safe"] is True
|
||||
assert readiness["checks"]["opportunity_plan_preview_safe"] is True
|
||||
assert readiness["checks"]["opportunity_scoring_plan_preview_safe"] is True
|
||||
assert readiness["checks"]["opportunity_evidence_plan_preview_safe"] is True
|
||||
assert readiness["checks"]["writer_plan_dry_run_only"] is True
|
||||
assert readiness["writer_plan_summary"]["writes_executed"] is False
|
||||
assert "readiness_checks_not_all_passed" not in readiness["blocked_reasons"]
|
||||
@@ -1593,6 +1660,7 @@ def test_deployment_readiness_reports_app_only_release_gate():
|
||||
assert "/api/market_intel/match_review_plan" in readiness["production_smoke_targets"]
|
||||
assert "/api/market_intel/opportunity_plan" in readiness["production_smoke_targets"]
|
||||
assert "/api/market_intel/opportunity_scoring_plan" in readiness["production_smoke_targets"]
|
||||
assert "/api/market_intel/opportunity_evidence_plan" in readiness["production_smoke_targets"]
|
||||
assert readiness["write_approval_runbook"]["ready_for_real_write"] is False
|
||||
assert readiness["write_approval_runbook"]["writes_executed"] is False
|
||||
assert readiness["migration_blueprint"]["migration_executed"] is False
|
||||
@@ -1623,6 +1691,9 @@ def test_deployment_readiness_reports_app_only_release_gate():
|
||||
assert readiness["opportunity_scoring_plan"]["scoring_job_created"] is False
|
||||
assert readiness["opportunity_scoring_plan"]["score_calculation_executed"] is False
|
||||
assert readiness["opportunity_scoring_plan"]["database_write_executed"] is False
|
||||
assert readiness["opportunity_evidence_plan"]["evidence_bundle_created"] is False
|
||||
assert readiness["opportunity_evidence_plan"]["evidence_query_executed"] is False
|
||||
assert readiness["opportunity_evidence_plan"]["database_write_executed"] is False
|
||||
|
||||
|
||||
def test_write_approval_runbook_is_read_only_and_blocks_real_write():
|
||||
|
||||
Reference in New Issue
Block a user