Files
breakpilot-compliance/backend-compliance/compliance/tests/test_linter_word_boundary.py
T
Benjamin Admin 3c6deac1c5 fix(dse+linter): Drittland-Applicability, kein na-Detail, kurze Titel, Linter-Wortgrenzen
- Linter: FORBIDDEN_OUTPUT_TERMS per Wortgrenze → 'Schutzgarantien'/'geeignete
  Garantien' (Art. 46) passieren, 'garantiert'-Claims bleiben geblockt.
- DSE: L2-Detail wird übersprungen statt 'na', wenn die L1-Pflichtangabe fehlt
  (kein irreführendes 'nicht anwendbar' für z.B. Transfermechanismus).
- DSE: Drittland → HIGH bei dokumentiertem Drittlandtransfer (scan_context via
  AgentInput.context) — BMW (Konzern, US-Provider) ist kein weiches MEDIUM.
- DSE: Titel/Maßnahme kurz (treibt den Recommendation-Titel); ausführliche
  Begründung als evidence — behebt 120-Zeichen-abgeschnittene Überschriften.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-11 13:43:24 +02:00

33 lines
1.1 KiB
Python

"""Disclaimer-Linter: Wort-Grenzen — Rechtsbegriffe passieren, Claims geblockt."""
from __future__ import annotations
from datetime import datetime, timezone
from compliance.services.specialist_agents._base import (
AgentOutput,
Finding,
Severity,
lint_output,
)
def _out(action: str) -> AgentOutput:
now = datetime.now(timezone.utc)
f = Finding(check_id="X", agent="t", agent_version="1",
severity=Severity.MEDIUM, title="Titel", action=action)
return AgentOutput(agent="t", agent_version="1", started_at=now,
finished_at=now, duration_ms=0, findings=[f])
def test_schutzgarantien_not_scrubbed():
out = lint_output(_out("Geeignete Schutzgarantien nach Art. 46 angeben."))
assert "Schutzgarantien" in out.findings[0].action
assert "neutraler Wortlaut" not in out.findings[0].action
def test_garantiert_claim_still_blocked():
out = lint_output(_out("Dies ist garantiert konform."))
assert "garantiert" not in out.findings[0].action.lower()
assert "neutraler Wortlaut" in out.findings[0].action