cadrumo.domain.calculations.registry.support_matrix module

Typed per-modelo support-matrix registry.

ModeloEntry is the first-class typed roll-up of “what does modelo X actually support”, derived entirely from the loaded ModeloDefinition / ModeloRevision records — never hand-maintained. It composes existing registry primitives rather than re-implementing them:

  • calc-grade / manifest / export-format / extractor detection reads the latest revision’s declared closure, completeness manifest, export layouts, and extraction profiles. This module is the SOLE authority for those predicates: a contributor-facing copy of them shipped in the developer tooling for a while, recomputing every field this row already carries from the same primitives, and was retired rather than delegated once the fork was measured;

  • rename tracking reads the revision’s already-declared CasillaContinuidadEvolutionDefinition entries (the casilla_continuidad_evolutions field);

  • portal-compatibility tracking reads the revision’s declared LiveCrossReferenceDecision entries (surface kind and evidence tier).

Coverage honesty (no-silent-under-declaration): a modelo missing a capability, rename record, or portal cross-reference reports an explicit empty/False value, never a fabricated positive.

See also

build_support_matrix()

Pure builder that folds the ValidatedRegistryAuthority into typed rows.

ModeloSupportMatrixReport

Query-service envelope returned by support_matrix().

registry_support_matrix()

Application query used by CLI discovery without re-reading registry authority directly.

class RevisionCapabilityProbe(**data)[source]

Bases: BaseModel

The capability predicates ONE modelo revision declares.

The support matrix folds these over a modelo’s latest revision; the application-layer conformance composer folds them over whichever revision its row names. Both need the identical predicate set, so it is defined once here — the support authority owns what “calc grade” and “has a fixed-width export” mean, and a consumer that recomputed the expressions locally would silently drift from the canonical support row the first time a primitive or a scope changed.

Variables:
  • calc_grade – Whether the revision’s calculation closure is non-empty.

  • has_completeness_manifest – Whether the revision declares a calculation-completeness manifest.

  • has_fixed_width_export – Whether it registers a fichero-BOE layout.

  • has_xml_dictionary_export – Whether it registers an XML-dictionary layout.

  • has_extractor – Whether it declares any extraction profile.

  • extraction_profile_count – Extraction profiles declared on the revision.

Parameters:

data (Any)

calc_grade: bool
has_completeness_manifest: bool
has_fixed_width_export: bool
has_xml_dictionary_export: bool
has_extractor: bool
extraction_profile_count: NonNegativeInt
revision_capability_probe(revision, *, modelo_id)[source]

Fold the capability predicates revision declares.

Parameters:
  • revision (ModeloRevision) – The ModeloRevision whose export layouts, completeness manifest, and extraction profiles are probed.

  • modelo_id (str) – Scopes the calculation-closure traversal that decides calc_grade. This is the owning modelo’s identifier, not a revision id.

Return type:

RevisionCapabilityProbe

class ModeloRenameRecord(**data)[source]

Bases: BaseModel

One declared per-ejercicio casilla continuity evolution.

Projects a CasillaContinuidadEvolutionDefinition already declared on the revision — this record never invents rename history; it surfaces what the registry already tracks per continuity chain (continuidad_id).

Variables:
  • continuidad_id – The stable continuity chain identifier a casilla’s number/label is tracked under across revisions.

  • from_revision – Revision id the evolution starts from.

  • to_revision – Revision id the evolution lands on.

  • evolution_kind – The declared nature of the change (e.g. "label_evolved", "repurposed", "retired").

Parameters:

data (Any)

continuidad_id: str
from_revision: RevisionId
to_revision: RevisionId
evolution_kind: str
class ModeloPortalCompatibilityRef(**data)[source]

Bases: BaseModel

One declared AEAT-portal cross-reference for a modelo revision.

Projects a LiveCrossReferenceDecision already declared on the revision — the registry’s own record of which live AEAT surface the modelo has been cross-checked against and under what evidence tier.

Variables:
  • id – Stable registry identifier for the cross-reference decision.

  • surface – The live AEAT surface kind cross-checked (e.g. "public_read_surface", "integration_test_service").

  • evidence_tier – The declared evidence tier backing the cross-reference.

Parameters:

data (Any)

id: str
surface: str
evidence_tier: EvidenceTierField
class ModeloEntry(**data)[source]

Bases: BaseModel

First-class typed support-matrix record for one modelo.

Derived entirely from the loaded registry authority — every field is a direct read or fold over the modelo’s latest revision, never a hand-maintained value. See build_support_matrix().

Variables:
  • modelo_id – The AEAT modelo identifier (e.g. "303").

  • title – Human-readable display name from the registry.

  • calculation_class – The modelo’s declared calculation role ("filing", "informative", or "summary").

  • revision_count – Number of registry revisions declared for this modelo.

  • latest_revision_id – The id of the revision this entry’s capabilities are probed against (the revision with the most recent valid_from).

  • latest_revision_valid_from – That revision’s applicability start date.

  • supported_revision_ids – Every declared revision id, oldest valid_from first.

  • calc_grade – Whether the latest revision’s calculation closure is non-empty (has at least one formula/binding/verification wiring the engine traverses).

  • has_completeness_manifest – Whether the latest revision declares a calculation-completeness manifest.

  • has_fixed_width_export – Whether the latest revision registers a fixed_width (fichero-BOE) export layout.

  • has_xml_dictionary_export – Whether the latest revision registers an xml_dictionary export layout.

  • has_extractor – Whether the latest revision registers at least one extraction profile.

  • extraction_profile_count – Count of extraction profiles on the latest revision.

  • renames – Declared per-ejercicio casilla continuity evolutions on the latest revision.

  • portal_compatibility_refs – Declared AEAT-portal cross-references on the latest revision.

Parameters:

data (Any)

modelo_id: ModeloId
title: str
calculation_class: CalculationClassField
revision_count: int
latest_revision_id: RevisionId
latest_revision_valid_from: date
supported_revision_ids: tuple[RevisionId, ...]
calc_grade: bool
has_completeness_manifest: bool
has_fixed_width_export: bool
has_xml_dictionary_export: bool
has_extractor: bool
extraction_profile_count: int
renames: tuple[ModeloRenameRecord, ...]
portal_compatibility_refs: tuple[ModeloPortalCompatibilityRef, ...]
build_support_matrix(authority)[source]

Probe every modelo in authority and return its typed support row.

Parameters:

authority (ValidatedRegistryAuthority) – The ValidatedRegistryAuthority to probe.

Return type:

tuple[ModeloEntry, ...]

Returns:

Every modelo’s ModeloEntry, sorted by modelo_id.

build_support_matrix_from_directory_views(views)[source]

Build the explicit bulk support inventory from point-loaded modelo views.

A view carries only its selected revision, so the declared revision ids come from the directory the view was materialized from.

Core types: ModeloDefinition.

Return type:

tuple[ModeloEntry, ...]

Parameters:

views (Iterable[tuple[ModeloRevisionDirectory, ModeloDefinition]])