You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scripts/check-dead-source-files.ts catches a dead file. Its own header says what it does not catch:
DELIBERATELY NARROW. This is not a general dead-code/knip-style analysis (no re-export chasing, no detection of a file that's imported but whose EXPORTS are all unused)
That gap is populated. Indexing every identifier across src, packages, test, scripts and apps/loopover-ui/src, then comparing each export const / export function against its own file's internal reference count, 87 exported symbols in src/ alone have no reference anywhere outside the file that declares them — including their own tests.
Spot-checked, each referenced only within its declaring file:
symbol
file
renderScreenshot
src/review/visual/shot.ts
buildPublicQualityMetrics
src/services/public-quality-metrics.ts
extractReviewSummary
src/review/unified-comment.ts
enqueueVerifiedWebhook
src/github/webhook.ts
shouldRedactKey + 8 siblings
src/selfhost/redaction-scrub.ts
Two of these were how #9851 was found: ORB_AND_CONTROL_ROUTE_SPECS and INTERNAL_AND_PUBLIC_ROUTE_SPECS are exported for a meta-test that does not exist.
Why it matters
Each one is one of three things, and today nothing tells them apart:
Genuinely dead — stale surface that still has to be read, typechecked and maintained.
Coverage does not catch any of them: the declaring file's own tests exercise the symbol directly and report green while it contributes nothing to the running system.
Scope
Extend the existing check (or add a sibling) to flag an exported runtime symbol with no reference outside its declaring file. Same shape and conventions as check-dead-source-files.ts, wired into test:ci.
Handle the legitimate exceptions the same way that check already does — an allowlist entry with a one-line reason, not a blanket exemption: a package's deliberate public API (@loopover/contract exports schemas for consumers outside this repo), and symbols exported purely so a test can reach them (which the check should distinguish, since "referenced only by its own test" is a different and weaker signal than "referenced by nothing").
Triage the 87 in the same PR or a fast follow: each is wire-it-up, write-the-missing-test, or delete. Filing the count without resolving it just moves the debt.
Acceptance
Adding an export that nothing consumes fails CI, and the current 87 are each resolved or explicitly justified.
Note
Derived from a repo-wide sweep; the reference index counts identifiers, so a symbol reached only through a namespace import or a dynamic string would be a false positive. The triage step is where that gets settled per symbol — the check itself should prefer a false positive with a cheap allowlist line over silence.
What
scripts/check-dead-source-files.tscatches a dead file. Its own header says what it does not catch:That gap is populated. Indexing every identifier across
src,packages,test,scriptsandapps/loopover-ui/src, then comparing eachexport const/export functionagainst its own file's internal reference count, 87 exported symbols insrc/alone have no reference anywhere outside the file that declares them — including their own tests.Spot-checked, each referenced only within its declaring file:
renderScreenshotsrc/review/visual/shot.tsbuildPublicQualityMetricssrc/services/public-quality-metrics.tsextractReviewSummarysrc/review/unified-comment.tsenqueueVerifiedWebhooksrc/github/webhook.tsshouldRedactKey+ 8 siblingssrc/selfhost/redaction-scrub.tsTwo of these were how #9851 was found:
ORB_AND_CONTROL_ROUTE_SPECSandINTERNAL_AND_PUBLIC_ROUTE_SPECSare exported for a meta-test that does not exist.Why it matters
Each one is one of three things, and today nothing tells them apart:
Coverage does not catch any of them: the declaring file's own tests exercise the symbol directly and report green while it contributes nothing to the running system.
Scope
check-dead-source-files.ts, wired intotest:ci.@loopover/contractexports schemas for consumers outside this repo), and symbols exported purely so a test can reach them (which the check should distinguish, since "referenced only by its own test" is a different and weaker signal than "referenced by nothing").Acceptance
Adding an export that nothing consumes fails CI, and the current 87 are each resolved or explicitly justified.
Note
Derived from a repo-wide sweep; the reference index counts identifiers, so a symbol reached only through a namespace import or a dynamic string would be a false positive. The triage step is where that gets settled per symbol — the check itself should prefer a false positive with a cheap allowlist line over silence.