cadrumo.adapters.persistence.storage.runtime_readiness module¶
Secure-storage runtime readiness vocabulary.
The typed answer to “why can this process not serve profile-bound storage”,
and the refusal that carries it. Separated from runtime because the
two have different dependency shapes: the runtime INSPECTS the process –
settings, routes, the live bucket session – while this vocabulary is a closed
enum, three frozen records, and one error builder over nothing but
core and the storage error hierarchy.
That difference is what makes the split load-bearing rather than cosmetic.
SecureObjectRepository re-checks
session freshness on every operation and must raise the same refusal the
runtime raises, so it needs this vocabulary – but it emphatically does not
need the runtime aggregate, and the runtime constructs the repository. Holding
both in one module made that a genuine cycle, which was hidden rather than
removed by a deferred function-local import at each end. A deferred import
postpones a cycle: it survives as an evaluation-order hazard that surfaces as
a partially-initialised module the moment an unrelated edit reorders imports.
With the vocabulary in its own module both sides import it eagerly, at the seam where the dependency genuinely is, and the cycle is gone rather than deferred.
- class StorageRuntimeReadinessCode(*values)[source]¶
Bases:
StrEnumMachine-readable secure-storage runtime readiness states.
- READY¶
- NO_ACTIVE_SESSION¶
- SESSION_SEALED¶
- SESSION_EXPIRED¶
- ROUTE_NOT_ACTIVE_BUCKET¶
- ROUTE_BUCKET_MISMATCH¶
- SESSION_CHANGED¶
- class StorageRuntimeReadinessIssue(**data)[source]¶
Bases:
BaseModelOne reason the runtime is not ready for profile-bound storage.
- Parameters:
data (Any)
- code: StorageRuntimeReadinessCode¶
- class StorageRuntimeSession(**data)[source]¶
Bases:
BaseModelKey-material-free projection of the active bucket session.
- Parameters:
data (Any)
- active: bool¶
- idle_deadline: datetime¶
- sealed: bool¶
- expired: bool¶
- class StorageRuntimeReadiness(**data)[source]¶
Bases:
BaseModelProfile-bound storage readiness result.
- Parameters:
data (Any)
- ready: bool¶
- code: StorageRuntimeReadinessCode¶
- issues: tuple[StorageRuntimeReadinessIssue, ...]¶
- readiness_issue(*, code)[source]¶
Return one typed readiness issue for
code.- Return type:
- Parameters:
code (StorageRuntimeReadinessCode)
- readiness_error(readiness)[source]¶
Project typed readiness facts into the registered storage refusal.
The refusal is locale-neutral: the operator-facing sentence comes from the translated message key, and the codes travel as structured context so a caller can tell WHICH unready state it met without parsing prose.
- Return type:
- Parameters:
readiness (StorageRuntimeReadiness)
- runtime_not_ready_error(code)[source]¶
Build a locale-neutral storage-runtime readiness failure for one code.
- Return type:
- Parameters:
code (StorageRuntimeReadinessCode)