cadrumo.application.cli_exception_preconditions module

Application-owned outcomes for CLI exception boundaries.

Exception boundaries observe a transport failure but must not manufacture a copy-paste command from an error string. This module gives those boundaries a small closed policy vocabulary: each condition records its observed fact and explicitly states that no executable recovery can be bound from that fact.

nested_terminal_precondition_verdict(error)[source]

Return one unambiguous registered typed verdict nested in error.

Pydantic retains exceptions raised by validators at errors()[...]["ctx"]["error"]. The shared CLI boundary cannot use the rendered validation message to recover that identity, so this traversal follows only exception-bearing structural links: Pydantic contexts and Python causal chains. Exactly one registered exception carrying a valid terminal verdict is admitted; zero or multiple candidates fail closed to the generic validation outcome.

Return type:

PreconditionVerdict | None

Parameters:

error (BaseException)

cli_exception_envelope_view(error)[source]

Return the narrow envelope-safe view for the exception producer families.

Return type:

CadrumoError

Parameters:

error (CadrumoError)

class CliExceptionPrecondition(*values)[source]

Bases: StrEnum

Closed failed-condition identities for the CLI exception slice.

VALIDATION_BOUNDARY
UNEXPECTED_BOUNDARY
STORED_DATA_VALID
COMMAND_GROUP_AVAILABLE
REFUSAL_RETRIED
CONFIG_BOUNDARY
STDIN_INTERACTIVE
LOGIN_COMPLETED
ACTIVE_BUCKET_SELECTED
ACTIVE_BUCKET_SESSION_AVAILABLE
MASTER_KEY_MATERIAL_AVAILABLE
BUCKET_SESSION_UNLOCKED
BUCKET_SESSION_FRESH
OVERVIEW_PROFILE_COMPLETE
PROFILE_EXPORT_REQUEST_COMPLETE
PROFILE_IMPORT_PATH_SUPPLIED
GOOGLE_CONFIGURATION_COMPLETE
GOOGLE_MIRROR_REQUEST_COMPLETE
LEDGER_CENSO_RATIO_CONSISTENT
LEDGER_FILTER_VALID
LEDGER_TRANSACTION_ID_RESOLVES
LEDGER_TRANSACTION_VALID
LEDGER_INVOICE_VALID
OPTIONAL_EXTRA_IMPORTABLE
EXTERNAL_CONSTANTS_SECTION_VALID
cli_exception_no_recovery_verdict(condition, *, facts, outcome=NoRecoveryOutcome.OPERATOR_DECISION)[source]

Return one explicit non-actionable outcome for an exception boundary.

The facts name what was observed, while the closed outcome prevents a CLI adapter from smuggling an unbound command template into a recovery field.

Return type:

PreconditionVerdict

Parameters: