aeat.application.user_profile._keys_validation module

PROFILE_KEYS-driven validation projection used by the CLI status surface.

The wizard catalogue (application/wizard/_catalogue.py) declares each WizardQuestion.profile_key as a canonical schema-TOML path (e.g. identity.tax_id, preferences.output_language). compile_profile_keys produces PROFILE_KEYS as a tuple of ProfileKey records keyed by those canonical paths. The helpers in this module project a flat operator-supplied Mapping[str, str] over that registry and report which required keys are missing or set so the CLI status surface can render a deterministic readiness summary.

These helpers are intentionally projection-only: they do not read or write secure storage, do not touch WorkflowState, and do not depend on any CLI state. The flat-dict input is produced by application.user_profile.record_to_values() or by the wizard runner’s canonical projection.

class ProfileValidationResult(**data)[source]

Bases: BaseModel

Typed result of validate_profile_values().

Parameters:
valid: bool
missing_required: tuple[str, ...]
present_required: tuple[str, ...]
present_optional: tuple[str, ...]
unknown_keys: tuple[str, ...]
present_keys: int
total_keys: int
class ProfileValueRow(**data)[source]

Bases: BaseModel

One schema-backed profile value row for CLI/API display.

Parameters:
key: str
value: str | None
is_set: bool
requirement: ProfileKeyRequirement
description: str
validate_profile_values(values)[source]

Validate values against PROFILE_KEYS.

values is keyed by canonical schema path (identity.tax_id, preferences.output_language etc.).

Returns a ProfileValidationResult.

Return type:

ProfileValidationResult

Parameters:

values (Mapping[str, str])

list_profile_key_records()[source]

Return the full PROFILE_KEYS tuple in registry order.

Each element is a ProfileKey describing one profile field.

Return type:

tuple[ProfileKey, ...]

list_profile_value_rows(values, *, include_unset=False)[source]

Return schema-backed ProfileValueRow entries for display surfaces.

Return type:

tuple[ProfileValueRow, ...]

Parameters: