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,
})
}