aeat.application.user_profile._commands module

Pydantic command and result contracts for the user-profile boundary.

These classes were previously declared at the body of aeat.application.user_profile’s __init__.py. Pydantic v2 resolves field types at class-creation time, so declaring them at the package boundary forced an eager import of aeat.domain.user_profile (which pulls the full registry via its _registry_contract companion) for every consumer that touched the boundary — including the state-free CLI surfaces that must never pay the registry cost.

Relocating the classes here lets the boundary re-export them through its PEP 562 __getattr__ block, deferring the domain-record import to first reference rather than boundary-import time. The public surface is unchanged: every name remains reachable via aeat.application.user_profile.<name> because the boundary’s __getattr__ resolves to this module on demand.

class RegisterProfileCommand(**data)[source]

Bases: BaseModel

Register a new active profile root in the secure DB backend.

Parameters:
  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • display_name (str)

  • facts (tuple[UserProfileFact, ...])

profile_id: ProfileId
display_name: str
facts: tuple[UserProfileFact, ...]
class EditProfileFieldCommand(**data)[source]

Bases: BaseModel

Upsert one effective-dated profile fact.

Parameters:
  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • path (str)

  • value (UserProfileFactValue)

  • valid_from (date | None)

  • valid_to (date | None)

  • source (str)

profile_id: ProfileId
path: str
value: UserProfileFactValue
valid_from: date | None
valid_to: date | None
source: str
class EditProfileSectionCommand(**data)[source]

Bases: BaseModel

Bulk-upsert every fact in one schema section.

Parameters:
  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • section_key (str)

  • facts (tuple[UserProfileFact, ...])

  • source (str)

profile_id: ProfileId
section_key: str
facts: tuple[UserProfileFact, ...]
source: str
class RemoveProfileCommand(**data)[source]

Bases: BaseModel

Tombstone the live profile root (immutable filing snapshots are retained).

Parameters:

profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

profile_id: ProfileId
class ReactivateProfileCommand(**data)[source]

Bases: BaseModel

Restore a tombstoned profile root to active status.

The symmetric inverse of RemoveProfileCommand: reverses a soft tombstone that never progressed to hard directory removal.

Parameters:

profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

profile_id: ProfileId
class DuplicateProfileCommand(**data)[source]

Bases: BaseModel

Copy an existing profile under a new id and display name.

Parameters:
  • source_profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • target_profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • target_display_name (str)

source_profile_id: ProfileId
target_profile_id: ProfileId
target_display_name: str
class RenameProfileCommand(**data)[source]

Bases: BaseModel

Update a live profile’s display label.

Profile identity is an immutable UUID, so a rename is a pure label edit: the live record’s display_name is updated and the record is re-saved under the same secure-object key. There is no directory move, no re-key, and no rollback machinery. The orchestration layer updates the parallel copy of the label in the plaintext bucket manifest.

Parameters:
  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • target_display_name (str)

profile_id: ProfileId
target_display_name: str
class ProfileLifecycleResult(**data)[source]

Bases: BaseModel

Result of a lifecycle mutation (register / edit / remove / duplicate).

Variables:
  • profile – The mutated UserProfileRecord.

  • applied_at – The timestamp when the mutation was applied.

Parameters:
profile: UserProfileRecord
applied_at: datetime
class ProfileListing(**data)[source]

Bases: BaseModel

One row of a profile-listing result.

Parameters:
  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • display_name (str)

  • status (UserProfileStatus)

  • created_at (datetime)

  • updated_at (datetime)

profile_id: ProfileId
display_name: str
status: UserProfileStatus
created_at: datetime
updated_at: datetime
class ProfileListResult(**data)[source]

Bases: BaseModel

Frozen tuple of profile listings returned by list_profiles.

Parameters:

profiles (tuple[ProfileListing, ...])

profiles: tuple[ProfileListing, ...]
class ProfileValidationIssue(**data)[source]

Bases: BaseModel

One validation finding raised against a profile snapshot.

Parameters:
severity: _BaseSeverity
code: str
path: str | None
message: str
class ProfileValidationReport(**data)[source]

Bases: BaseModel

Aggregate validation report for a profile or a registration command.

Parameters:
  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • schema_version (int)

  • issues (tuple[ProfileValidationIssue, ...])

profile_id: ProfileId
schema_version: int
issues: tuple[ProfileValidationIssue, ...]
class ProfilePreflightRequirement(**data)[source]

Bases: BaseModel

One required-but-missing profile selector for a modelo / revision.

Parameters:
  • selector (str)

  • section_key (str)

  • field_key (str)

selector: str
section_key: str
field_key: str
class ProfilePreflightReport(**data)[source]

Bases: BaseModel

Per-(modelo, revision, filing_year, period) profile readiness report.

Parameters:
  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • modelo (str)

  • revision_id (str)

  • filing_year (int)

  • period (Period)

  • missing (tuple[ProfilePreflightRequirement, ...])

  • ready (bool)

profile_id: ProfileId
modelo: str
revision_id: str
filing_year: int
period: Period
missing: tuple[ProfilePreflightRequirement, ...]
ready: bool
class ProfileSnapshotRequest(**data)[source]

Bases: BaseModel

Request an immutable filing-time snapshot of one profile.

Parameters:
  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • modelo (str)

  • revision_id (str)

  • filing_year (int)

  • period (Period)

profile_id: ProfileId
modelo: str
revision_id: str
filing_year: int
period: Period
class ProfileSnapshot(**data)[source]

Bases: BaseModel

Immutable filing-time snapshot of one profile’s projection.

Parameters:
  • snapshot_id (str)

  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • schema_version (int)

  • modelo (str)

  • revision_id (str)

  • filing_year (int)

  • period (Period)

  • canonical_hash (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=64), MaxLen(max_length=64), _PydanticGeneralMetadata(pattern='^[0-9a-f]{64}$')])])

  • created_at (datetime)

  • facts (tuple[UserProfileFact, ...])

snapshot_id: str
profile_id: ProfileId
schema_version: int
modelo: str
revision_id: str
filing_year: int
period: Period
canonical_hash: _ProfileSnapshotHash
created_at: datetime
facts: tuple[UserProfileFact, ...]
class ProfileStaleCheckReport(**data)[source]

Bases: BaseModel

Result of checking a draft’s stored snapshot against the current projection.

Parameters:
  • snapshot_id (str)

  • profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])

  • stored_hash (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=64), MaxLen(max_length=64), _PydanticGeneralMetadata(pattern='^[0-9a-f]{64}$')])])

  • current_hash (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=64), MaxLen(max_length=64), _PydanticGeneralMetadata(pattern='^[0-9a-f]{64}$')])])

  • stale (bool)

snapshot_id: str
profile_id: ProfileId
stored_hash: _ProfileSnapshotHash
current_hash: _ProfileSnapshotHash
stale: bool
class ProfileImportResult(**data)[source]

Bases: BaseModel

Outcome of importing a portable bundle.

Variables:
  • profile – The imported UserProfileRecord.

  • imported_at – The timestamp of import.

  • issues – Any validation issues.

Parameters:
profile: UserProfileRecord
imported_at: datetime
issues: tuple[ProfileValidationIssue, ...]