fix(impressum): sector-gate respects on-topic criteria (parity with DSE)

A clearly impressum-thematic control (e.g. MStV 18 with inherited GOV prefix) is no longer dropped by the sector-prefix gate - topic overlap is the stronger signal. Mirrors dse/v3_engine. Salvaged WIP.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-21 12:40:43 +02:00
parent 28798a3ef6
commit abe7e59625
@@ -182,12 +182,18 @@ def _filter_controls(
for c in controls:
cid = c.get("control_id") or ""
prefix = cid.split("-")[0].upper() if "-" in cid else ""
on_topic = criteria_on_topic(c.get("pass_criteria"),
c.get("fail_criteria"))
required = SECTOR_PREFIXES.get(prefix)
if required and not (scope_lc & required):
# Sektor-Gate nur fuer NICHT-on-topic Controls: ein klar
# impressum-thematischer Control (z.B. MStV §18(1) mit GOV-Prefix
# aus der Domain-Erkennung der Control-Generierung) darf nicht am
# Branchen-Prefix scheitern. Der Themen-Ueberlapp ist der staerkere
# Relevanz-Beweis als ein vererbter ID-Prefix.
if required and not (scope_lc & required) and not on_topic:
sector_dropped += 1
continue
if not criteria_on_topic(c.get("pass_criteria"),
c.get("fail_criteria")):
if not on_topic:
offtopic_dropped += 1
continue
kept.append(c)