Skip to content

ci: nothing detects a dead EXPORT — 87 src/ symbols have no consumer outside their own file #9852

Description

@JSONbored

What

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:

  1. A missing wire-up — the maintainability: processors.ts (16.2k lines, 437 touches) is the structural cause of this audit's drift and determinism gaps; plus a confirmed dead wire #9492 class the dead-file check exists for, one level down. An export with no caller is a feature that was built and never connected.
  2. A safety net with nothing behind it — the openapi: the route auth-parity meta-test two files are exported FOR does not exist #9851 case: exported "for the test", test never written.
  3. 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.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions