codebase-memory-mcp icon indicating copy to clipboard operation
codebase-memory-mcp copied to clipboard

Dead-code status ignores framework-driven entry points

Open avigdorsky opened this issue 2 months ago • 2 comments

Severity: high — the feature is unusable as shipped.

359 nodes get status: "dead"; 247 (69%) are reachable only dynamically:

  • ASGI/WSGI middleware __call__ for classes listed in a settings module
  • __init__ of classes instantiated via a registry or DI
  • alembic upgrade/downgrade, Django management-command handle
  • pytest fixtures, @receiver / @shared_task decorated functions

Ask: a configurable liveness list (dunder methods, decorator patterns, declarative registrations) — and, more fundamentally, do not derive dead from a call graph whose own measured precision is 52%. Reporting unknown when the graph is unresolved would be honest and far more useful than a false negative.


Observed on v0.10.8 (build 996bad5fe6fb), macOS arm64, Python monorepo (~36k nodes / ~179k edges). Happy to provide a minimal reproduction repo if useful.

avigdorsky avatar Sep 09 '26 07:09 avigdorsky

Adding one more framework-dispatch pattern to the list, not yet mentioned: Pydantic @model_validator.

from pydantic import BaseModel, model_validator

class Spec(BaseModel):
    start: str
    end: str

    @model_validator(mode="after")
    def _window_is_ordered(self) -> "Spec":
        if self.end <= self.start:
            raise ValueError("end must be after start")
        return self

_window_is_ordered is only ever invoked by Pydantic's own validation machinery when a Spec is constructed — there's no user-code call site to create a CALLS edge from. Flagged status: "dead" regardless.

Confirmed on v0.10.8, same project as my comment on #1642. This is the same "declarative registration" bucket you already called out for @receiver/@shared_task — Pydantic validators (and I'd guess @field_validator, @validator, dataclass __post_init__) belong in the same liveness-exclusion list, or under the unknown classification you proposed rather than a hard dead.

bhaveshpatelapple avatar Sep 14 '26 23:09 bhaveshpatelapple

Thank you for the framework entry-point examples and the additional Pydantic validator case. The distinction between absent static callers and proven dead code is central here. The liveness/unknown classification policy still needs review; there is no verified resolution yet.

DeusData avatar Oct 19 '26 22:10 DeusData