cadrumo.application.preflight module¶
Workstation preflight health probes for aeat config check.
This module is the read-only doctor surface for the health dimensions that sit
beside the external-dependency probes in application.provisioning:
per-auth-provider certificate / Cl@ve Móvil configuration health, secure-storage
and bundled-corpus reachability, key configuration sanity, and portal-registry
assembly health.
Each probe answers one health question and returns a
typed PreflightCheck — it never raises; a broken dimension is report
data (an error severity row with typed facts and a precondition verdict), not an exception
path, so the doctor reports status rather than crashing on a red row.
The certificate / Cl@ve Móvil rows reuse
probe_provider_configuration() (the pure-local
per-provider probe that opens the .p12 and classifies expiry via
evaluate_loaded_certificate_health(), or
classifies the configured DNI/NIE). aeat config check renders these rows through
CheckPreflightPayload
beside the capability posture and dependency probes.
- class HealthSeverity(*values)[source]¶
Bases:
StrEnumClosed severity catalogue for a
PreflightCheckrow.OK— the dimension is healthy (or a not-configured optional provider, which is not a fault).WARN— a non-blocking advisory (a certificate inside its pre-expiry window; no master-key passphrase configured).ERROR— a real breakage the operator must fix (an expired / corrupt certificate, an unreachable storage root, a missing bundled corpus, a dangling registry reference).- OK¶
- WARN¶
- ERROR¶
- class PreflightCondition(*values)[source]¶
Bases:
StrEnumClosed failed-condition identities for workstation health probes.
- AUTH_PROVIDER_HEALTHY¶
- STORAGE_ROOT_WRITABLE¶
- CORPUS_PRESENT¶
- WINDOWS_PATH_FITS¶
- PORTAL_REGISTRY_HEALTHY¶
- class PreflightCheck(**data)[source]¶
Bases:
BaseModelOne typed workstation-preflight health row.
checkis the stable row id shown byaeat config check(e.g.auth-provider:certificate,storage:local-root,corpus:normatives).healthyis the boolean verdict andseveritygrades it.factscarries only locale-neutral observations. An unhealthy row owns one typed precondition verdict; a healthy row owns none.- Parameters:
data (Any)
- check: str¶
- healthy: bool¶
- severity: HealthSeverity¶
- facts: dict[str, str | int | bool]¶
- precondition_verdict: PreconditionVerdict | None¶
- grade_provider_probe_result(provider, result)[source]¶
Grade one
ProviderProbeResultvalue into a doctor verdict.The four declared bands partition
ProviderProbeResult: a real misconfiguration isERROR, a pre-expiry certificate isWARN, and a sound or not-configured-optional provider isOK.A value in none of them is graded
ERRORrather than passed. It reports a defect in this mapping — most likely a probe result added without a band — and not a verdict about the operator’s workstation; a doctor that renders an ungraded state green gives the one answer an operator cannot act on.- Parameters:
provider (
AuthProviderKind) – TheAuthProviderKindmember being graded.result (
ProviderProbeResult) – The probe’s typedProviderProbeResultmember.
- Return type:
- Returns:
The severity and the healthy verdict.
- probe_auth_providers(*, operator_probe_ports, settings=None)[source]¶
Probe each auth provider’s local certificate / Cl@ve Móvil configuration.
Runs the pure-local per-provider probe for every
AuthProviderKind(no network, no active-profile session) and maps its typedProviderProbeResultonto aPreflightCheck. A not-configured optional provider isOK(not a fault); an expired / corrupt / unreadable certificate or an invalid Cl@ve identity isERROR; a certificate inside its pre-expiry window isWARN. A result belonging to none of the four declared bands is itself reportedERROR, because an ungraded state rendered green is the one doctor answer an operator cannot act on. The probe never raises.- Return type:
- Parameters:
operator_probe_ports (OperatorProbePorts)
settings (Settings | None)
- probe_storage_corpus_env(*, object_path_suffix_length, settings=None)[source]¶
Probe secure-storage reachability, bundled-corpus presence, and config sanity.
Returns one
PreflightCheckper dimension: the local secure-storage root is writable (an existing ancestor accepts writes), the bundled legal-normatives and Manual-práctico corpora are present, and the deploymentSettingsloaded with a coherent master-key posture. Each probe is a read-only filesystem / configuration inspection — it never writes into the operator’s storage root and never raises.- Return type:
- Parameters:
- probe_portal_registry_health()[source]¶
Report portal-registry assembly health.
Read-only and offline: this probe never contacts AEAT. It confirms the bundled
PORTAL_REGISTRYassembled (aPortalIntegrityErrorat import is caught and reported as anerrorrow). It performs no network access and makes no claim about live portal availability or drift.- Return type:
- Returns:
One
PreflightCheckrow with idportal-registry:health.
- run_preflight_checks(*, object_path_suffix_length, operator_probe_ports, settings=None)[source]¶
Run every workstation-preflight probe and return the typed
PreflightCheckrows.Concatenates the per-auth-provider certificate / Cl@ve Móvil health rows, the secure-storage / bundled-corpus / configuration rows, and the portal-registry health / recorded-drift row. Every probe catches its own failures and reports them as
errorrows, so the aggregate never raises. The portal-drift row runs with the offline default (no recorded drift), reporting registered state rather than a live probe.- Return type:
- Parameters:
object_path_suffix_length (int)
operator_probe_ports (OperatorProbePorts)
settings (Settings | None)