cadrumo.domain.calculations.registry.record_design_coverage module

Off-load-path record-design coverage and calculation-closure derivations.

calculation_closure_casilla_ids() and calculation_closure_legal_refs derive bounded closure projections from a ModeloRevision; DisenoCoverageReport remains the advisory full-Dise�o inventory.

calculation_closure_casilla_ids(revision, modelo_id)[source]

Return canonical casilla ids in a revision’s calculation closure.

The calculation closure is the set of casillas the cross-connecting calculation engine traverses within this modelo revision:

  • every formula.target_casilla_id casilla;

  • every casilla referenced inside any formula.expression, walked transitively via the runtime-graph expression_casilla_refs walker;

  • every casilla that declares a formula (a computed endpoint) or a binding (a bound endpoint) � the engine-visible casillas;

  • every verification-expectation operand casilla (computed_casilla_ids and the reconciliation_total_casilla_ids targets);

  • every within-modelo binding source_casilla_ids / source_casilla_id selector casilla, and every within-modelo the relation-prefill provider’s source_casilla_id.

A binding source_casilla_ids / source_casilla_id selector � and a the relation-prefill provider’s source_casilla_id � is excluded from this closure only when it is genuinely cross-modelo: when the selector explicitly names a source_modelo that differs from modelo_id. A cross-modelo selector’s source_casilla_ids / source_casilla_id name casillas on that foreign modelo, not on the modelo whose closure is being derived; the cross-modelo edge enters the current modelo through the bound casilla � the current-modelo casilla that declares the binding (or, for a relation, relation.target_binding) � which is already counted above as a binding endpoint. Folding a foreign-modelo casilla id into this closure would make the completeness gate demand it from the wrong modelo’s registry.

A selector that omits source_modelo or sets it equal to modelo_id is a within-modelo selector: a previous_filing self-binding or a previous_period self-relation names a casilla on the modelo being derived, so that casilla is a genuine closure member and is kept.

References are not normalised through record-design metadata. A formula, binding, relation, or verification token must already be the canonical casilla.id for this revision. A reference token that matches no declared casilla id is kept verbatim so the manifest derivation and registry validation fail loudly on the unresolved canonical reference.

Parameters:
  • revision (ModeloRevision) – The ModeloRevision whose formula and binding graph is walked to derive the closure.

  • modelo_id (str) – The AEAT modelo identifier used to exclude cross-modelo selector casillas from the closure.

Return type:

frozenset[TypeAliasType]