prefer-required-prerequisite
Require complete SDK dependencies and review nullable execution prerequisites.
Why
A nullable object parameter admits calls that can fail later with ValueError when an execution path needs the object. A stored nullable SDK client or partial finite-provider registry similarly admits missing dependencies that an operation rejects. Reviewing that relationship can move prerequisites into a callable or variant contract that typed callers can check. A successful omission path can still be intentional.
Fix
Review a non-null execution helper, a required parameter when every call needs it, or overloads and typed variants using an existing discriminator. Preserve valid omission paths, side-effect order, falsy-object constraints, runtime validation and public compatibility. A non-null annotation does not validate untyped callers. Keep an explained exact-code exception for intentional boundaries or conditional protocols; splitting a helper alone may leave the wrapper's warning.
Examples
async def execute(service: Service | None = None, *, skip: bool = False): if skip: return if not service: msg = "service required for execution" raise ValueError(msg) await service.run()async def execute(service: Service): await service.run()from openai import AsyncOpenAI
class Sender: def __init__(self, endpoint: AsyncOpenAI | None): self._endpoint = endpoint
async def send(self): if self._endpoint is None: raise RuntimeError("endpoint required") return await self._endpoint.get("/ready", cast_to=str)from openai import AsyncOpenAI
class Sender: def __init__(self, endpoint: AsyncOpenAI): self._endpoint = endpoint
async def send(self): return await self._endpoint.get("/ready", cast_to=str)