"""B4 wiring — Cross-Doc Vendor-Consistency check + HTML block. Activated after B1+B3 in the orchestrator. The check itself is deterministic (no LLM); it scans DSE + cookie texts for known service providers per service type and flags every mismatch. The mail renderer reads `state["vendor_consistency_findings"]` and `state["vendor_consistency_html"]` directly — no further wiring. """ from __future__ import annotations import html import logging from compliance.services.vendor_consistency_check import ( check_vendor_consistency, ) logger = logging.getLogger(__name__) def run_b4(state: dict) -> None: findings = check_vendor_consistency(state) state["vendor_consistency_findings"] = findings if not findings: return state["vendor_consistency_html"] = _render(findings) logger.info( "B4 Vendor-Consistency: %d findings (HIGH=%d, MEDIUM=%d)", len(findings), sum(1 for f in findings if (f.get("severity") or "") == "HIGH"), sum(1 for f in findings if (f.get("severity") or "") == "MEDIUM"), ) def _render(findings: list[dict]) -> str: rows = [] for f in findings: sev = (f.get("severity") or "").upper() color = "#dc2626" if sev == "HIGH" else "#f59e0b" dse = ", ".join(f.get("dse_providers") or []) or "–" cookie = ", ".join(f.get("cookie_providers") or []) or "–" rows.append( "
" f"{len(findings)} Provider-Widersprüche zwischen " "Datenschutzerklärung und Cookie-Seite. Beispiel Elli: " "DSE = Vertex AI für Chatbot, Cookies-Seite = Iadvize.
" "| Service-Typ | " "In DSE | " "Auf Cookies-Seite | " "Severity | " "
|---|