aeat.application.storage_write_policy module¶
Runtime write-policy decisions for operator command dispatch.
The CLI root asks inspect_storage_write_policy() before opening
profile-bound storage. The returned StorageWritePolicyDecision
combines the matched StorageWritePolicyCode with the
StorageRouteKind derived from
Settings.
This module is the application-side policy query, not the session opener.
It classifies the dispatched verb path, honours bootstrap-exempt CLI
surfaces, delegates stub-only Modelo work-create refusals to the leaf
handler, and refuses profile-bound mutations when storage is routed to the
root fallback database or to an explicit AEAT_DATABASE_URL. A stale
settings object with a valid active-profile pointer is reclassified through
settings_for_active_profile_bucket() so the root
callback sees the same active-bucket route the storage runtime would use.
See also
aeat.entrypoints.cliRoot command callback that reconstructs verb paths, consults this policy, and opens active bucket sessions only after the policy allows dispatch.
aeat.entrypoints.cli._bootstrap_exempt.is_bootstrap_exempt()Supplies the sessionless bootstrap flag passed into
inspect_storage_write_policy().aeat.core.config.classify_storage_route()Produces the
StorageRouteClassificationinspected for guarded mutation paths.aeat.core.storage_route_guidance.EXPLICIT_DATABASE_URL_PROFILE_RECOVERYOperator recovery text attached to explicit database URL refusals.
- class StorageWritePolicyCode(*values)[source]¶
Bases:
StrEnumMachine-readable outcomes from the root write-policy query.
The values distinguish allowed active-bucket writes, read-only or bootstrap-exempt paths, leaf-owned refusals, and the two route-level denials the CLI root must stop before opening profile storage. Each value is carried in the
codefield ofStorageWritePolicyDecision, returned frominspect_storage_write_policy().- ALLOWED_ACTIVE_BUCKET¶
- BOOTSTRAP_EXEMPT¶
- LEAF_REFUSAL_DELEGATED¶
- NON_PROFILE_BOUND_VERB¶
- NO_VERB_PATH¶
- REFUSED_ROOT_FALLBACK¶
- REFUSED_EXPLICIT_DATABASE_URL¶
- class StorageWritePolicyDecision(**data)[source]¶
Bases:
BaseModelDecision returned by the backend storage write-policy query.
The CLI root converts refusing decisions into
CliRefusedBoundaryErrorinstances; allowed decisions let dispatch continue toward the active-bucket session opener.- Variables:
allowed – Whether root dispatch may continue.
code – The
StorageWritePolicyCodethat determined the result.profile_bound_write – Whether the verb path matched the guarded profile-bound mutation catalogue.
bootstrap_exempt – Whether the CLI root classified the invocation as bootstrap-exempt before policy inspection.
route_kind – Effective
StorageRouteKindfor guarded writes, orNonewhen no route was inspected.message_key – Locale key for a refusal message rendered at the CLI boundary.
detail_message_key – Optional nested detail key for the refusal message.
recovery_hint – Structured operator recovery hint for the error envelope.
- Parameters:
allowed (bool)
code (StorageWritePolicyCode)
profile_bound_write (bool)
bootstrap_exempt (bool)
route_kind (StorageRouteKind | None)
message_key (str)
detail_message_key (str)
recovery_hint (str)
- allowed: bool¶
- code: StorageWritePolicyCode¶
- profile_bound_write: bool¶
- bootstrap_exempt: bool¶
- route_kind: StorageRouteKind | None¶
- message_key: str¶
- detail_message_key: str¶
- recovery_hint: str¶
- PROFILE_BOUND_WRITE_VERB_PATHS: tuple[str, ...]¶
Profile-bound mutation verb prefixes guarded by the root write policy.
is_profile_bound_write_verb_path()matches this catalog by prefix after the CLI root reconstructs the Typer verb path. The catalog is separate fromBOOTSTRAP_EXEMPT_VERB_PATHS: bootstrap-exempt verbs skip the active-session gate, while these prefixes identify commands that must be routed through an active profile bucket before they can mutate profile-bound storage.
- inspect_storage_write_policy(verb_path, *, bootstrap_exempt, settings=None, argv_tokens=None)[source]¶
Return whether
verb_pathmay perform profile-bound writes.Bootstrap-exempt and non-profile-bound paths are allowed without route inspection. Guarded mutation paths are allowed only when the effective storage route is an active bucket; root fallback and explicit database routes return refusing
StorageWritePolicyDecisionvalues before the CLI opens a bucket session. The effective route comes fromStorageRouteClassificationso root dispatch does not duplicate storage-routing logic.See also
PROFILE_BOUND_WRITE_VERB_PATHSGuarded mutation catalog consulted by this policy query.
is_bootstrap_exempt()Source of the
bootstrap_exemptinput from the CLI root.is_profile_bound_write_verb_path()Prefix matcher used before route classification.
- is_profile_bound_write_verb_path(verb_path)[source]¶
Return whether
verb_pathnames a profile-bound mutation surface.Matching is prefix-based against
PROFILE_BOUND_WRITE_VERB_PATHSso positional arguments appended by Click/Typer reconstruction do not hide a guarded operator command.