docs: add CLEANUP_REPORT.md for dead-code sweep

Documents the confirmed-dead deletions from e0bcf9d, plus an important
process note: the first attempt at this task was interrupted mid-run
and left an unverified, incorrect mass-deletion staged (117 files
including live routed pages/category, pages/search, pages/info/**,
pages/legal/**) which was reverted before commit. Root cause: knip has
a confirmed false-positive blind spot on this codebase's locale-nested
component pattern under pages/**. Flagged for future cleanup passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sdarbinyan
2026-07-25 18:39:49 +04:00
parent e0bcf9dfb8
commit d7f69b272a

33
docs/CLEANUP_REPORT.md Normal file
View File

@@ -0,0 +1,33 @@
# Cleanup Report
App-wide dead-code sweep: dead components/services/routes/CSS, duplicate models/interfaces, unused imports/variables/assets/icons/SCSS/directories/modules. Business logic untouched — deletion only, no refactoring. One commit on branch `B2B` (not pushed): `e0bcf9d`.
## Important note on process
The first attempt at this task was interrupted mid-run (hit a usage-limit cutoff) and left an **uncommitted, unverified mass-deletion staged**: 117 files, ~11,373 lines, including `pages/category`, `pages/search`, `pages/info/**`, `pages/legal/**`, `pages/item-detail` — all real, live, routed storefront pages (category/search were fixed for accessibility/skeleton bugs earlier in this same work cycle). This was caught before commit and fully reverted (`git restore`) — verified clean via `tsc --noEmit` afterward. The retry used a stricter standard: every deletion candidate had to be manually verified against `app.routes.ts`/DI registries/cross-repo grep before deletion, not just trusted from a dead-code tool's raw output, and every batch was build-verified immediately rather than at the end.
**Root cause**: `knip` repeatedly flagged the entire `pages/category`/`pages/search`/`pages/info/**`/`pages/legal/**`/`pages/item-detail` tree as unused, both times it was run. This is a confirmed **false-positive blind spot** in this codebase — likely the locale-nested component pattern (`xxx-en.component.ts` under an `en/` subfolder, loaded via a runtime locale switch rather than a static import knip can trace) combined with lazy `loadComponent` route bindings. Anyone running `knip` on this repo in the future should cross-check its `pages/**` output against `app.routes.ts` before trusting it — it is not reliable for this specific pattern.
## Deleted (26 files, `e0bcf9d`)
| Category | What | Verification evidence |
|---|---|---|
| Auth | `core/auth/guards/ed25519-auth.guard.ts`, `permission.guard.ts`, `core/auth/interceptors/auth.interceptor.ts` | `ed25519AuthGuard` appears only inside a doc-comment in `admin-login-page.component.ts`; `authInterceptor` absent from `app.config.ts`'s `withInterceptors([...])`; neither imported anywhere else. |
| Search | `features/search/services/search-analytics.service.ts`, `features/search/components/empty-results/*` | `SearchAnalyticsService` has zero importers; `app-search-empty-results` selector unused — `search-bar.component.html` implements its own inline `@if (noResults)` empty state instead. |
| Content management | `features/content-management/pages/content-management-page.component.ts` | Thin wrapper around `StaticPagesEditorComponent`, zero route in `app.routes.ts`. Rest of `content-management/*` (facade, static-pages-editor, page-editor) kept — used by `project-editor`. |
| Backoffice scaffolding | `features/backoffice/{categories,customers,inventory,orders,products,settings}`, `features/backoffice/shared/backoffice-coming-soon-page.component.*` | Re-verified `docs/UI-COMPOSITION-REVIEW.md`'s claim independently: `app.routes.ts` backoffice section only loads `features/admin/*` and `features/backoffice/media`. Each of the 6 deleted dirs contained **only a placeholder `.gitkeep`** from the original scaffold commit — never real components. The prior audit's "duplicate implementation" framing was itself stale; corrected here. |
| Shared barrels/models | `shared/index.ts`, `shared/models/index.ts`, `shared/types/index.ts`, `shared/models/domain/**` (incl. `user-preferences.model.ts`) | Unused barrels/model, zero importers. |
| Orphaned page | `pages/public/platform-home.component.ts` | No route, no import anywhere — distinct from the routed `pages/category` etc. that were correctly left alone. |
| Mock data | `assets/mock/backoffice/{customers,orders}/list.json` | Orphaned — `BackofficeDataProvider` only exposes `loadProducts()`/`loadCategories()`. |
## Flagged, NOT deleted (verified as false positives or out of scope)
- **`pages/category`, `pages/search`, `pages/info/**`, `pages/legal/**`, `pages/item-detail`** — knip's recurring false-positive (see Root cause above). All confirmed live and routed. **Note**: `docs/STORE_REVIEW.md` had previously flagged `item-detail` specifically as "confirmed dead code (unrouted)" during RC STORE-01 — that assessment needs re-verification against `app.routes.ts` given this tool's now-confirmed blind spot on this exact directory pattern; not re-checked in this pass, flagged for the next person touching that area.
- **`SearchHistoryService`** — knip flagged it, but it's actively injected in `search.facade.ts`. Another confirmed false positive.
- **`primeng`/`primeicons`/`barry-cache`** — knip flagged as unused dependencies. Not verified further here; `primeng`/`primeicons` removal is already tracked in `docs/KNOWN-ISSUES.md` (item 12) blocked on an unrelated `npm uninstall` failure. `barry-cache` is the repo's own memory tooling, out of scope for a dead-code pass regardless.
- **123 "unused exports/types" flagged by knip** — left alone. This is TypeScript interface/type surface cleanup, not dead files; a different, lower-risk category that wasn't prioritized in this pass given the tool's demonstrated unreliability here — recommend manual review, not knip's raw list, if pursued later.
- **5 branding SVGs** (`mastercard-logo.min.svg`, `dexar-logo*.svg`, `dexar-favicon.svg`, `novo-logo.svg`, `novo-favicon.svg`) — flagged in `docs/PERFORMANCE_REPORT.md` as possibly backend/tenant-driven, not statically referenced. Not touched, per that report's own caution.
## Verification
`tsc --noEmit` clean after every deletion batch (not just at the end — batches were verified incrementally so a bad deletion could be isolated and reverted immediately rather than debugged after the fact). `npm run build` green (only the pre-existing bundle-budget warning). `npm run arch:check:boundaries` and `arch:check:cycles` both pass (435 files processed, no circular dependencies). Working tree clean aside from the pre-existing unrelated `docs/backend/REMAINING-BACKEND-WORK.md` modification, untouched.