"""Fixed backend composition and finite private FULL loaders.""" from __future__ import annotations from enum import StrEnum from typing import TYPE_CHECKING if TYPE_CHECKING: from sinetti_operator.registration import OperatorRegistration class Distribution(StrEnum): FULL = "full" CUSTOMER = "customer" _DISTRIBUTION = Distribution.FULL def distribution() -> Distribution: """Code, never mutable runtime configuration, selects this installation.""" return _DISTRIBUTION def load_full_registration() -> OperatorRegistration: if distribution() is not Distribution.FULL: raise RuntimeError("customer distribution is unavailable pending operation and import closure") try: from sinetti_operator.registration import full_registration except ModuleNotFoundError as exc: if exc.name in {"sinetti_operator", "sinetti_operator.registration"}: raise RuntimeError("full distribution requires sinetti_operator.registration") from exc raise return full_registration() def load_full_profile_registry(): if distribution() is not Distribution.FULL: raise RuntimeError("customer distribution cannot load the private FULL profile registry") try: from sinetti_operator.pathway_results import full_profile_registry except ModuleNotFoundError as exc: if exc.name in {"sinetti_operator", "sinetti_operator.pathway_results"}: raise RuntimeError( "full distribution requires sinetti_operator.pathway_results") from exc raise return full_profile_registry() # Material harmonisation has no loader here any more (SIN-0887): every consumer reads # sinetti_services.materials_source, which picks the live provider or the customer results per call. def load_full_cert_format_validation(): """Load the operator-only certificate-format classifiers for FULL schemas.""" if distribution() is not Distribution.FULL: raise RuntimeError( "customer distribution cannot load private certificate-format validation" ) try: from sinetti_services.cert_format_copy import ( triage_for_bucket, work_kind_for_bucket, ) except ModuleNotFoundError as exc: if exc.name in {"sinetti_services", "sinetti_services.cert_format_copy"}: raise RuntimeError( "full distribution requires sinetti_services.cert_format_copy" ) from exc raise return triage_for_bucket, work_kind_for_bucket