aeat.core.wizard_catalogue module

Canonical registry slot for the wizard-flow catalogue.

Domain modules that need to inspect SETUP_FLOW or WIZARD_FLOWS import from here, never from application.wizard._catalogue. This module is the core slot that holds already-built descriptors; it does not build wizard sections, render prompts, compile profile keys, persist answers, or own the core.setup_answers typed answer model.

The application layer registers the concrete descriptors at startup via register_wizard_catalogue(). Until registration, the accessors get_setup_flow() and get_wizard_flows() raise WizardCatalogueNotRegisteredError so any premature domain access surfaces immediately rather than silently falling back to an upward dependency.

The protocol this module defines (WizardFlowProtocol) is satisfied by application.wizard._models.WizardFlow. Domain code depends only on the structural slot and the accessor functions; the concrete descriptor class stays owned by the application wizard package.

exception WizardCatalogueNotRegisteredError[source]

Bases: CoreError

Raised when a domain consumer accesses the catalogue before registration.

Return type:

None

code: ClassVar[ErrorCode]
exception WizardCatalogueAlreadyRegisteredError(message=None, *, context=None, suggestion=None, translated_message=None)[source]

Bases: CoreError

Raised when register_wizard_catalogue() receives different objects after registration.

Parameters:
  • message (str | None)

  • context (dict[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
class WizardFlowProtocol(*args, **kwargs)[source]

Bases: Protocol

Structural type satisfied by WizardFlow descriptors.

The protocol captures the smallest attribute core consumers need for diagnostics. Accessors still return the concrete descriptor object, but domain code reaches it through this core slot and never imports the application-layer WizardFlow class directly.

property id: str

The canonical flow identifier (e.g. "setup").

register_wizard_catalogue(setup_flow, wizard_flows)[source]

Register the concrete wizard-flow descriptors from the application layer.

Call this exactly once at application startup (e.g. in the application.wizard._catalogue module body, after the SETUP_FLOW / WIZARD_FLOWS constants are built).

Calling with identical objects a second time is a no-op. Calling with different objects raises WizardCatalogueAlreadyRegisteredError to prevent accidental re-registration from a different source. The function stores object identity only; it does not copy, validate, or normalise the application-owned descriptors.

Return type:

None

Parameters:
get_setup_flow()[source]

Return the registered SETUP_FLOW descriptor.

Return type:

Any

Returns:

The concrete SETUP_FLOW descriptor registered by the application layer. Callers should treat it as the canonical setup-flow descriptor and should not import application.wizard._catalogue as a fallback.

Raises:

WizardCatalogueNotRegisteredError – When the application layer has not yet called register_wizard_catalogue().

get_wizard_flows()[source]

Return the registered WIZARD_FLOWS tuple.

Return type:

tuple[Any, ...]

Returns:

Tuple of concrete wizard-flow descriptors registered by the application layer. The tuple identity is preserved so downstream consumers inspect the same catalogue object the application registered.

Raises:

WizardCatalogueNotRegisteredError – When the application layer has not yet called register_wizard_catalogue().