feat(smoke): monitor pchome controlled dry-run package
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
This commit is contained in:
@@ -107,10 +107,10 @@ def test_system_metrics_exports_scheduled_health_summary():
|
||||
Gauge,
|
||||
{
|
||||
"summary": {
|
||||
"ok": 22,
|
||||
"ok": 23,
|
||||
"warning": 1,
|
||||
"critical": 0,
|
||||
"total": 23,
|
||||
"total": 24,
|
||||
"primary_human_gate_count": 0,
|
||||
"writes_database_count": 0,
|
||||
},
|
||||
@@ -135,6 +135,7 @@ def test_system_metrics_exports_scheduled_health_summary():
|
||||
{"key": "pchome_auto_policy_authorization_evidence_execution_preflight", "status": "ok"},
|
||||
{"key": "pchome_auto_policy_authorization_evidence_execution_closeout", "status": "ok"},
|
||||
{"key": "pchome_auto_policy_controlled_apply_final_preflight", "status": "ok"},
|
||||
{"key": "pchome_auto_policy_controlled_dry_run_package", "status": "ok"},
|
||||
{"key": "sitewide_ui_ux_agent", "status": "ok"},
|
||||
{"key": "sitewide_visual_qa", "status": "ok"},
|
||||
],
|
||||
@@ -142,7 +143,7 @@ def test_system_metrics_exports_scheduled_health_summary():
|
||||
)
|
||||
|
||||
output = generate_latest(registry).decode("utf-8")
|
||||
assert 'momo_ai_automation_scheduled_health_summary_total{status="ok"} 22.0' in output
|
||||
assert 'momo_ai_automation_scheduled_health_summary_total{status="ok"} 23.0' in output
|
||||
assert 'momo_ai_automation_scheduled_health_summary_total{status="warning"} 1.0' in output
|
||||
assert (
|
||||
'momo_ai_automation_scheduled_health_family_status{family="ai_automation_smoke",status="ok"} 1.0'
|
||||
@@ -224,6 +225,10 @@ def test_system_metrics_exports_scheduled_health_summary():
|
||||
'momo_ai_automation_scheduled_health_family_status{family="pchome_auto_policy_controlled_apply_final_preflight",status="ok"} 1.0'
|
||||
in output
|
||||
)
|
||||
assert (
|
||||
'momo_ai_automation_scheduled_health_family_status{family="pchome_auto_policy_controlled_dry_run_package",status="ok"} 1.0'
|
||||
in output
|
||||
)
|
||||
assert (
|
||||
'momo_ai_automation_scheduled_health_family_status{family="sitewide_ui_ux_agent",status="ok"} 1.0'
|
||||
in output
|
||||
|
||||
@@ -1027,6 +1027,119 @@ def _auto_policy_controlled_apply_final_preflight_history_check(status="ok"):
|
||||
}
|
||||
|
||||
|
||||
def _auto_policy_controlled_dry_run_package_history_check(status="ok"):
|
||||
return {
|
||||
"name": "PChome auto-policy controlled dry-run package",
|
||||
"status": status,
|
||||
"summary": (
|
||||
"PChome auto-policy controlled dry-run package 已自動完成"
|
||||
),
|
||||
"details": {
|
||||
"policy": (
|
||||
"read_only_pchome_growth_auto_policy_db_apply_controlled_"
|
||||
"dry_run_package"
|
||||
),
|
||||
"result": "DB_APPLY_CONTROLLED_DRY_RUN_PACKAGE_READY",
|
||||
"controlled_dry_run_package_ready_count": 1,
|
||||
"controlled_dry_run_package_check_count": 12,
|
||||
"controlled_dry_run_package_pass_count": 12,
|
||||
"controlled_dry_run_package_waiting_count": 0,
|
||||
"controlled_apply_final_preflight_ready_count": 1,
|
||||
"controlled_apply_final_preflight_check_count": 12,
|
||||
"authorization_evidence_execution_closeout_ready_count": 1,
|
||||
"authorization_evidence_execution_closeout_check_count": 12,
|
||||
"authorization_evidence_execution_preflight_ready_count": 1,
|
||||
"authorization_evidence_execution_preflight_check_count": 12,
|
||||
"authorization_verifier_receipt_closeout_ready_count": 1,
|
||||
"verifier_receipt_closeout_check_count": 12,
|
||||
"database_apply_final_verifier_gate_count": 1,
|
||||
"database_apply_authorization_final_verifier_gate_ready_count": 1,
|
||||
"controlled_dry_run_package_count": 1,
|
||||
"controlled_dry_run_package_field_count": 12,
|
||||
"controlled_dry_run_acceptance_gate_count": 10,
|
||||
"dry_run_execution_receipt_preview_count": 1,
|
||||
"dry_run_execution_receipt_field_count": 8,
|
||||
"dry_run_result_parser_count": 1,
|
||||
"dry_run_result_parser_field_count": 10,
|
||||
"controlled_apply_final_preflight_count": 1,
|
||||
"controlled_apply_final_preflight_field_count": 12,
|
||||
"controlled_apply_final_preflight_acceptance_gate_count": 10,
|
||||
"rollback_binding_count": 1,
|
||||
"rollback_binding_field_count": 8,
|
||||
"post_apply_verifier_binding_count": 1,
|
||||
"post_apply_verifier_binding_field_count": 8,
|
||||
"post_apply_verifier_required_count": 1,
|
||||
"same_run_truth_required_count": 1,
|
||||
"writes_script_count": 0,
|
||||
"writes_artifact_count": 0,
|
||||
"reads_secret_count": 0,
|
||||
"executes_script_count": 0,
|
||||
"executes_migration_count": 0,
|
||||
"executes_endpoint_count": 0,
|
||||
"executes_sql_count": 0,
|
||||
"writes_database_count": 0,
|
||||
"signs_database_apply_authorization_count": 0,
|
||||
"primary_human_gate_count": 0,
|
||||
"manual_review_required_count": 0,
|
||||
"manual_review_mode": "exception_only",
|
||||
"payload_source": "local_contract_fixture",
|
||||
"execute_fetch": True,
|
||||
"outbound_network": False,
|
||||
"business_data_source": False,
|
||||
"ready_for_future_database_apply_controlled_dry_run_execution_receipt": True,
|
||||
"can_enter_future_database_apply_controlled_dry_run_receipt_closeout": True,
|
||||
"controlled_dry_run_package_ready": True,
|
||||
"dry_run_execution_performed": False,
|
||||
"ready_for_future_database_apply_controlled_dry_run_package": True,
|
||||
"target_migration_hash_locked": True,
|
||||
"dry_run_only": True,
|
||||
"check_mode_only": True,
|
||||
"requires_fresh_production_truth": True,
|
||||
"requires_post_apply_verifier": True,
|
||||
"command_shape_dry_run_only": True,
|
||||
"command_shape_check_mode_only": True,
|
||||
"command_shape_execution_allowed": False,
|
||||
"command_shape_shell_command_included": False,
|
||||
"command_shape_sql_included": False,
|
||||
"command_shape_endpoint_execution_included": False,
|
||||
"command_shape_database_write_included": False,
|
||||
"receipt_dry_run_status": "preview_only_not_executed",
|
||||
"receipt_execution_performed": False,
|
||||
"receipt_stdout_included": False,
|
||||
"receipt_stderr_included": False,
|
||||
"receipt_database_apply_authorized": False,
|
||||
"receipt_executes_shell": False,
|
||||
"receipt_executes_endpoint": False,
|
||||
"receipt_executes_sql": False,
|
||||
"receipt_writes_database": False,
|
||||
"receipt_reads_secret": False,
|
||||
"parser_expected_receipt_status": "preview_only_not_executed",
|
||||
"parser_execution_required": False,
|
||||
"parser_stdout_allowed": False,
|
||||
"parser_stderr_allowed": False,
|
||||
"parser_database_apply_authorized": False,
|
||||
"parser_verification_status": "schema_preview_ready",
|
||||
"permits_future_database_apply_controlled_dry_run_execution_receipt": True,
|
||||
"accepts_plaintext_secret": False,
|
||||
"reads_secret_in_preview": False,
|
||||
"signature_material_included": False,
|
||||
"secret_material_included": False,
|
||||
"secret_material_required_in_preview": False,
|
||||
"executes_authorization_evidence": False,
|
||||
"executes_database_apply": False,
|
||||
"executes_endpoint": False,
|
||||
"executes_sql": False,
|
||||
"ready_for_database_apply_now": False,
|
||||
"database_apply_authorized": False,
|
||||
"issues_database_apply_authorization": False,
|
||||
"signs_database_apply_authorization": False,
|
||||
"next_machine_action": (
|
||||
"continue_to_pchome_auto_policy_controlled_dry_run_receipt_closeout_lane"
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_event_router_smoke_reports_queued_deliveries(tmp_path, monkeypatch):
|
||||
from services import ai_automation_metrics as metrics
|
||||
from services import ai_automation_smoke_service as smoke
|
||||
@@ -1080,6 +1193,7 @@ def test_collect_ai_automation_smoke_uses_worst_status(monkeypatch):
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_authorization_evidence_execution_preflight_check", lambda: smoke._check("auto-policy authorization evidence execution preflight", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_authorization_evidence_execution_closeout_check", lambda: smoke._check("auto-policy authorization evidence execution closeout", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_controlled_apply_final_preflight_check", lambda: smoke._check("auto-policy controlled apply final preflight", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_controlled_dry_run_package_check", lambda: smoke._check("auto-policy controlled dry-run package", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_ai_surface_html_readback_check", lambda: smoke._check("surface", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_sitewide_ui_ux_agent_check", lambda: smoke._check("sitewide", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_sitewide_visual_qa_check", lambda: smoke._check("visual", "ok", "ok"))
|
||||
@@ -1087,7 +1201,7 @@ def test_collect_ai_automation_smoke_uses_worst_status(monkeypatch):
|
||||
result = smoke.collect_ai_automation_smoke(record_history=False)
|
||||
|
||||
assert result["status"] == "critical"
|
||||
assert result["summary"] == {"ok": 26, "warning": 1, "critical": 1, "total": 28}
|
||||
assert result["summary"] == {"ok": 27, "warning": 1, "critical": 1, "total": 29}
|
||||
|
||||
|
||||
def test_pchome_controlled_apply_drift_monitor_reports_verified_zero_drift(monkeypatch):
|
||||
@@ -3353,6 +3467,115 @@ def test_pchome_auto_policy_controlled_apply_final_preflight_reports_bindings_no
|
||||
)
|
||||
|
||||
|
||||
def test_pchome_auto_policy_controlled_dry_run_package_reports_preview_no_execution():
|
||||
from services import ai_automation_smoke_service as smoke
|
||||
|
||||
result = smoke._pchome_auto_policy_controlled_dry_run_package_check()
|
||||
|
||||
assert result["status"] == "ok"
|
||||
assert result["details"]["result"] == "DB_APPLY_CONTROLLED_DRY_RUN_PACKAGE_READY"
|
||||
assert result["details"]["controlled_dry_run_package_pass_count"] == 12
|
||||
assert result["details"]["controlled_dry_run_package_check_count"] == 12
|
||||
assert result["details"]["controlled_dry_run_package_waiting_count"] == 0
|
||||
assert result["details"]["controlled_apply_final_preflight_ready_count"] == 1
|
||||
assert result["details"]["controlled_apply_final_preflight_check_count"] == 12
|
||||
assert result["details"]["controlled_dry_run_package_count"] == 1
|
||||
assert result["details"]["controlled_dry_run_package_field_count"] == 12
|
||||
assert result["details"]["controlled_dry_run_acceptance_gate_count"] == 10
|
||||
assert result["details"]["dry_run_execution_receipt_preview_count"] == 1
|
||||
assert result["details"]["dry_run_execution_receipt_field_count"] == 8
|
||||
assert result["details"]["dry_run_result_parser_count"] == 1
|
||||
assert result["details"]["dry_run_result_parser_field_count"] == 10
|
||||
assert result["details"]["rollback_binding_count"] == 1
|
||||
assert result["details"]["post_apply_verifier_binding_count"] == 1
|
||||
assert result["details"]["post_apply_verifier_required_count"] == 1
|
||||
assert result["details"]["same_run_truth_required_count"] == 1
|
||||
assert result["details"]["payload_source"] == "local_contract_fixture"
|
||||
assert result["details"]["machine_fetch_evidence_source"] == "local_schema_fixture"
|
||||
assert result["details"]["outbound_network"] is False
|
||||
assert result["details"]["business_data_source"] is False
|
||||
assert result["details"]["primary_human_gate_count"] == 0
|
||||
assert result["details"]["manual_review_required_count"] == 0
|
||||
assert result["details"]["reads_secret_count"] == 0
|
||||
assert result["details"]["executes_script_count"] == 0
|
||||
assert result["details"]["executes_endpoint_count"] == 0
|
||||
assert result["details"]["executes_sql_count"] == 0
|
||||
assert result["details"]["writes_database_count"] == 0
|
||||
assert result["details"]["signs_database_apply_authorization_count"] == 0
|
||||
assert (
|
||||
result["details"][
|
||||
"ready_for_future_database_apply_controlled_dry_run_execution_receipt"
|
||||
]
|
||||
is True
|
||||
)
|
||||
assert (
|
||||
result["details"][
|
||||
"can_enter_future_database_apply_controlled_dry_run_receipt_closeout"
|
||||
]
|
||||
is True
|
||||
)
|
||||
assert result["details"]["controlled_dry_run_package_ready"] is True
|
||||
assert result["details"]["dry_run_execution_performed"] is False
|
||||
assert (
|
||||
result["details"][
|
||||
"ready_for_future_database_apply_controlled_dry_run_package"
|
||||
]
|
||||
is True
|
||||
)
|
||||
assert result["details"]["target_migration_hash_locked"] is True
|
||||
assert result["details"]["dry_run_only"] is True
|
||||
assert result["details"]["check_mode_only"] is True
|
||||
assert result["details"]["requires_fresh_production_truth"] is True
|
||||
assert result["details"]["requires_post_apply_verifier"] is True
|
||||
assert result["details"]["command_shape_dry_run_only"] is True
|
||||
assert result["details"]["command_shape_check_mode_only"] is True
|
||||
assert result["details"]["command_shape_execution_allowed"] is False
|
||||
assert result["details"]["command_shape_shell_command_included"] is False
|
||||
assert result["details"]["command_shape_sql_included"] is False
|
||||
assert result["details"]["command_shape_endpoint_execution_included"] is False
|
||||
assert result["details"]["command_shape_database_write_included"] is False
|
||||
assert result["details"]["receipt_dry_run_status"] == "preview_only_not_executed"
|
||||
assert result["details"]["receipt_execution_performed"] is False
|
||||
assert result["details"]["receipt_stdout_included"] is False
|
||||
assert result["details"]["receipt_stderr_included"] is False
|
||||
assert result["details"]["receipt_database_apply_authorized"] is False
|
||||
assert result["details"]["receipt_executes_shell"] is False
|
||||
assert result["details"]["receipt_executes_endpoint"] is False
|
||||
assert result["details"]["receipt_executes_sql"] is False
|
||||
assert result["details"]["receipt_writes_database"] is False
|
||||
assert result["details"]["receipt_reads_secret"] is False
|
||||
assert result["details"]["parser_expected_receipt_status"] == (
|
||||
"preview_only_not_executed"
|
||||
)
|
||||
assert result["details"]["parser_execution_required"] is False
|
||||
assert result["details"]["parser_stdout_allowed"] is False
|
||||
assert result["details"]["parser_stderr_allowed"] is False
|
||||
assert result["details"]["parser_database_apply_authorized"] is False
|
||||
assert result["details"]["parser_verification_status"] == "schema_preview_ready"
|
||||
assert (
|
||||
result["details"][
|
||||
"permits_future_database_apply_controlled_dry_run_execution_receipt"
|
||||
]
|
||||
is True
|
||||
)
|
||||
assert result["details"]["accepts_plaintext_secret"] is False
|
||||
assert result["details"]["reads_secret_in_preview"] is False
|
||||
assert result["details"]["signature_material_included"] is False
|
||||
assert result["details"]["secret_material_included"] is False
|
||||
assert result["details"]["secret_material_required_in_preview"] is False
|
||||
assert result["details"]["executes_authorization_evidence"] is False
|
||||
assert result["details"]["executes_database_apply"] is False
|
||||
assert result["details"]["executes_endpoint"] is False
|
||||
assert result["details"]["executes_sql"] is False
|
||||
assert result["details"]["ready_for_database_apply_now"] is False
|
||||
assert result["details"]["database_apply_authorized"] is False
|
||||
assert result["details"]["issues_database_apply_authorization"] is False
|
||||
assert result["details"]["signs_database_apply_authorization"] is False
|
||||
assert result["details"]["next_machine_action"] == (
|
||||
"continue_to_pchome_auto_policy_controlled_dry_run_receipt_closeout_lane"
|
||||
)
|
||||
|
||||
|
||||
def test_collect_ai_automation_smoke_persists_recent_history(tmp_path, monkeypatch):
|
||||
from services import ai_automation_smoke_service as smoke
|
||||
|
||||
@@ -3384,6 +3607,7 @@ def test_collect_ai_automation_smoke_persists_recent_history(tmp_path, monkeypat
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_authorization_evidence_execution_preflight_check", lambda: smoke._check("auto-policy authorization evidence execution preflight", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_authorization_evidence_execution_closeout_check", lambda: smoke._check("auto-policy authorization evidence execution closeout", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_controlled_apply_final_preflight_check", lambda: smoke._check("auto-policy controlled apply final preflight", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_controlled_dry_run_package_check", lambda: smoke._check("auto-policy controlled dry-run package", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_ai_surface_html_readback_check", lambda: smoke._check("surface", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_sitewide_ui_ux_agent_check", lambda: smoke._check("sitewide", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_sitewide_visual_qa_check", lambda: smoke._check("visual", "ok", "ok"))
|
||||
@@ -3442,7 +3666,7 @@ def test_scheduled_automation_health_summary_reads_history_without_side_effects(
|
||||
json.dumps({
|
||||
"generated_at": datetime.now().isoformat(timespec="seconds"),
|
||||
"status": "ok",
|
||||
"summary": {"ok": 28, "warning": 0, "critical": 0, "total": 28},
|
||||
"summary": {"ok": 29, "warning": 0, "critical": 0, "total": 29},
|
||||
"checks": [
|
||||
{
|
||||
"name": "PChome 受控落地 drift monitor",
|
||||
@@ -3474,6 +3698,7 @@ def test_scheduled_automation_health_summary_reads_history_without_side_effects(
|
||||
_auto_policy_authorization_evidence_execution_preflight_history_check(),
|
||||
_auto_policy_authorization_evidence_execution_closeout_history_check(),
|
||||
_auto_policy_controlled_apply_final_preflight_history_check(),
|
||||
_auto_policy_controlled_dry_run_package_history_check(),
|
||||
{
|
||||
"name": "AI surface HTML readback",
|
||||
"status": "ok",
|
||||
@@ -3535,7 +3760,7 @@ def test_scheduled_automation_health_summary_reads_history_without_side_effects(
|
||||
)
|
||||
assert summary["policy"] == "read_only_ai_automation_scheduled_health_summary"
|
||||
assert summary["status"] == "ok"
|
||||
assert summary["summary"]["total"] == 25
|
||||
assert summary["summary"]["total"] == 26
|
||||
assert summary["summary"]["primary_human_gate_count"] == 0
|
||||
assert summary["summary"]["writes_database_count"] == 0
|
||||
assert pchome_family["status"] == "ok"
|
||||
@@ -5048,6 +5273,75 @@ def test_scheduled_automation_health_summary_reads_history_without_side_effects(
|
||||
controlled_final_preflight_family["details"]["database_apply_authorized"]
|
||||
is False
|
||||
)
|
||||
controlled_dry_run_family = next(
|
||||
item for item in summary["families"]
|
||||
if item["key"] == "pchome_auto_policy_controlled_dry_run_package"
|
||||
)
|
||||
assert controlled_dry_run_family["status"] == "ok"
|
||||
assert controlled_dry_run_family["next_machine_action"] == (
|
||||
"continue_to_pchome_auto_policy_controlled_dry_run_receipt_closeout_lane"
|
||||
)
|
||||
assert controlled_dry_run_family["details"]["next_machine_action"] == (
|
||||
"continue_to_pchome_auto_policy_controlled_dry_run_receipt_closeout_lane"
|
||||
)
|
||||
assert controlled_dry_run_family["details"]["controlled_dry_run_package_pass_count"] == 12
|
||||
assert controlled_dry_run_family["details"]["controlled_dry_run_package_check_count"] == 12
|
||||
assert controlled_dry_run_family["details"]["controlled_dry_run_package_field_count"] == 12
|
||||
assert controlled_dry_run_family["details"]["controlled_dry_run_acceptance_gate_count"] == 10
|
||||
assert controlled_dry_run_family["details"]["dry_run_execution_receipt_preview_count"] == 1
|
||||
assert controlled_dry_run_family["details"]["dry_run_execution_receipt_field_count"] == 8
|
||||
assert controlled_dry_run_family["details"]["dry_run_result_parser_count"] == 1
|
||||
assert controlled_dry_run_family["details"]["dry_run_result_parser_field_count"] == 10
|
||||
assert controlled_dry_run_family["details"]["rollback_binding_count"] == 1
|
||||
assert controlled_dry_run_family["details"]["post_apply_verifier_binding_count"] == 1
|
||||
assert controlled_dry_run_family["details"]["payload_source"] == "local_contract_fixture"
|
||||
assert controlled_dry_run_family["details"]["outbound_network"] is False
|
||||
assert controlled_dry_run_family["details"]["business_data_source"] is False
|
||||
assert controlled_dry_run_family["details"]["primary_human_gate_count"] == 0
|
||||
assert controlled_dry_run_family["details"]["reads_secret_count"] == 0
|
||||
assert controlled_dry_run_family["details"]["writes_database_count"] == 0
|
||||
assert controlled_dry_run_family["details"]["signs_database_apply_authorization_count"] == 0
|
||||
assert (
|
||||
controlled_dry_run_family["details"][
|
||||
"ready_for_future_database_apply_controlled_dry_run_execution_receipt"
|
||||
]
|
||||
is True
|
||||
)
|
||||
assert (
|
||||
controlled_dry_run_family["details"][
|
||||
"can_enter_future_database_apply_controlled_dry_run_receipt_closeout"
|
||||
]
|
||||
is True
|
||||
)
|
||||
assert controlled_dry_run_family["details"]["controlled_dry_run_package_ready"] is True
|
||||
assert controlled_dry_run_family["details"]["dry_run_execution_performed"] is False
|
||||
assert controlled_dry_run_family["details"]["target_migration_hash_locked"] is True
|
||||
assert controlled_dry_run_family["details"]["dry_run_only"] is True
|
||||
assert controlled_dry_run_family["details"]["check_mode_only"] is True
|
||||
assert controlled_dry_run_family["details"]["command_shape_execution_allowed"] is False
|
||||
assert controlled_dry_run_family["details"]["command_shape_shell_command_included"] is False
|
||||
assert controlled_dry_run_family["details"]["command_shape_sql_included"] is False
|
||||
assert controlled_dry_run_family["details"]["receipt_dry_run_status"] == "preview_only_not_executed"
|
||||
assert controlled_dry_run_family["details"]["receipt_execution_performed"] is False
|
||||
assert controlled_dry_run_family["details"]["receipt_stdout_included"] is False
|
||||
assert controlled_dry_run_family["details"]["receipt_stderr_included"] is False
|
||||
assert controlled_dry_run_family["details"]["receipt_database_apply_authorized"] is False
|
||||
assert controlled_dry_run_family["details"]["parser_execution_required"] is False
|
||||
assert controlled_dry_run_family["details"]["parser_verification_status"] == "schema_preview_ready"
|
||||
assert (
|
||||
controlled_dry_run_family["details"][
|
||||
"permits_future_database_apply_controlled_dry_run_execution_receipt"
|
||||
]
|
||||
is True
|
||||
)
|
||||
assert controlled_dry_run_family["details"]["accepts_plaintext_secret"] is False
|
||||
assert controlled_dry_run_family["details"]["reads_secret_in_preview"] is False
|
||||
assert controlled_dry_run_family["details"]["executes_authorization_evidence"] is False
|
||||
assert controlled_dry_run_family["details"]["executes_database_apply"] is False
|
||||
assert controlled_dry_run_family["details"]["executes_endpoint"] is False
|
||||
assert controlled_dry_run_family["details"]["executes_sql"] is False
|
||||
assert controlled_dry_run_family["details"]["ready_for_database_apply_now"] is False
|
||||
assert controlled_dry_run_family["details"]["database_apply_authorized"] is False
|
||||
surface_family = next(
|
||||
item for item in summary["families"]
|
||||
if item["key"] == "ai_surface_html_readback"
|
||||
@@ -5082,7 +5376,7 @@ def test_scheduled_automation_health_summary_can_use_current_smoke_without_recor
|
||||
current_smoke = {
|
||||
"generated_at": "2026-07-02T12:00:00",
|
||||
"status": "critical",
|
||||
"summary": {"ok": 27, "warning": 0, "critical": 1, "total": 28},
|
||||
"summary": {"ok": 28, "warning": 0, "critical": 1, "total": 29},
|
||||
"checks": [
|
||||
{
|
||||
"name": "PChome 受控落地 drift monitor",
|
||||
@@ -5108,6 +5402,7 @@ def test_scheduled_automation_health_summary_can_use_current_smoke_without_recor
|
||||
_auto_policy_authorization_evidence_execution_preflight_history_check(),
|
||||
_auto_policy_authorization_evidence_execution_closeout_history_check(),
|
||||
_auto_policy_controlled_apply_final_preflight_history_check(),
|
||||
_auto_policy_controlled_dry_run_package_history_check(),
|
||||
{
|
||||
"name": "AI surface HTML readback",
|
||||
"status": "ok",
|
||||
@@ -5163,7 +5458,7 @@ def test_scheduled_automation_health_summary_falls_back_to_visual_qa_artifact(tm
|
||||
json.dumps({
|
||||
"generated_at": datetime.now().isoformat(timespec="seconds"),
|
||||
"status": "ok",
|
||||
"summary": {"ok": 26, "warning": 0, "critical": 0, "total": 26},
|
||||
"summary": {"ok": 27, "warning": 0, "critical": 0, "total": 27},
|
||||
"checks": [],
|
||||
}, ensure_ascii=False) + "\n",
|
||||
encoding="utf-8",
|
||||
@@ -5259,6 +5554,11 @@ def test_scheduled_automation_health_summary_falls_back_to_visual_qa_artifact(tm
|
||||
"_pchome_auto_policy_controlled_apply_final_preflight_check",
|
||||
lambda: _auto_policy_controlled_apply_final_preflight_history_check(),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
smoke,
|
||||
"_pchome_auto_policy_controlled_dry_run_package_check",
|
||||
lambda: _auto_policy_controlled_dry_run_package_history_check(),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
surface_service,
|
||||
"build_sitewide_visual_qa_readback",
|
||||
@@ -5307,7 +5607,7 @@ def test_scheduled_automation_health_summary_route_returns_compact_payload(tmp_p
|
||||
json.dumps({
|
||||
"generated_at": datetime.now().isoformat(timespec="seconds"),
|
||||
"status": "ok",
|
||||
"summary": {"ok": 28, "warning": 0, "critical": 0, "total": 28},
|
||||
"summary": {"ok": 29, "warning": 0, "critical": 0, "total": 29},
|
||||
"checks": [],
|
||||
}, ensure_ascii=False) + "\n",
|
||||
encoding="utf-8",
|
||||
@@ -5403,6 +5703,11 @@ def test_scheduled_automation_health_summary_route_returns_compact_payload(tmp_p
|
||||
"_pchome_auto_policy_controlled_apply_final_preflight_check",
|
||||
lambda: _auto_policy_controlled_apply_final_preflight_history_check(),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
smoke,
|
||||
"_pchome_auto_policy_controlled_dry_run_package_check",
|
||||
lambda: _auto_policy_controlled_dry_run_package_history_check(),
|
||||
)
|
||||
|
||||
app = Flask(__name__)
|
||||
with app.test_request_context(
|
||||
@@ -5644,6 +5949,7 @@ def test_surface_html_readback_check_is_part_of_ai_smoke(monkeypatch):
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_authorization_evidence_execution_preflight_check", lambda: smoke._check("auto-policy authorization evidence execution preflight", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_authorization_evidence_execution_closeout_check", lambda: smoke._check("auto-policy authorization evidence execution closeout", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_controlled_apply_final_preflight_check", lambda: smoke._check("auto-policy controlled apply final preflight", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_pchome_auto_policy_controlled_dry_run_package_check", lambda: smoke._check("auto-policy controlled dry-run package", "ok", "ok"))
|
||||
monkeypatch.setattr(smoke, "_sitewide_visual_qa_check", lambda: smoke._check(
|
||||
"Sitewide visual QA readback",
|
||||
"ok",
|
||||
@@ -5665,7 +5971,7 @@ def test_surface_html_readback_check_is_part_of_ai_smoke(monkeypatch):
|
||||
item for item in result["checks"]
|
||||
if item["name"] == "Sitewide visual QA readback"
|
||||
)
|
||||
assert result["summary"]["total"] == 28
|
||||
assert result["summary"]["total"] == 29
|
||||
assert surface_check["status"] == "ok"
|
||||
assert surface_check["details"]["checked_surface_count"] == 10
|
||||
assert sitewide_check["status"] == "ok"
|
||||
|
||||
Reference in New Issue
Block a user