Skip to content

Task 20: Code Cleanup Audit — Post-POC Housekeeping

Priority: P4 (very low — post-demo, post-GA hygiene) Effort: ~1 hour total, broken into 3 risk tiers Owner: TBD Prerequisite: P1 POC demo signoff Created: 2026-04-16

Purpose

Inventory of dead / vestigial code surfaced by the post-P1.4 survey. None of these items affect functionality — this is pure noise reduction before long-term maintenance handover. Do not execute before the POC demo is accepted; if a reviewer finds a broken feature, having the dead scaffolding around can shorten the blame trail.

Tier 1 — Safe Deletions (zero imports)

Confirmed via repo-wide grep. These can be deleted without further investigation.

Item Path Reason
Superseded registration form app/frontend/src/components/organizations/RegistrationForm.tsx Replaced by MultiStepRegistrationForm.tsx; no page imports it
Dev scaffolding controller app/backend/src/shared/controllers/vnf-sdk-test.controller.ts Early-POC debugging endpoints; never called by the frontend and superseded by cih-api.service.ts
Mock stats stub getOrganizationStats() in app/frontend/src/services/superadmin-organization.service.ts Returns hardcoded zeros, comment admits "would typically come from an API endpoint" — never invoked
Mock stats stub getUserStats() in app/frontend/src/services/company-admin-user.service.ts Same pattern — zero callers
Unused composition helper getCredentialTypesByCategory() in app/frontend/src/services/credential-types.service.ts Wraps two working endpoints; no consumer

Tier 2 — Likely-Safe (double-check before delete)

Have either suspicious imports or infra wiring that needs a second pass.

Item Path Action
Email tracking infrastructure app/backend/src/shared/controllers/email-tracking.controller.ts Wired in SharedModule but the email service never invokes tracking endpoints. Either delete or wire it up as part of P2 analytics work
Stale template seeder app/backend/src/admin/scripts/initialize-email-templates.ts Auto-runs at org creation and seeds templates with unrendered {{credentialTypeName}} placeholders — this caused the subject-line bug spotted during P1.4 email smoke test. Replace with properly rendered defaults or remove entirely once production templates are authored
Deprecated wrappers suspendUser() / reactivateUser() in app/frontend/src/services/company-admin-user.service.ts Already annotated @deprecated; delete once caller migration verified

Tier 3 — Check DB Before Removal

Item Action
UserRole.ADMIN and UserRole.STAFFING_COMPANY in app/backend/src/users/enums/user-role.enum.ts Annotated @deprecated with migration notes (→ PLATFORM_ADMIN, → ORG_ADMIN/ORG_USER). Run SELECT DISTINCT role FROM users in prod + staging; if either value appears, run a migration first, then remove

Patterns Observed (no action required)

  • /docs/requirements/tasks/POC/*reclaim*.md and *phase2*.md: parked documentation with zero code references. Docs can stay as decision history; nothing to strip.
  • No batch-upload / disclosure / verification controllers exist yet: good — nothing to prune for MVP scope compliance.
  • VNF SDK service still carries comments referencing the old MockVCLProvider; the mock itself is gone (replaced during P1.2.4). Comments can be reworded in a later style-pass but aren't misleading.

Execution Order (when scheduled)

  1. Tier 1 in a single commit (~15 min) — reduces noise significantly
  2. Tier 2 individually, each with a smoke test of the affected flow (~30 min)
  3. Tier 3 behind a DB audit script (~15 min plus migration if needed)

Total ~1 hour. Target a sprint cycle after any compliance / feature work stabilizes — cleanup PRs are easy to get merged during low-churn weeks.

References

  • Inventory produced by code-survey agent on 2026-04-16 against commit prior to P1.5 verification.
  • Survey scope: app/backend/src/**/controllers/**, app/backend/src/**/services/**, app/frontend/src/components/**, app/frontend/src/pages/**, app/frontend/src/services/**.