feat: Compliance Maximizer — Regulatory Optimization Engine
Some checks failed
Build + Deploy / build-admin-compliance (push) Successful in 1m45s
Build + Deploy / build-backend-compliance (push) Successful in 4m42s
Build + Deploy / build-ai-sdk (push) Successful in 46s
Build + Deploy / build-developer-portal (push) Successful in 1m6s
Build + Deploy / build-tts (push) Successful in 1m14s
Build + Deploy / build-document-crawler (push) Successful in 31s
Build + Deploy / build-dsms-gateway (push) Successful in 24s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / loc-budget (push) Failing after 15s
CI / secret-scan (push) Has been skipped
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 2m27s
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / test-go (push) Failing after 37s
CI / test-python-backend (push) Successful in 42s
CI / test-python-document-crawler (push) Successful in 25s
CI / test-python-dsms-gateway (push) Successful in 23s
CI / validate-canonical-controls (push) Successful in 18s
Build + Deploy / trigger-orca (push) Successful in 4m35s

Neues Modul das den regulatorischen Spielraum fuer KI-Use-Cases
deterministisch berechnet und optimale Konfigurationen vorschlaegt.

Kernfeatures:
- 13-Dimensionen Constraint-Space (DSGVO + AI Act)
- 3-Zonen-Analyse: Verboten / Eingeschraenkt / Erlaubt
- Deterministische Optimizer-Engine (kein LLM im Kern)
- 28 Constraint-Regeln aus DSGVO, AI Act, EDPB Guidelines
- 28 Tests (Golden Suite + Meta-Tests)
- REST API: /sdk/v1/maximizer/* (9 Endpoints)
- Frontend: 3-Zonen-Visualisierung, Dimension-Form, Score-Gauges

[migration-approved]

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-04-23 09:10:20 +02:00
parent 01bf1463b8
commit 1ac716261c
30 changed files with 3779 additions and 1 deletions

View File

@@ -0,0 +1,52 @@
'use client'
interface DimensionDelta {
dimension: string
from: string
to: string
impact: string
}
const DIMENSION_LABELS: Record<string, string> = {
automation_level: 'Automatisierungsgrad',
decision_binding: 'Entscheidungsbindung',
decision_impact: 'Entscheidungswirkung',
domain: 'Branche',
data_type: 'Datensensitivitaet',
human_in_loop: 'Menschliche Kontrolle',
explainability: 'Erklaerbarkeit',
risk_classification: 'Risikoklasse',
legal_basis: 'Rechtsgrundlage',
transparency_required: 'Transparenzpflicht',
logging_required: 'Protokollierung',
model_type: 'Modelltyp',
deployment_scope: 'Einsatzbereich',
}
export function ConfigComparison({ deltas }: { deltas: DimensionDelta[] }) {
if (deltas.length === 0) {
return (
<div className="bg-green-50 border border-green-200 rounded-lg p-4 text-green-700 text-sm">
Keine Aenderungen noetig Ihre Konfiguration ist bereits konform.
</div>
)
}
return (
<div className="space-y-2">
<h4 className="text-sm font-medium text-gray-700">Empfohlene Aenderungen ({deltas.length})</h4>
<div className="space-y-1">
{deltas.map((d, i) => (
<div key={i} className="flex items-center gap-2 bg-blue-50 border border-blue-200 rounded px-3 py-2 text-sm">
<span className="font-medium text-gray-800 min-w-[160px]">
{DIMENSION_LABELS[d.dimension] || d.dimension}
</span>
<span className="text-red-600 font-mono line-through">{d.from}</span>
<span className="text-gray-400"></span>
<span className="text-green-700 font-mono font-bold">{d.to}</span>
</div>
))}
</div>
</div>
)
}

View File

@@ -0,0 +1,74 @@
'use client'
import { ZoneBadge } from './ZoneBadge'
interface ZoneInfo {
dimension: string
current_value: string
zone: 'FORBIDDEN' | 'RESTRICTED' | 'SAFE'
allowed_values?: string[]
forbidden_values?: string[]
safeguards?: string[]
reason: string
obligation_refs: string[]
}
const DIMENSION_LABELS: Record<string, string> = {
automation_level: 'Automatisierungsgrad',
decision_binding: 'Entscheidungsbindung',
decision_impact: 'Entscheidungswirkung',
domain: 'Branche',
data_type: 'Datensensitivitaet',
human_in_loop: 'Menschliche Kontrolle',
explainability: 'Erklaerbarkeit',
risk_classification: 'Risikoklasse',
legal_basis: 'Rechtsgrundlage',
transparency_required: 'Transparenzpflicht',
logging_required: 'Protokollierung',
model_type: 'Modelltyp',
deployment_scope: 'Einsatzbereich',
}
export function DimensionZoneTable({ zoneMap }: { zoneMap: Record<string, ZoneInfo> }) {
const dimensions = Object.entries(zoneMap).sort(([, a], [, b]) => {
const order = { FORBIDDEN: 0, RESTRICTED: 1, SAFE: 2 }
return (order[a.zone] ?? 2) - (order[b.zone] ?? 2)
})
return (
<div className="overflow-x-auto">
<table className="min-w-full divide-y divide-gray-200">
<thead className="bg-gray-50">
<tr>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Dimension</th>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Aktueller Wert</th>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Zone</th>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Regelgrund</th>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Rechtsgrundlage</th>
</tr>
</thead>
<tbody className="bg-white divide-y divide-gray-200">
{dimensions.map(([dim, info]) => (
<tr key={dim} className={info.zone === 'FORBIDDEN' ? 'bg-red-50' : info.zone === 'RESTRICTED' ? 'bg-yellow-50' : ''}>
<td className="px-4 py-2 text-sm font-medium text-gray-900">
{DIMENSION_LABELS[dim] || dim}
</td>
<td className="px-4 py-2 text-sm text-gray-600 font-mono">
{info.current_value}
</td>
<td className="px-4 py-2">
<ZoneBadge zone={info.zone} />
</td>
<td className="px-4 py-2 text-sm text-gray-600">
{info.reason || '-'}
</td>
<td className="px-4 py-2 text-sm text-gray-500">
{info.obligation_refs?.join(', ') || '-'}
</td>
</tr>
))}
</tbody>
</table>
</div>
)
}

View File

@@ -0,0 +1,50 @@
'use client'
interface ScoreCardProps {
safetyScore: number
utilityScore: number
compositeScore: number
deltaCount: number
}
function ScoreGauge({ value, label, color }: { value: number; label: string; color: string }) {
return (
<div className="flex flex-col items-center gap-1">
<div className="relative w-16 h-16">
<svg viewBox="0 0 36 36" className="w-16 h-16">
<path
d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"
fill="none" stroke="#e5e7eb" strokeWidth="3"
/>
<path
d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"
fill="none" stroke={color} strokeWidth="3"
strokeDasharray={`${value}, 100`}
strokeLinecap="round"
/>
</svg>
<span className="absolute inset-0 flex items-center justify-center text-sm font-bold text-gray-800">
{value}
</span>
</div>
<span className="text-xs text-gray-500">{label}</span>
</div>
)
}
export function OptimizationScoreCard({ safetyScore, utilityScore, compositeScore, deltaCount }: ScoreCardProps) {
return (
<div className="bg-white border border-gray-200 rounded-lg p-4">
<h4 className="text-sm font-medium text-gray-700 mb-3">Bewertung der optimierten Konfiguration</h4>
<div className="flex items-center gap-6">
<ScoreGauge value={safetyScore} label="Sicherheit" color="#22c55e" />
<ScoreGauge value={utilityScore} label="Business-Nutzen" color="#3b82f6" />
<ScoreGauge value={Math.round(compositeScore)} label="Gesamt" color="#8b5cf6" />
<div className="flex flex-col items-center gap-1">
<span className="text-2xl font-bold text-gray-800">{deltaCount}</span>
<span className="text-xs text-gray-500">Aenderungen</span>
</div>
</div>
</div>
)
}

View File

@@ -0,0 +1,16 @@
'use client'
const ZONE_STYLES = {
FORBIDDEN: { bg: 'bg-red-100', text: 'text-red-700', border: 'border-red-300', label: 'Verboten' },
RESTRICTED: { bg: 'bg-yellow-100', text: 'text-yellow-700', border: 'border-yellow-300', label: 'Eingeschraenkt' },
SAFE: { bg: 'bg-green-100', text: 'text-green-700', border: 'border-green-300', label: 'Erlaubt' },
}
export function ZoneBadge({ zone }: { zone: 'FORBIDDEN' | 'RESTRICTED' | 'SAFE' }) {
const style = ZONE_STYLES[zone] || ZONE_STYLES.SAFE
return (
<span className={`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium border ${style.bg} ${style.text} ${style.border}`}>
{style.label}
</span>
)
}