Skip to content

False dead-code classifications from unresolved cross-directory calls #2177

Description

@ivanstanev

Summary

Symbols with real production callers are classified dead-unresolved / dead-leaf, because the calls that reference them are dropped by the typed-receiver confidence bug. On a 2,995-file NestJS backend, 4,675 symbols were classified dead; a deliberately conservative check (only this.<prop>.<method>() sites where <prop> has a declared type owning that method) confirmed at least 28 false positives with production callers.

Examples

symbol classified dead actual production caller
AnalyticsService.trackSystemEvent (src/core/analytics/analytics-service.ts:141) src/ai/ai-analysis/ai-analysis-job.service.ts
AnalyticsService.anonymizeUser (:189) src/main/deletion/deletion.service.ts
DynamoDBClientService.putItem / updateItem / deleteItem src/main/customer-api/utils/customer-api-credentials-dal.service.ts
PipelineSchedulesService.createOrUpdatePipelineSchedule (+3 more) src/main/jobs/jobs.internal.controller.ts
ClickhouseService.isConfigured src/db-sync/db-sync/db-sync-job/clickhouse-db-sync-job.ts
AIAnalysisTrackingService.findExistingJob src/ai/ai-analysis/ai-analysis-job.service.ts
SnowflakeAIRolesUtilsService.deleteOrganizationAIRole src/main/deletion/deletion.service.ts

Every one is a cross-directory call at distance ≥3 — i.e. downstream fallout of the typed-receiver confidence bug, not an independent defect in the role classifier.

28 is a floor, not an estimate: the detector only inspects type-annotated this.prop.method() receivers and ignores the 3,774 dead-unresolved symbols reachable by other call shapes.

Why this matters beyond the count

This repo's own .claude/hooks/pre-commit.sh blocks commits on dead exports. False dead-code reports therefore turn into spurious commit failures and push developers toward deleting live code.

Fix

Should be largely resolved by fixing the typed-receiver confidence bug. This issue tracks re-measuring the false-positive rate afterwards and adding a regression test that asserts a symbol called only from >2 directories away is not classified dead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions