from app.core.config import get_settings class OperationsDisabledError(RuntimeError): """Raised when a business mutation is attempted in read-only mode.""" def business_mutations_enabled() -> bool: """Return whether platform-owned business ledgers may be mutated.""" return not get_settings().read_only_mode def ensure_business_mutations_enabled() -> None: """Enforce read-only policy outside the HTTP transport layer.""" if not business_mutations_enabled(): raise OperationsDisabledError( "Business mutations are disabled while READ_ONLY_MODE is enabled" )