aeat.application.workflow._profile_bucket_scan module¶
Manifest-scan discovery for profile bucket pointers.
A profile bucket lives at <aeat-root>/buckets/<profile-id>/ where
<profile-id> is the immutable UUIDv4 profile identity. The
plaintext manifest.toml inside carries that bucket_id (the
UUID) and a decoupled mutable label (the operator-chosen display
name). The bucket directory name and the profile identity are one and
the same; the operator never sees the UUID and addresses profiles by
their label.
This module exposes the scanner that enumerates profile buckets by
reading those plaintext manifests. It never opens the encrypted
database engine. read_profile_bucket resolves an operator label to
a bucket pointer (UUID + label); list_profile_buckets returns every
registered pointer keyed by UUID.
The manifest carries a plaintext status lifecycle marker. The
live-surface resolvers — read_profile_bucket and, by default,
list_profile_buckets — exclude tombstoned profiles so a deleted
profile never leaks into list / switch / name-uniqueness. The
by-id resolver read_profile_bucket_by_id resolves a profile
regardless of status: surfaces that legitimately inspect a tombstoned
profile (show, diagnostics) address it by UUID.
See also
ProfileBucketPointerPublic pointer record returned by the manifest scanners.
application.workflow._profile_healthConsumes by-id manifest lookup to classify active-profile readiness.
BucketManifestPlaintext manifest shape parsed from each profile bucket directory.
BucketLifecycleStatusLifecycle marker used to hide tombstoned profiles from live surfaces.
application.user_profile._orchestrationOwns profile creation, selection, and encrypted profile-record access around the same bucket identity.
- class ProfileBucketScanIssue(bucket_id, reason)[source]¶
Bases:
objectOne bucket manifest skipped by the live profile scanner.
- read_profile_bucket(label, *, root=None, include_tombstoned=False)[source]¶
Return the bucket pointer for the profile whose label is
label.Scans every
<root>/buckets/*/manifest.tomland matches the manifestlabelagainstlabelcase-insensitively. Returns aProfileBucketPointercarrying the UUIDbucket_id, the manifestlabel, and the lifecyclestatuswhen exactly one profile matches; returnsNonewhen no profile carries the label.By default tombstoned profiles are excluded: a deleted profile is off the live surface, so its label resolves to
None(re-usable) and it can never be switched into. Theshowinspect surface passesinclude_tombstoned=Trueso an operator can still inspect a deleted profile by name and see its tombstoned status; it then branches on the returnedstatus.- Parameters:
label (
str) – Operator-facing profile label. Must be non-empty.root (
Path|None) – Optional AEAT root override. WhenNone, resolvesSettings.aeat_local_storage_rootviaload_settings.include_tombstoned (
bool) – WhenTrue, a tombstoned profile is also a candidate; defaultFalsematches only live profiles.
- Return type:
- Returns:
A
ProfileBucketPointerfor the matching profile, orNonewhen no profile carries the label.- Raises:
ProfileLabelAmbiguousError – when two or more matching profiles share the label (an ambiguous resolution the name-uniqueness guard should have prevented among live profiles).
- read_profile_bucket_by_id(profile_id, *, root=None)[source]¶
Return the
ProfileBucketPointerfor the profile whose UUID isprofile_id.Resolves
<root>/buckets/<profile_id>/manifest.tomldirectly. ReturnsNonewhen the manifest is absent. Resolves a profile regardless of lifecycle status - a tombstoned profile is still addressable by its UUID soshowand diagnostics can inspect it; the returned pointer carries the manifeststatusso the caller can branch on it.- Return type:
- Parameters:
- resolve_profile_bucket(identifier, *, root=None, include_tombstoned=False)[source]¶
Resolve a profile identifier that may be a UUID bucket id OR a display label.
The active-profile precedence chain (
AEAT_ACTIVE_PROFILEenv var, theactive-profilepointer file) and operator input both carry whichever identifier the operator knows. An operator addresses a profile by the label they chose atprofile create— they never see the immutable UUIDv4 bucket id — soAEAT_ACTIVE_PROFILE=<label>is a natural, intended operator action. Resolving the value as a UUID bucket directory only would hard-miss on a label (buckets/<label>does not exist), refusing every profile-scoped command with a “no manifest” error.This resolver tries the UUID-direct lookup first (the canonical bucket directory key), then falls back to the manifest-scan-by-label. The same lifecycle filter applies to both paths: by default tombstoned profiles are hidden from live surfaces whether the operator supplies a UUID or a label. A label is unique among live profiles (the name-uniqueness guard), so the fallback is unambiguous. Returns
Nonewhen the identifier matches neither a live bucket UUID nor a live profile label.- Parameters:
identifier (
str) – A profile UUID bucket id or an operator display label.root (
Path|None) – Optional AEAT root override. WhenNone, resolvesSettings.aeat_local_storage_rootviaload_settings.include_tombstoned (
bool) – WhenTrue, inspect surfaces can resolve a deleted profile by UUID or name; defaultFalsematches only live profiles.
- Return type:
- Returns:
A
ProfileBucketPointerfor the resolved profile, orNone.
- list_profile_buckets(*, root=None, include_tombstoned=False)[source]¶
Return registered profile-bucket pointers keyed by profile UUID.
Scans
<root>/buckets/*/manifest.tomlfor every directory that carries a manifest file, parses each manifest, and returns a pointer carrying the manifestbucket_id(UUID),label(operator name), andstatuslifecycle marker. Directories without a manifest are treated as torn or pre-provisioned state and skipped.By default only live (non-tombstoned) profiles are returned: a tombstoned profile has left the live operator surface. Pass
include_tombstoned=Trueto enumerate every registered profile — used by repair / audit surfaces that must see deleted profiles.- Parameters:
- Return type:
- Returns:
A dict mapping each profile UUID to its
ProfileBucketPointer.
- list_profile_bucket_scan_issues(*, root=None)[source]¶
Return non-sensitive manifest-scan issues found under the profile root.
Each element is a
ProfileBucketScanIssuedescribing one structural problem found in the profile bucket directories.- Return type:
- Parameters:
root (Path | None)