cadrumo.core.redaction.tax_identity_admission module¶
Host-composed admission gate for tax identities found by redaction.
Redaction scans wide and admits narrowly: a span shaped like a Spanish NIF/CIF
or a prefixed NIF-IVA is only hashed when it really is one, because the same
shapes cover ordinary operator output (SE-2026-000412, F-2026-0142, the
groups of a printed IBAN). Deciding that needs the Spanish control-character
tables and the dated per-Member-State NIF-IVA formats, which are published
registry authority this core module cannot import.
The process host binds the authority-backed gate. Without one – or when the bound gate reports that its authority is unavailable – redaction admits on lexical shape alone, which over-redacts ordinary output rather than letting a real identity through.
- class TaxIdentityAdmission(*args, **kwargs)[source]¶
Bases:
ProtocolDecide whether a normalised span is a real tax identity.
Each method returns
Nonewhen its authority cannot be consulted, so the caller applies its own fail-safe instead of treating absence as refusal.
- bind_tax_identity_admission(admission)[source]¶
Publish
admissionprocess-wide for the scope, restoring the previous gate after.Nonesuspends the gate for the scope, leaving redaction on its fallback.Process-wide rather than context-local: log records are redacted on worker threads and fresh event-loop contexts that never inherit a context variable.
- Return type:
- Parameters:
admission (TaxIdentityAdmission | None)