feat: find_dead_symbols — confidence-tiered dead/test-only-code detector with reason codes #24
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
h-dv/code-index#24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rank 3 of the 2026-07-20 index-data brainstorm (
_prdoc/records/brainstorm-2026-07-20-index-data-catalog.md). Four of six lenses independently converged here.What: dead-code detector whose PRODUCT is the reason trail, not the raw list: each candidate labeled with why it survived suppression (dyn-dispatch trait impl, std-trait name,
#[tool]/framework handler, method-call ambiguity, alias-qualified miss) or why it's believed dead. Includes the compiler-invisible "test-only prod code" class (prod symbols kept alive solely by test refs, via roles bit 32).Why: naive
ref_count=0is worthless — 1,413 hits, 1.6% precision. The validated suppression cascade lands on exactly 4 genuinely dead symbols in this repo (all four deleted in v0.5.19 after grep verification:Writer::upsert_file/apply_stat_touch/delete_path,span_of). Test-only class: 90 raw → 41 true findings incl.open_in_memory(pub API, all uses inside#[cfg(test)]).Caveat baked in:
roles_is_zerois referenced only inside a#[serde(skip_serializing_if)]attribute STRING — ref-based analysis alone MUST NOT claim "safe to delete"; the FTS pass (see safe_delete issue) is the verification step.Cost: small — SQL cascade over existing columns + one FTS pass; no new data.
Triage: P2 — candidate discovery, not deletion authority
Keep this issue, but narrow its contract to
dead_symbol_candidates. It should rank suspicious dead/test-only symbols with reason codes and suppression evidence, then direct the agent tosafe_deletefor per-symbol verification.Do not emit a repository-wide “safe to delete” list: reflection, framework registration, serialization/configuration strings, generated code, and unresolved dispatch make that claim indefensible. Reuse the production-ready text-evidence semantics from #25; text hits are evidence, not proven runtime uses.
Recommended acceptance addition: every candidate carries visibility, production/test inbound counts, unresolved-name risk, text occurrence files, resolution confidence, and the exact next preflight call.