Source code for cadrumo.application.workflow._identity
"""Stable identity helpers shared by workflow state and run contracts."""from...core.periodimportPeriod
[docs]defperiod_identity_segment(period:Period)->str:"""Return the stable non-combined identity segment for ``period``. Raises: TypeError: ``period`` is not a typed :class:`~cadrumo.core.Period`. A combined token such as ``"2026Q1"`` fuses the filing year and the registry code into one opaque string, and admitting it here would mint a run or state id that nothing can decompose back into the two values the identity claims to carry. """ifnotisinstance(period,Period):raiseTypeError(f"period identity requires a typed cadrumo.core.Period, not {type(period).__name__}")returnf"{period.filing_year}:{period.registry_token}"