"""# Summary Shared pipeline ports — the contracts every pipeline family reuses. A port is an abstract stage contract. Concrete families pin their implementations on a root's annotated slots; the DI library instantiates the tree. """ from abc import ABC, abstractmethod from typing import Any class FinalizePort(ABC): """Terminal stage — turn normalized records into persisted resources.""" @abstractmethod async def finalize(self, records: list[dict[str, Any]]) -> list[Any]: """Persist records and return the created resources.""" class RegistryPort(ABC): """Resolve a pattern / rule fragment by key.""" @abstractmethod def resolve(self, key: str) -> dict[str, Any]: """Return the fragment registered under ``key``."""