aeat.application.modelo._registry_helpers module¶
Registry lookup and casilla validation helpers for modelo actions.
The helper layer resolves
RegistrySnapshot instances through
aeat.application.modelo._registry_resources, validates
operator/imported casilla maps against the selected
ModeloRevision, and refuses
non-canonical printed-number tokens before the calculation engine or
persistence layer sees them.
It also verifies stored CalculationRevision
payloads by re-deriving their content-addressed identifiers and checking
CasillaObservation/value consistency
before stored payloads are trusted by verification or filing workflows.
See also
aeat.application.modelo._registry_resources.authority_via_resources()Central registry authority loader used by snapshot-backed guards.
validate_casilla_input_ids()Boundary validator for operator-supplied casilla maps.
assert_revision_content_integrity()Read-side guard for stored calculation revision drift.
- reject_incomplete_amendment_casillas(*, modelo, filing_year, period, casilla_values)[source]¶
Mirror the verify-modelo-revision required-manual gate on amend.
The supplied
Periodselects theRegistrySnapshotused to read required manual casillas. Missing required manual casillas raiseAmendmentVerificationRefusedErrorbefore an amendment can be accepted as complete.
- validate_casilla_input_ids(revision, casilla_inputs)[source]¶
Validate operator-supplied numeric input casillas against the revision.
The
ModeloRevisionsupplies the declared casilla ids, data types, and non-canonical reference targets used to reject ambiguous or malformed operator input. The returned mapping is keyed by canonicalCasillaIdvalues and contains onlyDecimalnumeric inputs that the registry engine may consume.- Return type:
- Parameters:
revision (ModeloRevision)
casilla_inputs (Mapping)
- reject_unknown_override_casillas(*, modelo, filing_year, period, overrides)[source]¶
Refuse amendment override casillas outside the resolved revision.
Keys are canonicalised as
CasillaIdvalues and checked against theRegistrySnapshotselected bymodelo,filing_year, andPeriod. Printed-number aliases and ambiguous reused numbers raiseAmendmentOverrideCasillaErrorinstead of being projected to a declared casilla.
- reject_unknown_import_casillas(*, modelo, filing_year, period, casilla_values)[source]¶
Validate imported casilla ids and return the resolved registry snapshot.
The snapshot is a
RegistrySnapshot. The returned mapping is keyed by canonicalCasillaIdvalues declared by the selectedModeloRevision. Unknown, malformed, and non-canonical printed numbers raiseExternalModeloImportErrorso imported AEAT values enter observation projection only under registry ids.
- required_input_casilla_ids_for_revision(*, modelo, filing_year, period)[source]¶
Resolve required manual and replayable input casilla ids for a revision.
Returns
Nonewhen the registry root orRegistrySnapshotcannot be loaded. The first tuple contains required manual casillas from the selectedModeloRevision; the second contains declared manual, bound, and computedCasillaIdvalues that amendment/import paths may need to carry through replay.
- verification_predicates_for_revision(*, modelo, filing_year, period)[source]¶
Return verification predicate rows for the selected revision.
The rows are
VerificationPredicateDefinitioninstances. Missing registry roots or unresolvedRegistrySnapshotinstances produce an empty tuple so callers can degrade to their existing verification paths.
- assert_revision_content_integrity(revision)[source]¶
Check revision integrity; raise stored-calculation drift on mismatch.
The supplied
CalculationRevisionis re-hashed from its persisted inputs, bindings, relations, casilla values, and source metadata before its provenance observations are compared withcasilla_values. This is a defense-in-depth read-side check for raw storage corruption that bypassed normal model construction; a mismatched observation envelope raisesStoredCalculationDriftErrorbefore the revision is treated as authoritative.- Return type:
- Parameters:
revision (CalculationRevision)