aeat.application.user_profile._aggregate module

The whole-profile in-memory aggregate.

A logical profile is not one record. It is, concretely, a bucket directory on disk, a plaintext manifest.toml, an encrypted UserProfileRecord row in a per-bucket SQLite table, an append-only bucket-event history, and the active-profile pointer. Historically no object owned that set; every operation wrote whichever stores it remembered and consistency was by convention.

ProfileAggregate is the single in-memory object that holds a profile’s whole state: its immutable UUID identity, its mutable operator-facing label, the manifest-derived metadata, the secure UserProfileRecord, and its lifecycle status. Application code loads and saves the aggregate; ProfileRepository is the sole writer of the physical stores it projects onto.

class ProfileAggregate(**data)[source]

Bases: BaseModel

The whole logical profile as one strict, frozen in-memory object.

The aggregate carries every store the logical profile fragments across:

  • profile_id — the immutable UUIDv4 identity. The bucket directory, the secure-object key, and the active-profile pointer all key on it.

  • label — the operator-chosen display name. Mutable; carried both in the manifest and the secure record.

  • manifest fields (created_at, kdf_params, recovery_enrolled, manifest_schema_version) — the plaintext bucket-metadata projection.

  • record — the encrypted UserProfileRecord.

  • status — the lifecycle status, mirrored from the record so consumers can read it without unwrapping record.

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)])

  • label (str)

  • created_at (datetime)

  • kdf_params (ManifestKdfParams)

  • recovery_enrolled (bool)

  • manifest_schema_version (int)

  • record (UserProfileRecord)

  • status (UserProfileStatus)

profile_id: _ProfileId
label: str
created_at: datetime
kdf_params: ManifestKdfParams
recovery_enrolled: bool
manifest_schema_version: int
record: UserProfileRecord
status: UserProfileStatus