aeat.application.modelo._borrador_binding module

Application-owned borrador binding resolution.

The CLI may parse a snapshot id, but the decision to consume values from a captured borrador belongs here: the application layer checks the work-unit axis, snapshot state, registry eligibility, and precedence against caller-supplied binding overrides before the calculation engine receives any values. Eligibility is determined by inspecting the RegistrySnapshot for the "borrador" capability declaration.

Only modelos that declare the "borrador" capability in their registry manifest are eligible. Adding support for a new modelo requires only a TOML edit — no code change.

See also

aeat.application.modelo._binding_resolution.resolve_borrador_source_tier()

Binding-resolution tier that inserts this resolver before backend mesh and caller-value overlay.

aeat.application.aggregation._source_mesh.CalculationSourceResolution

Typed source-resolution envelope carrying the resolved borrador values.

aeat.application.aggregation._source_mesh.BorradorSourceProvenance

Snapshot id and sourced-binding trace persisted onto the calculation revision.

aeat.application.live._borrador_100.Borrador100SnapshotRepository

Secure snapshot repository used to load the explicitly selected borrador capture.

exception Modelo100BorradorBindingError(message=None, *, context=None, suggestion=None, translated_message=None)[source]

Bases: ModeloError

Raised when borrador values cannot be consumed for a calculation.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
class Modelo100BorradorBindingCommand(**data)[source]

Bases: BaseModel

Command contract for resolving one optional borrador snapshot.

The typed Period and bucket/modelo axes are checked against both the selected RegistrySnapshot and the loaded live borrador snapshot before any binding values are emitted.

Parameters:
  • bucket_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=128, pattern=None, ascii_only=None)])

  • modelo (str)

  • filing_year (int)

  • period (Period)

  • borrador_snapshot_id (str | None)

  • caller_binding_values (Mapping[BindingId, Decimal])

  • caller_enum_binding_values (Mapping[BindingId, str])

bucket_id: BucketId
modelo: str
filing_year: int
period: Period
borrador_snapshot_id: str | None
caller_binding_values: Mapping[BindingId, Decimal]
caller_enum_binding_values: Mapping[BindingId, str]
resolve_modelo_100_borrador_bindings(command, *, registry_snapshot, snapshot_repository=None)[source]

Resolve eligible borrador values into a CalculationSourceResolution for one Modelo 100 calculation.

Parameters:
Return type:

CalculationSourceResolution

The function is deliberately inert when no snapshot is supplied: borrador values are never consumed implicitly. When a snapshot is supplied, caller values take precedence and the snapshot may only contribute bindings explicitly marked aeat_prefilled by the registry revision passed to the service.

Return type:

CalculationSourceResolution

Returns:

A CalculationSourceResolution with owned_sources set to borrador and, when values participate, typed BorradorSourceProvenance plus generic CalculationSourceProvenance rows for each sourced binding.

Parameters:
class Modelo100BorradorSourceResolver(*, borrador_snapshot_id, caller_binding_values, caller_enum_binding_values, registry_snapshot=None, snapshot_repository=None)[source]

Bases: object

Source mesh adapter for explicitly selected Modelo 100 borrador snapshots.

The adapter lets the general source mesh call resolve_modelo_100_borrador_bindings() with a CalculationSourceContext. When no RegistrySnapshot was supplied at construction, the context selects one from the registry authority.

Parameters:
resolver_id
owned_sources: tuple[BindingSourceKind, ...]
resolve(context)[source]

Resolve the optional borrador tier for context.

Secure-storage degradation while loading the selected borrador snapshot returns an empty CalculationSourceResolution carrying diagnostics instead of raising, matching the source-mesh resolver contract.

Return type:

CalculationSourceResolution

Parameters:

context (CalculationSourceContext)