cadrumo.application.profile_preconditions module

Application-owned profile and taxpayer precondition verdicts.

The shared CLI boundary observes profile-selection, session, and filing facts, but it does not decide what those facts mean. This module owns that policy: each failed condition becomes a strict PreconditionVerdict referencing one canonical operator action or an explicit no-recovery outcome.

The records contain no localized text and no executable CLI strings. Human rendering and live command-schema projection remain entrypoint concerns.

class ProfilePreconditionCondition(*values)[source]

Bases: StrEnum

Stable identities for shared profile and taxpayer preconditions.

ACTIVE_PROFILE_AVAILABLE
PROFILE_SELECTION_NONBLANK
PROFILE_SELECTION_KNOWN
PROFILE_SELECTION_UNAMBIGUOUS
PROFILE_SELECTION_LIVE
PROFILE_TARGET_NOT_SELECTED
SESSION_LOGGED_IN
SESSION_CURRENT
SESSION_SCHEMA_CURRENT
SESSION_WELL_FORMED
SESSION_INTEGRITY_VALID
TAX_ID_DECLARED
FORMER_PRODUCT_STATE_ABSENT
class ProfilePreconditionEvidence(*values)[source]

Bases: StrEnum

Stable evidence identities emitted by profile precondition policy.

ACTIVE_PROFILE_STATE
PROFILE_SELECTION
PROFILE_SESSION
TAXPAYER_IDENTITY
FORMER_PRODUCT_STATE
class ProfileSelectionFailure(*values)[source]

Bases: StrEnum

Application meanings for failed profile selection facts.

BLANK
UNKNOWN
AMBIGUOUS
INACTIVE
class FormerProductDetectionScope(*values)[source]

Bases: StrEnum

Where refusal-only former-product state was detected.

ROOT_PROFILE_NORMALISATION
STARTUP
inspect_active_profile_precondition(*, active_profile_present, registered_profile_count)[source]

Return the recovery verdict when no active profile is selected.

Return type:

PreconditionVerdict | None

Parameters:
  • active_profile_present (bool)

  • registered_profile_count (int)

inspect_filing_taxpayer_identity_precondition(*, declared_tax_id, profile_name)[source]

Return the profile-edit verdict when filing identity is undeclared.

Return type:

PreconditionVerdict | None

Parameters:
  • declared_tax_id (str)

  • profile_name (str | None)

profile_deletion_requires_logout_verdict(*, requested_profile)[source]

Return the outcome for deleting the profile that is currently selected.

Deletion refuses its own selected target, and closing that session is a separate operation the operator already owns. Naming it on the action channel is what lets an automated operator recover without parsing prose.

Return type:

PreconditionVerdict

Parameters:

requested_profile (str)

profile_selection_failure_verdict(failure, *, requested_profile, lifecycle_status=None)[source]

Return the canonical outcome for one failed profile selection.

Return type:

PreconditionVerdict

Parameters:
profile_session_failure_verdict(reason, *, profile_name)[source]

Return the login action for one fail-closed session-resume outcome.

Return type:

PreconditionVerdict

Parameters:
former_product_state_verdict(scope)[source]

Return the safety refusal for state Cadrumo deliberately cannot adopt.

Return type:

PreconditionVerdict

Parameters:

scope (FormerProductDetectionScope)