cadrumo.adapters.outbound.aeat.sede.declarations_observations module

Filed-declaration observation and registry interpretation helpers.

The Sede capture path resolves a RegistrySnapshot through ValidatedRegistryAuthority, interprets its ModeloRevision, and materialises filed rows as provenance-bearing CasillaObservation records.

See also

capture_observation()

Browser capture surface that produces filed-declaration observations.

registry_observation_from_filed_declaration()

Conversion boundary from Sede observations to registry observations.

published_layout_source_payloads(*, snapshot, operation)[source]

Return the embedded source bytes the resolved layout’s parser reads.

Citation-only sources such as the record design stay in the layout’s source_refs and in every casilla’s provenance; their bytes are never requested because a published generation does not hold them.

Raises:
  • RegistryValidationError – The layout cites a source the snapshot does not catalogue, or an XML dictionary layout has no embedded dictionary.

  • LookupError – The generation lacks bytes for a source the contract embeds.

Parameters:
Return type:

Mapping[str, bytes]

Core types: RegistrySnapshot.

Return type:

Mapping[str, bytes]

Parameters:
observed_header_facts_from_submitted_file(*, snapshot, body, operation)[source]

Return the header facts AEAT states in the submitted fichero, with provenance.

The disposition is one of these. AEAT models the tipo de declaración as a header field in its diseño de registro, the export layout models it as a header, and the parser returns it as a header – the only place it stopped being a header was this module, which read parsed.casillas and discarded parsed.fields entirely. The code was already in the bytes and already decoded before being dropped.

Deliberately NOT projected as an ObservedCasillaValue. A header is not a casilla, and the boxes AEAT prints for these elections are absent from the record design precisely because AEAT encodes them here instead; giving them a synthetic casilla id would put this registry and the official structure in disagreement about the concept’s kind.

This is the canonical projection and it is TYPED. Each fact carries the export parser’s own source_locator alongside the token, because a bare key -> value pair cannot answer where the value was read from, and a header fact that reaches persisted evidence without its record-design position is not auditable back to the bytes. Returns an empty tuple rather than raising when the payload cannot be parsed against the layout. The casilla projection is the caller’s primary result and reports its own failure loudly; a header read that fails must not take the casillas down with it. A registry that cannot resolve the layout or its source bytes is a different failure and raises, so it never reads as a fichero without headers.

Core types: RegistrySnapshot.

Return type:

tuple[ObservedHeaderFact, ...]

Parameters:
observed_casillas_from_submitted_file(*, snapshot, declaration, body, artefact, operation)[source]

Read the casilla values a submitted fichero actually carries.

Core types: RegistrySnapshot.

Return type:

tuple[ObservedCasillaValue, ...]

Parameters:
non_numeric_observed_casillas(observation, *, operation)[source]

Return every casilla the Decimal-only registry channel cannot carry.

Returns an empty tuple when every observed casilla is readable as an amount. A non-empty tuple enumerates the casillas that are not: a declared kind that is not numeric, or a numeric casilla whose token will not parse.

Caller-opt-in: this is a query, not a step in enrolment. It performs no side effects and can be called before or after registry_observation_from_filed_declaration(), so a caller with an operator surface can report the gap while a caller without one is unaffected and unchanged.

Rows carry no value, deliberately – see ObservedCasillaSkip.

Return type:

tuple[ObservedCasillaSkip, ...]

Parameters:
registry_observation_from_filed_declaration(observation, *, operation)[source]

Convert a filed-declaration observation into registry observation rows.

The FiledDeclaracionObservation is checked against the selected RegistrySnapshot; each accepted ObservedCasillaValue becomes a provenance-bearing CasillaObservation inside the returned RegistryModeloObservation.

Return type:

RegistryModeloObservation

Parameters: