aeat.domain.calculations.registry._validate_cross_domain_snapshot module¶
Cross-domain snapshot referential-integrity hooks.
Defines the CrossDomainSnapshotCheck protocol and the registry
used to run peer-domain checks against a RegistrySnapshot at
snapshot-build time without importing peer domains directly.
- class CrossDomainSnapshotCheck(*args, **kwargs)[source]¶
Bases:
ProtocolSnapshot-time referential-integrity check owned by a peer domain.
A peer domain (for example
aeat.domain.renta) may need to assert that the casilla ids it routes to are real casillas on a registry snapshot. The registry must not import the peer domain directly – that reverses the hexagonal dependency direction. Instead the peer domain registers aCrossDomainSnapshotCheckviaregister_cross_domain_snapshot_check(); the registry calls every registered check at snapshot-build time without naming the peer.A check receives the modelo id, the snapshot’s casilla id set, and the revision’s OWN renta first-slice ledger-aggregation binding target casillas (a strict subset of the universal routing table’s codomain – older revisions may declare no such bindings at all, so their required set is legitimately empty) and returns a list of failure strings (empty when consistent).
- register_cross_domain_snapshot_check(check)[source]¶
Register a peer-domain snapshot referential-integrity check.
Idempotent: registering the same callable twice is a no-op so a peer-domain module re-imported in a fresh interpreter (or under test reload) does not stack duplicate checks.
- Return type:
- Parameters:
check (CrossDomainSnapshotCheck)
- check_cross_domain_snapshot_routing(checker, snapshot)[source]¶
Run every registered peer-domain referential-integrity check.
The registry depends on the abstract
CrossDomainSnapshotCheckProtocol only. Concrete checks (such as the renta first-slice routing gate) are injected by their owning domain at import time viaregister_cross_domain_snapshot_check().- Parameters:
checker (
_SnapshotReferenceChecker) – Snapshot reference checker that accumulates per-prefixfailuresand exposes the casilla id set against which registered cross-domain checks evaluate routing references.snapshot (
RegistrySnapshot) – TheRegistrySnapshotto run peer-domain checks against.
- Return type:
Modelo 100 has a known-required cross-domain gate – the renta first-slice routing referential-integrity check owned by
aeat.domain.renta. That check registers itself only as an import side effect of therentapackage. Abuild_snapshotcaller that never importsrentawould otherwise validate an M100 snapshot with the gate silently absent. Rather than skip a known-required gate, fail loudly so the missing registration surfaces at snapshot build instead of as a later runtime KeyError.