Source code for aeat.application.inventory._source_readiness
"""Inventory calculation-source readiness.Declares whether inventory may act as a calculation source that feeds registrybindings. Inventory is currently an application service(:class:`~application.inventory.InventoryService`) over the profile inventory;its movements and valuations are not yet persisted through the canonicalsecure-storage revision boundary, so enrolling inventory as a live calculationsource would resolve bindings against non-canonical state. Until that persistenceis hardened, inventory readiness is NOT ready and the aggregation resolver mustrefuse visibly (a blocked-readiness diagnostic) rather than resolve a silentblank.The readiness is a pure, context-independent fact: inventory is unready regardlessof the modelo or period being calculated.See Also: :class:`~application.inventory.InventoryService` Application service whose current persistence boundary keeps inventory out of the live calculation-source mesh. :mod:`~application.aggregation._source_inventory` Blocked resolver adapter that turns this readiness fact into a source-mesh diagnostic. :class:`~application.aggregation.CalculationSourceDiagnostic` Shared diagnostic carrier emitted while the source remains blocked."""from__future__importannotationsfrompydanticimportBaseModel,Fieldfrom...coreimportSTRICT_FROZEN_CONFIGINVENTORY_SOURCE_KIND="inventory"
[docs]classInventorySourceReadiness(BaseModel):"""Whether inventory is ready to act as a calculation source."""model_config=STRICT_FROZEN_CONFIGready:boolsource_kind:str=Field(min_length=1,max_length=64)reason:str=Field(min_length=1,max_length=512)
[docs]definventory_source_readiness()->InventorySourceReadiness:"""Return the current inventory calculation-source readiness. Inventory is not yet a calculation source: its movements and valuations are served by an application service over profile inventory and are not persisted through the canonical secure-storage revision boundary, so a resolver enrolled today would read non-canonical state. The surface is provisioned but blocked until inventory persistence is hardened. Returns: An :class:`~application.inventory.InventorySourceReadiness` with ``ready = False`` and the blocking reason, until inventory persistence is canonical. """returnInventorySourceReadiness(ready=False,source_kind=INVENTORY_SOURCE_KIND,reason=("inventory is not yet a calculation source: its movements and ""valuations are not persisted through the canonical secure-storage ""revision boundary"),)