refactor: remove dead code, hollow stubs, and orphaned modules
Some checks failed
CI / branch-name (pull_request) Successful in 5s
CI / guardrail-integrity (pull_request) Failing after 7s
CI / loc-budget (pull_request) Failing after 4s
CI / secret-scan (pull_request) Failing after 6s
CI / go-lint (pull_request) Failing after 16s
CI / python-lint (pull_request) Failing after 12s
CI / nodejs-lint (pull_request) Failing after 5s
CI / nodejs-build (pull_request) Failing after 2s
CI / dep-audit (pull_request) Failing after 10s
CI / sbom-scan (pull_request) Failing after 3s
CI / test-go (pull_request) Failing after 11s
CI / test-python-backend (pull_request) Failing after 10s
CI / test-python-document-crawler (pull_request) Failing after 9s
CI / test-python-dsms-gateway (pull_request) Failing after 9s
CI / validate-canonical-controls (pull_request) Failing after 10s

Backend — delete 6 orphaned schema sub-modules never imported by any route:
  compliance/schemas/{ai_system,bsi,dashboard,isms_governance,report,service_module}.py
  All symbols were only accessible through the monolithic schemas.py barrel;
  the split files were never wired up and created misleading import paths.

Frontend — delete 2 hollow "future implementation" stub pages:
  app/sdk/agents/sessions/page.tsx
  app/sdk/agents/statistics/page.tsx
  Both showed a static placeholder with no API calls or real functionality.

Frontend — delete dead demo seed/clear API routes:
  app/api/sdk/v1/demo/{seed,clear}/route.ts
  Used a global in-memory store never connected to PostgreSQL.
  The actual demo seeding (lib/sdk/demo-data/) goes through the real
  state API (apiClient.saveState/deleteState), not these routes.

Frontend — remove unimplemented PDF export alert from retention page:
  app/sdk/einwilligungen/retention/page.tsx
  Removed the PDF button and alert('PDF-Export wird noch implementiert.')
  stub. CSV and JSON export remain fully functional.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-04-20 07:30:08 +02:00
parent f96536ebbe
commit 78e47c96bd
11 changed files with 2 additions and 1041 deletions

View File

@@ -1,52 +0,0 @@
/**
* Demo Data Clear API Endpoint
*
* Clears demo data from the storage (same mechanism as real customer data).
*/
import { NextRequest, NextResponse } from 'next/server'
// Shared store reference (same as seed endpoint)
declare global {
// eslint-disable-next-line no-var
var demoStateStore: Map<string, { state: unknown; version: number; updatedAt: Date }> | undefined
}
if (!global.demoStateStore) {
global.demoStateStore = new Map()
}
const stateStore = global.demoStateStore
export async function DELETE(request: NextRequest) {
try {
const body = await request.json()
const { tenantId = 'demo-tenant' } = body
const existed = stateStore.has(tenantId)
stateStore.delete(tenantId)
return NextResponse.json({
success: true,
message: existed
? `Demo data cleared for tenant ${tenantId}`
: `No data found for tenant ${tenantId}`,
tenantId,
existed,
})
} catch (error) {
console.error('Failed to clear demo data:', error)
return NextResponse.json(
{
success: false,
error: error instanceof Error ? error.message : 'Unknown error',
},
{ status: 500 }
)
}
}
export async function POST(request: NextRequest) {
// Also support POST for clearing (for clients that don't support DELETE)
return DELETE(request)
}

View File

@@ -1,77 +0,0 @@
/**
* Demo Data Seed API Endpoint
*
* This endpoint seeds demo data via the same storage mechanism as real customer data.
* Demo data is NOT hardcoded - it goes through the normal API/database path.
*/
import { NextRequest, NextResponse } from 'next/server'
import { generateDemoState } from '@/lib/sdk/demo-data'
// In-memory store (same as state endpoint - will be replaced with PostgreSQL)
declare global {
// eslint-disable-next-line no-var
var demoStateStore: Map<string, { state: unknown; version: number; updatedAt: Date }> | undefined
}
if (!global.demoStateStore) {
global.demoStateStore = new Map()
}
const stateStore = global.demoStateStore
export async function POST(request: NextRequest) {
try {
const body = await request.json()
const { tenantId = 'demo-tenant', userId = 'demo-user' } = body
// Generate demo state using the seed data templates
const demoState = generateDemoState(tenantId, userId)
// Store via the same mechanism as real data
const storedState = {
state: demoState,
version: 1,
updatedAt: new Date(),
}
stateStore.set(tenantId, storedState)
return NextResponse.json({
success: true,
message: `Demo data seeded for tenant ${tenantId}`,
tenantId,
version: 1,
})
} catch (error) {
console.error('Failed to seed demo data:', error)
return NextResponse.json(
{
success: false,
error: error instanceof Error ? error.message : 'Unknown error',
},
{ status: 500 }
)
}
}
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url)
const tenantId = searchParams.get('tenantId') || 'demo-tenant'
const stored = stateStore.get(tenantId)
if (!stored) {
return NextResponse.json({
hasData: false,
tenantId,
})
}
return NextResponse.json({
hasData: true,
tenantId,
version: stored.version,
updatedAt: stored.updatedAt,
})
}

View File

@@ -1,34 +0,0 @@
'use client'
import React from 'react'
import Link from 'next/link'
export default function AgentSessionsPage() {
return (
<div className="p-8 max-w-5xl">
<div className="flex items-center gap-4 mb-8">
<Link href="/sdk/agents" className="text-gray-400 hover:text-gray-600 transition-colors">
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
</svg>
</Link>
<div>
<h1 className="text-2xl font-bold text-gray-900">Agent-Sessions</h1>
<p className="text-gray-500 mt-1">Chat-Verlaeufe und Session-Management</p>
</div>
</div>
<div className="bg-white border border-gray-200 rounded-xl p-12 text-center">
<svg className="w-20 h-20 text-gray-300 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5}
d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" />
</svg>
<h2 className="text-xl font-medium text-gray-900 mb-2">Sessions-Tracking</h2>
<p className="text-gray-500 max-w-md mx-auto">
Das Session-Tracking fuer Compliance-Agenten wird in einer zukuenftigen Version implementiert.
Hier werden Chat-Verlaeufe, Antwortqualitaet und Nutzer-Feedback angezeigt.
</p>
</div>
</div>
)
}

View File

@@ -1,34 +0,0 @@
'use client'
import React from 'react'
import Link from 'next/link'
export default function AgentStatisticsPage() {
return (
<div className="p-8 max-w-5xl">
<div className="flex items-center gap-4 mb-8">
<Link href="/sdk/agents" className="text-gray-400 hover:text-gray-600 transition-colors">
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
</svg>
</Link>
<div>
<h1 className="text-2xl font-bold text-gray-900">Agent-Statistiken</h1>
<p className="text-gray-500 mt-1">Performance-Metriken und Nutzungsanalysen</p>
</div>
</div>
<div className="bg-white border border-gray-200 rounded-xl p-12 text-center">
<svg className="w-20 h-20 text-gray-300 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5}
d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
</svg>
<h2 className="text-xl font-medium text-gray-900 mb-2">Agent-Statistiken</h2>
<p className="text-gray-500 max-w-md mx-auto">
Detaillierte Statistiken wie Antwortzeiten, Erfolgsraten, haeufigste Themen und
RAG-Trefferquoten werden in einer zukuenftigen Version implementiert.
</p>
</div>
</div>
)
}

View File

@@ -274,7 +274,7 @@ function RetentionTimeline({ dataPoints, language }: RetentionTimelineProps) {
// =============================================================================
interface ExportOptionsProps {
onExport: (format: 'csv' | 'json' | 'pdf') => void
onExport: (format: 'csv' | 'json') => void
}
function ExportOptions({ onExport }: ExportOptionsProps) {
@@ -294,13 +294,6 @@ function ExportOptions({ onExport }: ExportOptionsProps) {
<Download className="w-4 h-4" />
JSON
</button>
<button
onClick={() => onExport('pdf')}
className="flex items-center gap-2 px-3 py-2 bg-indigo-600 text-white rounded-lg text-sm hover:bg-indigo-700"
>
<Download className="w-4 h-4" />
PDF
</button>
</div>
)
}
@@ -332,7 +325,7 @@ function RetentionContent() {
}, [allDataPoints, filterCategory])
// Handle export
const handleExport = (format: 'csv' | 'json' | 'pdf') => {
const handleExport = (format: 'csv' | 'json') => {
if (format === 'csv') {
const headers = ['Code', 'Name', 'Kategorie', 'Loeschfrist', 'Rechtsgrundlage']
const rows = allDataPoints.map((dp) => [
@@ -354,8 +347,6 @@ function RetentionContent() {
legalBasis: dp.legalBasis,
}))
downloadFile(JSON.stringify(data, null, 2), 'loeschfristen.json', 'application/json')
} else {
alert('PDF-Export wird noch implementiert.')
}
}