Skip to content

Dead code: remove unused entries (3 commits) - #26

Open
Avithegod2010 wants to merge 3 commits into
security/audit-2026-11from
code-audit/Notes-printifier
Open

Avithegod2010 wants to merge 3 commits into
security/audit-2026-11from
code-audit/Notes-printifier

Conversation

@Avithegod2010

Copy link
Copy Markdown
Owner

Dead-code removal found by a per-repo audit thread (free model) and verified against this repo's own checks.

Commits:

  • abee7b0 chore(dead-code): remove three unreferenced exports in live modules
  • efeb952 chore(dead-code): remove orphaned HAS_SERVER_API module
  • 589fe73 chore(dead-code): remove 30 unreferenced shadcn/ui scaffolding files

Per-repo report (removed / kept-with-reason / verification):

  • removed: 34 entries, 3781 lines - whole files: 30 unreferenced shadcn/ui/hook files (src/components/ui/{alert-dialog,aspect-ratio,avatar,breadcrumb,calendar,card,carousel,checkbox,context-menu,drawer,dropdown-menu,form,hover-card,input-otp,menubar,navigation-menu,pagination,resizable,scroll-area,sidebar,sonner,table,tabs,textarea,toggle-group,separator,skeleton,toggle,tooltip}.tsx plus src/hooks/use-mobile.ts; the last 5 were cascading orphans whose only importers were the removed sidebar/toggle-group); src/lib/server-api.ts (HAS_SERVER_API, orphaned by inline copies in 8 consumers); unreferenced exports useCanInstall (install-prompt.tsx), buildErasedOverlay (filters.ts, superseded by buildErasedOverlayPixels + worker preview), OcrLang (ocr.ts). Three commits: 589fe73 (files), efeb952 (module), abee7b0 (symbols).
  • kept (reason): 23 - compose-worker.ts/filter-worker.ts (loaded via new Worker(new URL('./…', import.meta.url))); android/res/values/{strings,styles}.xml (manifest @string/app_name, @style/AppTheme); 6 Tesseract .traineddata.gz files (guj,kan,mal,ori,pan,tel) loaded via langPath + UI <SelectItem> codes; 2 PDF.js LICENSE_* notices (legal artifacts, not code); 11 scripts/*.ts absent from package.json (standalone CLI entry points runnable via bun <path> — absence from scripts is not proof of being dead). Also left alone: unused Radix/embla/vaul/etc. dependencies (hard rule forbids dependency changes) and orphaned --sidebar-* CSS theme tokens (minimum-edit rule).
  • verified with: case-sensitive repo-wide scans over every tracked file (import graph, exported-symbol and basename/asset scans; config/JSON/YAML/manifest/tests included) proving each removed name had zero live references; node node_modules/typescript/bin/tsc --noEmit --incremental false (exit 0 before and after); bun test per unit file (filters 8/8, ink-stats 11/11, rate-limit 7/7, ssrf-guard 37/37, version 5/5, ai-access 32/32; savings, recipe-link and settings-validate each had the same pre-existing 5s done-callback timeout flake on one test at baseline and after, never a new failure); git diff --check clean. tests/api/routes.test.ts hung >180s at baseline (network/DB), so it was not used as a gate. Branch code-audit/Notes-printifier from security/audit-2026-11 at 019ae83; nothing pushed.

Proof: a repo-wide import scan of every tracked file (case-sensitive, incl.
config/tests/manifests) found zero importers for these 25 UI components; the
other 5 (separator, skeleton, toggle, tooltip, use-mobile) were imported only
by two of the removed files (sidebar/toggle-group), so they orphan in the same
group. Apparent hits were unrelated: CSS theme tokens (--card, --sidebar-*),
lucide CalendarRange icon, 'report card' prose, document.createElement('textarea'),
and the local ui/toaster's Toaster (not sonner's). compose-worker/filter-worker
were NOT removed - they are loaded via new Worker(new URL(...)) at runtime.
src/lib/server-api.ts exported HAS_SERVER_API but had zero importers: every
consumer (doctor-card, listen-button, presets-card, printifier-app,
stats-strip, upload-step, voice-bar, printify-store) declares its own inline
const for build-time constant folding. Repo-wide case-sensitive search found
the name only in those inline declarations and in comments explaining why the
shared export is NOT imported; no test, config, route table or dynamic import
references it. It is not an entry point.
- useCanInstall (install-prompt.tsx): zero callers; comment said 'kept for
  future mobile-menu placement'. InstallButton uses the same module-scope
  subscribe/canInstall store directly, so the import stays needed.
- buildErasedOverlay (filters.ts): DOM data-URL wrapper around
  buildErasedOverlayPixels; no caller. The preview path uses the pixel core
  directly in filter-preview-core/filter-worker, so this is the orphaned
  predecessor implementation.
- OcrLang (ocr.ts): exported string-literal type, never imported; callers use
  string[]/FilterSettings['ocrLangs'].

Proved by case-sensitive repo-wide search over all tracked files: each name's
only occurrence was its own definition.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant