feat(smoke): monitor pchome signing execution closeout
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-03 10:19:11 +08:00
parent 2326227fed
commit fe59c70b2a
6 changed files with 1049 additions and 115 deletions

View File

@@ -107,10 +107,10 @@ def test_system_metrics_exports_scheduled_health_summary():
Gauge,
{
"summary": {
"ok": 13,
"ok": 14,
"warning": 1,
"critical": 0,
"total": 14,
"total": 15,
"primary_human_gate_count": 0,
"writes_database_count": 0,
},
@@ -126,6 +126,7 @@ def test_system_metrics_exports_scheduled_health_summary():
{"key": "pchome_auto_policy_signing_issuer_guard", "status": "ok"},
{"key": "pchome_auto_policy_signing_issuer_closeout", "status": "ok"},
{"key": "pchome_auto_policy_signing_execution_preflight", "status": "ok"},
{"key": "pchome_auto_policy_signing_execution_closeout", "status": "ok"},
{"key": "sitewide_ui_ux_agent", "status": "ok"},
{"key": "sitewide_visual_qa", "status": "ok"},
],
@@ -133,7 +134,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"} 13.0' in output
assert 'momo_ai_automation_scheduled_health_summary_total{status="ok"} 14.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'
@@ -179,6 +180,10 @@ def test_system_metrics_exports_scheduled_health_summary():
'momo_ai_automation_scheduled_health_family_status{family="pchome_auto_policy_signing_execution_preflight",status="ok"} 1.0'
in output
)
assert (
'momo_ai_automation_scheduled_health_family_status{family="pchome_auto_policy_signing_execution_closeout",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

View File

@@ -369,6 +369,63 @@ def _auto_policy_signing_execution_preflight_history_check(status="ok"):
}
def _auto_policy_signing_execution_closeout_history_check(status="ok"):
return {
"name": "PChome auto-policy signing execution closeout",
"status": status,
"summary": "PChome auto-policy signing execution closeout 已自動完成",
"details": {
"policy": (
"read_only_pchome_growth_auto_policy_db_apply_authorization_"
"signing_execution_closeout"
),
"result": "DB_APPLY_AUTHORIZATION_SIGNING_EXECUTION_CLOSEOUT_READY",
"signing_execution_closeout_ready_count": 1,
"signing_execution_closeout_check_count": 12,
"signing_execution_closeout_pass_count": 12,
"signing_execution_closeout_waiting_count": 0,
"signing_execution_preflight_ready_count": 1,
"signing_execution_preflight_check_count": 12,
"signing_execution_preflight_pass_count": 12,
"unsigned_signed_authorization_receipt_boundary_count": 1,
"operator_held_secret_boundary_count": 1,
"signing_execution_input_requirement_count": 10,
"signing_execution_abort_condition_count": 8,
"rollback_boundary_count": 4,
"post_apply_verifier_required_count": 1,
"same_run_truth_required_count": 1,
"reads_secret_count": 0,
"executes_script_count": 0,
"executes_sql_count": 0,
"writes_database_count": 0,
"signs_database_apply_authorization_count": 0,
"primary_human_gate_count": 0,
"manual_review_mode": "exception_only",
"payload_source": "local_contract_fixture",
"execute_fetch": True,
"outbound_network": False,
"business_data_source": False,
"secret_reference_mode": "external_runtime_reference_only",
"command_preview_redacts_secret_values": True,
"command_preview_executes_in_preview": False,
"signed_authorization_receipt_included": False,
"signature_material_included": False,
"ready_for_database_apply_now": False,
"issues_database_apply_authorization": False,
"signs_database_apply_authorization": False,
"secret_material_included": False,
"secret_material_required_in_preview": False,
"ready_for_future_signing_execution_closeout": True,
"ready_for_future_unsigned_signed_authorization_receipt_boundary": True,
"ready_for_future_signed_authorization_receipt_lane": True,
"permits_future_unsigned_signed_authorization_receipt_boundary": True,
"next_machine_action": (
"continue_to_pchome_auto_policy_signed_receipt_preflight_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
@@ -413,6 +470,7 @@ def test_collect_ai_automation_smoke_uses_worst_status(monkeypatch):
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_issuer_guard_check", lambda: smoke._check("auto-policy signing issuer guard", "ok", "ok"))
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_issuer_closeout_check", lambda: smoke._check("auto-policy signing issuer closeout", "ok", "ok"))
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_execution_preflight_check", lambda: smoke._check("auto-policy signing execution preflight", "ok", "ok"))
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_execution_closeout_check", lambda: smoke._check("auto-policy signing execution closeout", "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"))
@@ -420,7 +478,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": 17, "warning": 1, "critical": 1, "total": 19}
assert result["summary"] == {"ok": 18, "warning": 1, "critical": 1, "total": 20}
def test_pchome_controlled_apply_drift_monitor_reports_verified_zero_drift(monkeypatch):
@@ -1365,6 +1423,174 @@ def test_pchome_auto_policy_signing_execution_preflight_reports_operator_secret_
)
def test_pchome_auto_policy_signing_execution_closeout_reports_unsigned_receipt_boundary_no_signing(monkeypatch):
from services import ai_automation_smoke_service as smoke
from services import pchome_mapping_backlog_service as backlog
captured = {}
def fake_closeout(*_args, **kwargs):
captured.update(kwargs)
return {
"policy": (
"read_only_pchome_growth_auto_policy_db_apply_authorization_"
"signing_execution_closeout"
),
"result": "DB_APPLY_AUTHORIZATION_SIGNING_EXECUTION_CLOSEOUT_READY",
"source_policy": (
"read_only_pchome_growth_auto_policy_db_apply_authorization_"
"signing_execution_preflight"
),
"summary": {
"authorization_signing_execution_closeout_ready_count": 1,
"signing_execution_closeout_check_count": 12,
"signing_execution_closeout_pass_count": 12,
"signing_execution_closeout_waiting_count": 0,
"authorization_signing_execution_preflight_ready_count": 1,
"signing_execution_preflight_check_count": 12,
"signing_execution_preflight_pass_count": 12,
"unsigned_signed_authorization_receipt_boundary_count": 1,
"operator_held_secret_boundary_count": 1,
"signing_execution_input_requirement_count": 10,
"signing_execution_abort_condition_count": 8,
"rollback_boundary_count": 4,
"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,
},
"future_authorization_signing_execution_closeout": {
"ready_for_future_signing_execution_closeout": True,
"can_enter_future_unsigned_signed_authorization_receipt_boundary": True,
"ready_for_database_apply_now": False,
"issues_database_apply_authorization": False,
"signs_database_apply_authorization": False,
"secret_material_included": False,
"secret_material_required_in_preview": False,
"reads_secret_in_preview": False,
},
"unsigned_signed_authorization_receipt_boundary": {
"authorization_material_type": "unsigned_signed_authorization_receipt_boundary",
"ready_for_future_unsigned_signed_authorization_receipt_boundary": True,
"ready_for_future_signed_authorization_receipt_lane": True,
"ready_for_database_apply_now": False,
"issues_database_apply_authorization": False,
"signs_database_apply_authorization": False,
"signed_authorization_receipt_included": False,
"signature_material_included": False,
"secret_material_included": False,
"secret_material_required_in_preview": False,
"reads_secret_in_preview": False,
"executes_shell_in_preview": False,
"executes_sql_in_preview": False,
"writes_database_in_preview": False,
"hash_matches": True,
"requires_post_apply_verifier": True,
"requires_fresh_production_truth_in_same_run": True,
"operator_held_secret_boundary_contract": {
"secret_reference_mode": "external_runtime_reference_only",
"secret_material_included": False,
"secret_material_required_in_preview": False,
"reads_secret_in_preview": False,
"accepts_plaintext_secret": False,
"permits_secret_value_logging": False,
},
"command_preview": {
"mode": "future_command_shape_only",
"redacts_secret_values": True,
"executes_in_preview": False,
"signs_database_apply_authorization": False,
"writes_database": False,
},
},
"signing_execution_closeout_contract": {
"machine_verifiable": True,
"permits_future_unsigned_signed_authorization_receipt_boundary": True,
"issues_database_apply_authorization": False,
"ready_for_database_apply_now": False,
"signs_database_apply_authorization": False,
"writes_database": False,
"executes_in_preview": False,
"secret_material_required_in_preview": False,
},
"safety": {
"reads_secret_in_preview": False,
"writes_file": False,
"writes_script_in_preview": False,
"writes_artifact_in_preview": False,
"executes_script": False,
"executes_endpoint": False,
"executes_migration": False,
"executes_sql": False,
"writes_database": False,
"signs_database_apply_authorization": False,
"manual_review_mode": "exception_only",
},
}
monkeypatch.setattr(
backlog,
"build_pchome_auto_policy_db_apply_authorization_signing_execution_closeout",
fake_closeout,
)
result = smoke._pchome_auto_policy_signing_execution_closeout_check()
assert result["status"] == "ok"
assert captured["execute_fetch"] is True
assert captured["http_get"] is smoke._pchome_auto_policy_machine_fetch_evidence_get
assert result["details"]["signing_execution_closeout_pass_count"] == 12
assert result["details"]["signing_execution_preflight_check_count"] == 12
assert result["details"]["unsigned_signed_authorization_receipt_boundary_count"] == 1
assert result["details"]["operator_held_secret_boundary_count"] == 1
assert result["details"]["signing_execution_input_requirement_count"] == 10
assert result["details"]["signing_execution_abort_condition_count"] == 8
assert result["details"]["rollback_boundary_count"] == 4
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"]["reads_secret_count"] == 0
assert result["details"]["writes_database_count"] == 0
assert result["details"]["signs_database_apply_authorization_count"] == 0
assert result["details"]["secret_reference_mode"] == "external_runtime_reference_only"
assert result["details"]["command_preview_redacts_secret_values"] is True
assert result["details"]["command_preview_executes_in_preview"] is False
assert result["details"]["signed_authorization_receipt_included"] is False
assert result["details"]["signature_material_included"] is False
assert result["details"]["issues_database_apply_authorization"] is False
assert result["details"]["signs_database_apply_authorization"] is False
assert result["details"]["secret_material_included"] is False
assert result["details"]["secret_material_required_in_preview"] is False
assert result["details"]["ready_for_future_signing_execution_closeout"] is True
assert (
result["details"][
"ready_for_future_unsigned_signed_authorization_receipt_boundary"
]
is True
)
assert result["details"]["ready_for_future_signed_authorization_receipt_lane"] is True
assert (
result["details"][
"permits_future_unsigned_signed_authorization_receipt_boundary"
]
is True
)
assert result["details"]["next_machine_action"] == (
"continue_to_pchome_auto_policy_signed_receipt_preflight_lane"
)
def test_collect_ai_automation_smoke_persists_recent_history(tmp_path, monkeypatch):
from services import ai_automation_smoke_service as smoke
@@ -1387,6 +1613,7 @@ def test_collect_ai_automation_smoke_persists_recent_history(tmp_path, monkeypat
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_issuer_guard_check", lambda: smoke._check("auto-policy signing issuer guard", "ok", "ok"))
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_issuer_closeout_check", lambda: smoke._check("auto-policy signing issuer closeout", "ok", "ok"))
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_execution_preflight_check", lambda: smoke._check("auto-policy signing execution preflight", "ok", "ok"))
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_execution_closeout_check", lambda: smoke._check("auto-policy signing execution closeout", "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"))
@@ -1445,7 +1672,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": 19, "warning": 0, "critical": 0, "total": 19},
"summary": {"ok": 20, "warning": 0, "critical": 0, "total": 20},
"checks": [
{
"name": "PChome 受控落地 drift monitor",
@@ -1468,6 +1695,7 @@ def test_scheduled_automation_health_summary_reads_history_without_side_effects(
_auto_policy_signing_issuer_guard_history_check(),
_auto_policy_signing_issuer_closeout_history_check(),
_auto_policy_signing_execution_preflight_history_check(),
_auto_policy_signing_execution_closeout_history_check(),
{
"name": "AI surface HTML readback",
"status": "ok",
@@ -1529,7 +1757,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"] == 16
assert summary["summary"]["total"] == 17
assert summary["summary"]["primary_human_gate_count"] == 0
assert summary["summary"]["writes_database_count"] == 0
assert pchome_family["status"] == "ok"
@@ -1776,6 +2004,109 @@ def test_scheduled_automation_health_summary_reads_history_without_side_effects(
]
is True
)
signing_execution_closeout_family = next(
item for item in summary["families"]
if item["key"] == "pchome_auto_policy_signing_execution_closeout"
)
assert signing_execution_closeout_family["status"] == "ok"
assert (
signing_execution_closeout_family["details"][
"signing_execution_closeout_pass_count"
]
== 12
)
assert (
signing_execution_closeout_family["details"][
"signing_execution_preflight_check_count"
]
== 12
)
assert (
signing_execution_closeout_family["details"][
"unsigned_signed_authorization_receipt_boundary_count"
]
== 1
)
assert (
signing_execution_closeout_family["details"][
"operator_held_secret_boundary_count"
]
== 1
)
assert (
signing_execution_closeout_family["details"][
"signing_execution_input_requirement_count"
]
== 10
)
assert (
signing_execution_closeout_family["details"][
"signing_execution_abort_condition_count"
]
== 8
)
assert signing_execution_closeout_family["details"]["rollback_boundary_count"] == 4
assert (
signing_execution_closeout_family["details"]["payload_source"]
== "local_contract_fixture"
)
assert signing_execution_closeout_family["details"]["outbound_network"] is False
assert signing_execution_closeout_family["details"]["business_data_source"] is False
assert signing_execution_closeout_family["details"]["primary_human_gate_count"] == 0
assert signing_execution_closeout_family["details"]["reads_secret_count"] == 0
assert signing_execution_closeout_family["details"]["writes_database_count"] == 0
assert (
signing_execution_closeout_family["details"][
"signs_database_apply_authorization_count"
]
== 0
)
assert (
signing_execution_closeout_family["details"]["secret_reference_mode"]
== "external_runtime_reference_only"
)
assert (
signing_execution_closeout_family["details"][
"command_preview_redacts_secret_values"
]
is True
)
assert (
signing_execution_closeout_family["details"][
"command_preview_executes_in_preview"
]
is False
)
assert (
signing_execution_closeout_family["details"][
"signed_authorization_receipt_included"
]
is False
)
assert (
signing_execution_closeout_family["details"]["signature_material_included"]
is False
)
assert (
signing_execution_closeout_family["details"]["signs_database_apply_authorization"]
is False
)
assert (
signing_execution_closeout_family["details"]["secret_material_included"]
is False
)
assert (
signing_execution_closeout_family["details"][
"ready_for_future_signing_execution_closeout"
]
is True
)
assert (
signing_execution_closeout_family["details"][
"ready_for_future_unsigned_signed_authorization_receipt_boundary"
]
is True
)
surface_family = next(
item for item in summary["families"]
if item["key"] == "ai_surface_html_readback"
@@ -1810,7 +2141,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": 18, "warning": 0, "critical": 1, "total": 19},
"summary": {"ok": 19, "warning": 0, "critical": 1, "total": 20},
"checks": [
{
"name": "PChome 受控落地 drift monitor",
@@ -1827,6 +2158,7 @@ def test_scheduled_automation_health_summary_can_use_current_smoke_without_recor
_auto_policy_signing_issuer_guard_history_check(),
_auto_policy_signing_issuer_closeout_history_check(),
_auto_policy_signing_execution_preflight_history_check(),
_auto_policy_signing_execution_closeout_history_check(),
{
"name": "AI surface HTML readback",
"status": "ok",
@@ -1877,105 +2209,6 @@ def test_scheduled_automation_health_summary_falls_back_to_visual_qa_artifact(tm
from services import ai_automation_smoke_service as smoke
from services import ai_surface_html_readback_service as surface_service
history_path = tmp_path / "smoke_history.jsonl"
history_path.write_text(
json.dumps({
"generated_at": datetime.now().isoformat(timespec="seconds"),
"status": "ok",
"summary": {"ok": 17, "warning": 0, "critical": 0, "total": 17},
"checks": [],
}, ensure_ascii=False) + "\n",
encoding="utf-8",
)
monkeypatch.setattr(smoke, "_HISTORY_PATH", str(history_path))
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_authorization_guard_check",
lambda: _auto_policy_guard_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_decision_preflight_check",
lambda: _auto_policy_decision_preflight_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_decision_closeout_check",
lambda: _auto_policy_decision_closeout_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_authorization_issuer_gate_check",
lambda: _auto_policy_authorization_issuer_gate_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_decision_preflight_check",
lambda: _auto_policy_signing_decision_preflight_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_decision_closeout_check",
lambda: _auto_policy_signing_decision_closeout_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_issuer_guard_check",
lambda: _auto_policy_signing_issuer_guard_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_issuer_closeout_check",
lambda: _auto_policy_signing_issuer_closeout_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_execution_preflight_check",
lambda: _auto_policy_signing_execution_preflight_history_check(),
)
monkeypatch.setattr(
surface_service,
"build_sitewide_visual_qa_readback",
lambda **_kwargs: {
"policy": "read_only_sitewide_visual_qa_readback_v1",
"status": "ok",
"artifact_path": "data/ai_automation/sitewide_visual_qa_latest.json",
"artifact_exists": True,
"artifact_generated_at": "2026-07-03T07:40:00",
"next_machine_action": "keep_sitewide_visual_qa_monitoring",
"summary": {
"result_count": 147,
"route_count": 49,
"viewport_count": 3,
"pass_count": 147,
"failed_count": 0,
"overflow_issue_count": 0,
"visual_offender_count": 0,
"stale": False,
},
},
)
summary = smoke.build_scheduled_automation_health_summary(
history_limit=5,
freshness_max_age_hours=9999,
)
visual_family = next(
item for item in summary["families"]
if item["key"] == "sitewide_visual_qa"
)
assert visual_family["status"] == "ok"
assert visual_family["details"]["route_count"] == 49
assert visual_family["details"]["failed_count"] == 0
def test_scheduled_automation_health_summary_route_returns_compact_payload(tmp_path, monkeypatch):
from datetime import datetime
from flask import Flask
from routes import system_public_routes as routes
from services import ai_automation_smoke_service as smoke
history_path = tmp_path / "smoke_history.jsonl"
history_path.write_text(
json.dumps({
@@ -2032,6 +2265,115 @@ def test_scheduled_automation_health_summary_route_returns_compact_payload(tmp_p
"_pchome_auto_policy_signing_execution_preflight_check",
lambda: _auto_policy_signing_execution_preflight_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_execution_closeout_check",
lambda: _auto_policy_signing_execution_closeout_history_check(),
)
monkeypatch.setattr(
surface_service,
"build_sitewide_visual_qa_readback",
lambda **_kwargs: {
"policy": "read_only_sitewide_visual_qa_readback_v1",
"status": "ok",
"artifact_path": "data/ai_automation/sitewide_visual_qa_latest.json",
"artifact_exists": True,
"artifact_generated_at": "2026-07-03T07:40:00",
"next_machine_action": "keep_sitewide_visual_qa_monitoring",
"summary": {
"result_count": 147,
"route_count": 49,
"viewport_count": 3,
"pass_count": 147,
"failed_count": 0,
"overflow_issue_count": 0,
"visual_offender_count": 0,
"stale": False,
},
},
)
summary = smoke.build_scheduled_automation_health_summary(
history_limit=5,
freshness_max_age_hours=9999,
)
visual_family = next(
item for item in summary["families"]
if item["key"] == "sitewide_visual_qa"
)
assert visual_family["status"] == "ok"
assert visual_family["details"]["route_count"] == 49
assert visual_family["details"]["failed_count"] == 0
def test_scheduled_automation_health_summary_route_returns_compact_payload(tmp_path, monkeypatch):
from datetime import datetime
from flask import Flask
from routes import system_public_routes as routes
from services import ai_automation_smoke_service as smoke
history_path = tmp_path / "smoke_history.jsonl"
history_path.write_text(
json.dumps({
"generated_at": datetime.now().isoformat(timespec="seconds"),
"status": "ok",
"summary": {"ok": 19, "warning": 0, "critical": 0, "total": 19},
"checks": [],
}, ensure_ascii=False) + "\n",
encoding="utf-8",
)
monkeypatch.setattr(smoke, "_HISTORY_PATH", str(history_path))
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_authorization_guard_check",
lambda: _auto_policy_guard_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_decision_preflight_check",
lambda: _auto_policy_decision_preflight_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_decision_closeout_check",
lambda: _auto_policy_decision_closeout_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_authorization_issuer_gate_check",
lambda: _auto_policy_authorization_issuer_gate_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_decision_preflight_check",
lambda: _auto_policy_signing_decision_preflight_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_decision_closeout_check",
lambda: _auto_policy_signing_decision_closeout_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_issuer_guard_check",
lambda: _auto_policy_signing_issuer_guard_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_issuer_closeout_check",
lambda: _auto_policy_signing_issuer_closeout_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_execution_preflight_check",
lambda: _auto_policy_signing_execution_preflight_history_check(),
)
monkeypatch.setattr(
smoke,
"_pchome_auto_policy_signing_execution_closeout_check",
lambda: _auto_policy_signing_execution_closeout_history_check(),
)
app = Flask(__name__)
with app.test_request_context(
@@ -2264,6 +2606,7 @@ def test_surface_html_readback_check_is_part_of_ai_smoke(monkeypatch):
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_issuer_guard_check", lambda: smoke._check("auto-policy signing issuer guard", "ok", "ok"))
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_issuer_closeout_check", lambda: smoke._check("auto-policy signing issuer closeout", "ok", "ok"))
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_execution_preflight_check", lambda: smoke._check("auto-policy signing execution preflight", "ok", "ok"))
monkeypatch.setattr(smoke, "_pchome_auto_policy_signing_execution_closeout_check", lambda: smoke._check("auto-policy signing execution closeout", "ok", "ok"))
monkeypatch.setattr(smoke, "_sitewide_visual_qa_check", lambda: smoke._check(
"Sitewide visual QA readback",
"ok",
@@ -2285,7 +2628,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"] == 19
assert result["summary"]["total"] == 20
assert surface_check["status"] == "ok"
assert surface_check["details"]["checked_surface_count"] == 10
assert sitewide_check["status"] == "ok"