feat(cookie): ② Documentation Drift — Richtlinie vs. Browser-Realität

Cookie-Check-Endpoint liefert jetzt out["drift"] (audit_cookie_compliance):
deklariert (Cookie-Richtlinie-Text) vs. tatsaechlich geladen (Browser).
Frontend zeigt den Reality-Check-Strip oben im Panel: X dokumentiert ·
Y geladen · Z undokumentiert. Pinnt den Vertrag mit test_cookie_drift.py
(undokumentiert-geladen + beide Drift-Richtungen) + Vitest Drift-Strip.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-11 09:33:41 +02:00
parent ee64b7e95c
commit 05a1795ea8
4 changed files with 93 additions and 0 deletions
@@ -28,6 +28,12 @@ interface CheckData {
real_cookies?: number
other_storage?: number
}
drift?: {
declared_count?: number
browser_count?: number
high_findings?: number
low_findings?: number
}
}
const SEV_COLOR: Record<string, string> = {
@@ -55,8 +61,24 @@ export function CookieFindingList({ data }: { data: CheckData }) {
const findings = data.findings || []
const s = data.summary || {}
const inv = data.storage_inventory
const drift = data.drift
const driftShown =
!!drift && ((drift.declared_count ?? 0) + (drift.browser_count ?? 0)) > 0
return (
<div className="border rounded-lg overflow-hidden">
{driftShown && (
<div className="px-4 py-2.5 bg-amber-50 border-b text-xs text-amber-900">
<span className="font-semibold">Richtlinie Realität:</span>{' '}
<strong>{drift!.declared_count ?? 0}</strong> in der Cookie-Richtlinie
dokumentiert · <strong>{drift!.browser_count ?? 0}</strong> im Browser geladen
{(drift!.high_findings ?? 0) > 0 && (
<> · <strong className="text-red-700">{drift!.high_findings} undokumentiert geladen</strong></>
)}
{(drift!.low_findings ?? 0) > 0 && (
<> · {drift!.low_findings} dokumentiert, aber nicht geladen</>
)}
</div>
)}
{inv && (inv.total ?? 0) > 0 && (
<div className="px-4 py-2.5 bg-blue-50 border-b text-xs text-blue-900">
<span className="font-semibold">Storage-Inventar:</span>{' '}