feat: Alle 5 verbleibenden SDK-Module auf 100% — RAG, Security-Backlog, Quality, Notfallplan, Loeschfristen
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 34s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 17s
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 34s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 17s
Paket A — RAG Proxy: - NEU: admin-compliance/app/api/sdk/v1/rag/[[...path]]/route.ts → Proxy zu ai-compliance-sdk:8090, GET+POST, UUID-Validierung - UPDATE: rag/page.tsx — setTimeout Mock → echte API-Calls GET /regulations → dynamische suggestedQuestions POST /search → Qdrant-Ergebnisse mit score, title, reference Paket B — Security-Backlog + Quality: - NEU: migrations/014_security_backlog.sql + 015_quality.sql - NEU: compliance/api/security_backlog_routes.py — CRUD + Stats - NEU: compliance/api/quality_routes.py — Metrics + Tests CRUD + Stats - UPDATE: security-backlog/page.tsx — mockItems → API - UPDATE: quality/page.tsx — mockMetrics/mockTests → API - UPDATE: compliance/api/__init__.py — Router-Registrierung - NEU: tests/test_security_backlog_routes.py (48 Tests — 48/48 bestanden) - NEU: tests/test_quality_routes.py (67 Tests — 67/67 bestanden) Paket C — Notfallplan Incidents + Templates: - NEU: migrations/016_notfallplan_incidents.sql compliance_notfallplan_incidents + compliance_notfallplan_templates - UPDATE: notfallplan_routes.py — GET/POST/PUT/DELETE für /incidents + /templates - UPDATE: notfallplan/page.tsx — Incidents-Tab + Templates-Tab → API - UPDATE: tests/test_notfallplan_routes.py (+76 neue Tests — alle bestanden) Paket D — Loeschfristen localStorage → API: - NEU: migrations/017_loeschfristen.sql (JSONB: legal_holds, storage_locations, ...) - NEU: compliance/api/loeschfristen_routes.py — CRUD + Stats + Status-Update - UPDATE: loeschfristen/page.tsx — vollständige localStorage → API Migration createNewPolicy → POST (API-UUID als id), deletePolicy → DELETE, handleSaveAndClose → PUT, adoptGeneratedPolicies → POST je Policy apiToPolicy() + policyToPayload() Mapper, saving-State für Buttons - NEU: tests/test_loeschfristen_routes.py (58 Tests — alle bestanden) Gesamt: 253 neue Tests, alle bestanden (48 + 67 + 76 + 58 + bestehende) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
28
backend-compliance/migrations/014_security_backlog.sql
Normal file
28
backend-compliance/migrations/014_security_backlog.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- Migration 014: Security Backlog
|
||||
-- Tracking security findings, vulnerabilities, and compliance issues
|
||||
|
||||
CREATE TABLE IF NOT EXISTS compliance_security_backlog (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL DEFAULT '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e',
|
||||
title TEXT NOT NULL,
|
||||
description TEXT,
|
||||
type TEXT NOT NULL DEFAULT 'vulnerability',
|
||||
-- vulnerability | misconfiguration | compliance | hardening
|
||||
severity TEXT NOT NULL DEFAULT 'medium',
|
||||
-- critical | high | medium | low
|
||||
status TEXT NOT NULL DEFAULT 'open',
|
||||
-- open | in-progress | resolved | accepted-risk
|
||||
source TEXT,
|
||||
cve TEXT,
|
||||
cvss NUMERIC(4,1),
|
||||
affected_asset TEXT,
|
||||
assigned_to TEXT,
|
||||
due_date TIMESTAMPTZ,
|
||||
remediation TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_security_backlog_tenant ON compliance_security_backlog(tenant_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_security_backlog_status ON compliance_security_backlog(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_security_backlog_severity ON compliance_security_backlog(severity);
|
||||
36
backend-compliance/migrations/015_quality.sql
Normal file
36
backend-compliance/migrations/015_quality.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
-- Migration 015: AI Quality Metrics and Tests
|
||||
-- Tracking AI system quality metrics and test results
|
||||
|
||||
CREATE TABLE IF NOT EXISTS compliance_quality_metrics (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL DEFAULT '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e',
|
||||
name TEXT NOT NULL,
|
||||
category TEXT NOT NULL DEFAULT 'accuracy',
|
||||
-- accuracy | fairness | robustness | explainability | performance
|
||||
score NUMERIC(5,2) NOT NULL DEFAULT 0,
|
||||
threshold NUMERIC(5,2) NOT NULL DEFAULT 80,
|
||||
trend TEXT DEFAULT 'stable',
|
||||
-- up | down | stable
|
||||
ai_system TEXT,
|
||||
last_measured TIMESTAMPTZ DEFAULT NOW(),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_quality_metrics_tenant ON compliance_quality_metrics(tenant_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS compliance_quality_tests (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL DEFAULT '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e',
|
||||
name TEXT NOT NULL,
|
||||
status TEXT NOT NULL DEFAULT 'pending',
|
||||
-- passed | failed | warning | pending
|
||||
duration TEXT,
|
||||
ai_system TEXT,
|
||||
details TEXT,
|
||||
last_run TIMESTAMPTZ DEFAULT NOW(),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_quality_tests_tenant ON compliance_quality_tests(tenant_id);
|
||||
43
backend-compliance/migrations/016_notfallplan_incidents.sql
Normal file
43
backend-compliance/migrations/016_notfallplan_incidents.sql
Normal file
@@ -0,0 +1,43 @@
|
||||
-- Migration 016: Notfallplan Incidents and Melde-Templates
|
||||
-- Extends Notfallplan module with incident register and template management
|
||||
|
||||
CREATE TABLE IF NOT EXISTS compliance_notfallplan_incidents (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id TEXT NOT NULL DEFAULT 'default',
|
||||
title TEXT NOT NULL,
|
||||
description TEXT,
|
||||
detected_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
detected_by TEXT,
|
||||
status TEXT NOT NULL DEFAULT 'detected',
|
||||
-- detected | classified | assessed | reported | not_reportable | closed
|
||||
severity TEXT NOT NULL DEFAULT 'medium',
|
||||
-- low | medium | high | critical
|
||||
affected_data_categories JSONB DEFAULT '[]'::jsonb,
|
||||
estimated_affected_persons INTEGER DEFAULT 0,
|
||||
measures JSONB DEFAULT '[]'::jsonb,
|
||||
art34_required BOOLEAN DEFAULT FALSE,
|
||||
art34_justification TEXT,
|
||||
reported_to_authority_at TIMESTAMPTZ,
|
||||
notified_affected_at TIMESTAMPTZ,
|
||||
closed_at TIMESTAMPTZ,
|
||||
closed_by TEXT,
|
||||
lessons_learned TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_incidents_tenant ON compliance_notfallplan_incidents(tenant_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_incidents_status ON compliance_notfallplan_incidents(status);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS compliance_notfallplan_templates (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id TEXT NOT NULL DEFAULT 'default',
|
||||
type TEXT NOT NULL DEFAULT 'art33',
|
||||
-- art33 | art34
|
||||
title TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_templates_tenant ON compliance_notfallplan_templates(tenant_id);
|
||||
45
backend-compliance/migrations/017_loeschfristen.sql
Normal file
45
backend-compliance/migrations/017_loeschfristen.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
-- Migration 017: Loeschfristen (Retention Policies)
|
||||
-- Full retention policy management with legal holds and storage locations
|
||||
|
||||
CREATE TABLE IF NOT EXISTS compliance_loeschfristen (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL DEFAULT '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e',
|
||||
policy_id TEXT, -- "LF-2026-001"
|
||||
data_object_name TEXT NOT NULL,
|
||||
description TEXT,
|
||||
affected_groups JSONB DEFAULT '[]'::jsonb,
|
||||
data_categories JSONB DEFAULT '[]'::jsonb,
|
||||
primary_purpose TEXT,
|
||||
deletion_trigger TEXT NOT NULL DEFAULT 'PURPOSE_END',
|
||||
-- PURPOSE_END | RETENTION_DRIVER | LEGAL_HOLD
|
||||
retention_driver TEXT,
|
||||
-- AO_147 | HGB_257 | USTG_14B | BGB_195 | ARBZG_16 | AGG_15 | BDSG_35 | BSIG | CUSTOM
|
||||
retention_driver_detail TEXT,
|
||||
retention_duration INTEGER,
|
||||
retention_unit TEXT, -- DAYS | MONTHS | YEARS
|
||||
retention_description TEXT,
|
||||
start_event TEXT,
|
||||
has_active_legal_hold BOOLEAN DEFAULT FALSE,
|
||||
legal_holds JSONB DEFAULT '[]'::jsonb,
|
||||
storage_locations JSONB DEFAULT '[]'::jsonb,
|
||||
deletion_method TEXT DEFAULT 'MANUAL_REVIEW_DELETE',
|
||||
deletion_method_detail TEXT,
|
||||
responsible_role TEXT,
|
||||
responsible_person TEXT,
|
||||
release_process TEXT,
|
||||
linked_vvt_activity_ids JSONB DEFAULT '[]'::jsonb,
|
||||
status TEXT NOT NULL DEFAULT 'DRAFT',
|
||||
-- DRAFT | ACTIVE | REVIEW_NEEDED | ARCHIVED
|
||||
last_review_date TIMESTAMPTZ,
|
||||
next_review_date TIMESTAMPTZ,
|
||||
review_interval TEXT DEFAULT 'ANNUAL',
|
||||
-- QUARTERLY | SEMI_ANNUAL | ANNUAL
|
||||
tags JSONB DEFAULT '[]'::jsonb,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_loeschfristen_tenant ON compliance_loeschfristen(tenant_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_loeschfristen_status ON compliance_loeschfristen(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_loeschfristen_driver ON compliance_loeschfristen(retention_driver);
|
||||
CREATE INDEX IF NOT EXISTS idx_loeschfristen_review ON compliance_loeschfristen(next_review_date) WHERE next_review_date IS NOT NULL;
|
||||
Reference in New Issue
Block a user