Dead-code status ignores framework-driven entry points
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-commandhandle pytestfixtures,@receiver/@shared_taskdecorated 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.
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.
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.