Section 4.9Source:
docs/8.8_Dead_Code_Detector.mdDead Code Detection Architecture
Analysis of why entry-point ambiguity and framework runtime wiring preclude naive static graph reachability in V1, and the integration strategy with Knip.
Source:
docs/8.8_Dead_Code_Detector.mdThe Entry Point & Framework Wiring Problem
The naive approach to dead code detection suggests walking forward from "entry points" and flagging unreachable nodes as dead. However, in modern JavaScript/TypeScript ecosystems:
- No universal entry point: Next.js uses file-system routes (
app/page.tsx), Express registers routes at runtime (router.get("/path", controller)), and libraries expose exported functions. - Framework runtime wiring: Symbols are invoked by framework runtimes without static in-repo
CALLSedges. Naive reachability produces high rates of false positives.
V1 Architecture Decision: No False Positives
CodeGraph's graph is a structural fact graph. To avoid misleading engineers by flagging active framework code as dead, dead code detection is designated for external specialized tooling (such asKnip) rather than speculative native heuristics.