refactor: remove dead code, hollow stubs, and orphaned modules #2

Merged
sharang merged 2 commits from feat/dead-code-cleanup into main 2026-04-20 05:51:02 +00:00
Owner

Summary

  • Backend: Delete 6 orphaned schema sub-modules (ai_system, bsi, dashboard, isms_governance, report, service_module) — never imported by any route or service (confirmed via grep)
  • Frontend: Delete 2 hollow stub pages (sdk/agents/sessions, sdk/agents/statistics) that only render a "future implementation" placeholder with no wired API
  • Frontend: Delete 2 orphaned demo API routes (/api/sdk/v1/demo/seed, /api/sdk/v1/demo/clear) — never called; real seeding uses apiClient.saveState()
  • Frontend: Remove unimplemented PDF export button and alert() stub from the retention page (sdk/einwilligungen/retention)

Test plan

  • ruff check backend-compliance/ passes
  • pytest compliance/tests/ -x passes
  • npx tsc --noEmit passes in admin-compliance/
  • npm run build passes in admin-compliance/

Notes

models.py LOC violation (1643 lines, cap 500) is not fixed here — EvidenceConfidenceEnum and EvidenceTruthStatusEnum are defined inline and referenced across routes, repos, and tests. Migrating them is a separate, higher-risk PR.

## Summary - **Backend**: Delete 6 orphaned schema sub-modules (`ai_system`, `bsi`, `dashboard`, `isms_governance`, `report`, `service_module`) — never imported by any route or service (confirmed via grep) - **Frontend**: Delete 2 hollow stub pages (`sdk/agents/sessions`, `sdk/agents/statistics`) that only render a "future implementation" placeholder with no wired API - **Frontend**: Delete 2 orphaned demo API routes (`/api/sdk/v1/demo/seed`, `/api/sdk/v1/demo/clear`) — never called; real seeding uses `apiClient.saveState()` - **Frontend**: Remove unimplemented PDF export button and `alert()` stub from the retention page (`sdk/einwilligungen/retention`) ## Test plan - [ ] `ruff check backend-compliance/` passes - [ ] `pytest compliance/tests/ -x` passes - [ ] `npx tsc --noEmit` passes in `admin-compliance/` - [ ] `npm run build` passes in `admin-compliance/` ## Notes `models.py` LOC violation (1643 lines, cap 500) is **not** fixed here — `EvidenceConfidenceEnum` and `EvidenceTruthStatusEnum` are defined inline and referenced across routes, repos, and tests. Migrating them is a separate, higher-risk PR.
sharang added 1 commit 2026-04-20 05:36:20 +00:00
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
78e47c96bd
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>
sharang added 1 commit 2026-04-20 05:50:43 +00:00
fix: strip duplicate inline class definitions from db shim files
Some checks failed
CI / branch-name (pull_request) Successful in 3s
CI / guardrail-integrity (pull_request) Failing after 5s
CI / loc-budget (pull_request) Failing after 6s
CI / secret-scan (pull_request) Failing after 4s
CI / go-lint (pull_request) Failing after 2s
CI / python-lint (pull_request) Failing after 12s
CI / nodejs-lint (pull_request) Failing after 4s
CI / nodejs-build (pull_request) Failing after 3s
CI / dep-audit (pull_request) Failing after 10s
CI / sbom-scan (pull_request) Failing after 2s
CI / test-go (pull_request) Failing after 2s
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 10s
CI / validate-canonical-controls (pull_request) Failing after 10s
3702f70754
models.py and repository.py are backwards-compat re-export shims from
Phase 1. Both files still contained the original 1466/1547 line class
definitions below the re-export block. These inline definitions shadowed
the correctly-imported sub-module versions and failed at import time
because Column, AuditResultEnum, etc. were no longer in scope.

Fix:
- models.py: remove all duplicate Base-subclass definitions (lines 209-
  1581). Retain EvidenceConfidenceEnum and EvidenceTruthStatusEnum (unique
  to this shim, not yet extracted to a sub-module) and the two models that
  have no sub-module yet: LLMGenerationAuditDB and AssertionDB. Add back
  the SQLAlchemy column-type imports those two models need.
- repository.py: remove all duplicate Repository class definitions (lines
  40-1692). All classes are now fully provided by the sub-repositories.

Result: 172 pytest tests pass, import OK.
sharang merged commit 5231490ccc into main 2026-04-20 05:51:02 +00:00
Sign in to join this conversation.