cadrumo.adapters.outbound.aeat.auth._clave_movil_salvage module¶
Post-failure session-salvage mixin for the Cl@ve Móvil auth provider.
A fresh Cl@ve Móvil login is a human-in-the-loop, single-use second factor: once the operator approves the phone prompt, AEAT will not reissue a fresh challenge for the same identity until the pending request expires or is explicitly cancelled. When the browser driver fails after that approval — a navigation error on the representation dialogue, a landing wait that times out on an already-processed approval — closing the context unread would throw away the approval the operator already gave and force a second, avoidable Cl@ve prompt.
_ClaveMovilSessionSalvageMixin supplies the best-effort repair:
persist whatever authenticated state the failing context holds before it is
torn down, so the next resume attempt can probe it rather than starting a
fresh login outright. This is safety code, not an optimisation — its
behaviour must not change when moved, only its module.