cadrumo.application.wizard.status module

Profile-status projection and the active-profile to TaxpayerProfile bridge.

build_wizard_status projects the active workflow state into a strict WizardStatusReport consumed by the config repair surface and the aeat config profile status command. load_active_taxpayer_profile is the typed bridge the deadline engine and the filing runtime call to obtain an TaxpayerProfile from the active profile bucket.

class WizardStatusReport(**data)[source]

Bases: BaseModel

Readiness summary for the active configuration profile.

Surfaces both the structural readiness (identity-required keys present) and the enrolment readiness (IVA regime declared) so the config repair’s profile + auth checks can render a precise next_action for a fully-addressable operator continuation. A status row carries no executable action when its next step needs new operator input or custody has made the old interactive create path unavailable.

Parameters:

data (Any)

active_profile: str | None
profile_ready: bool
identity_ready: bool
enrolment_ready: bool
missing_required: tuple[str, ...]
missing_enrolment: tuple[str, ...]
profile_present_keys: int
profile_total_keys: int
auth_provider: str
login_ready: bool
next_action: DeclaredNextAction | None
exception WizardStatusError(message=None, *, context=None, translated_message=None, precondition_verdict=None)[source]

Bases: WizardError

Raised when the wizard status projection cannot resolve the active profile.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

  • precondition_verdict (VerdictT | None)

Return type:

None

code
build_wizard_status(state, *, operation)[source]

Return the WizardStatusReport readiness for the current workflow state.

profile_ready is true only when the registry-required keys (identity) are present and, when the taxpayer shape requires IVA enrolment, the IVA regime is also present. A natural-person non-activity profile must not be blocked on a regime declaration it does not need.

Return type:

WizardStatusReport

Parameters:
load_active_taxpayer_profile(state, *, schema=None)[source]

Build an TaxpayerProfile from the active profile values.

The bridge runs the active profile record through the canonical user-profile taxpayer projection, which in turn builds the TaxpayerProfile consumed by the deadline engine and filing runtime. Values come from the profile bucket selected by the workflow state.

Parameters:
  • state (WorkflowState) – The current WorkflowState from which the active profile record is resolved.

  • schema (ProfileSchemaDefinition | None) – The profile schema supplied by the enclosing authority operation. It is required when state contains a profile record; no bundled-schema fallback is permitted.

Return type:

TaxpayerProfile

Returns:

A TaxpayerProfile populated from the active profile’s canonical answer values.

Raises:

WizardStatusError – When no profile is active or the active profile does not carry a tax.id.