cadrumo.domain.calculations.registry.casilla_membership module

Registry-scoped casilla id membership helpers.

The helpers inspect one ModeloRevision and return canonical CasillaDefinition membership keyed only by declared casilla.id values.

See also

core.casilla_id

Shape validation for CasillaId.

domain.calculations.registry.formula_runtime_ops

Runtime input canonicalisation that rejects undeclared casillas through these helpers.

application.modelo._registry_helpers

Application boundary that refuses non-canonical casilla metadata tokens.

duplicate_casilla_ids(casilla_ids)[source]

Return the ids appearing more than once in casilla_ids, sorted.

For a collection that must address each casilla exactly once — a revision’s CasillaDefinition declarations, a calculation result’s observation and unresolved rows — a repeated id makes the downstream mapping resolve by position and drop every row but the last. This is the one fold that names the repeats so such a collection can refuse the ambiguity at construction.

Not every casilla-keyed collection is under that rule: multi-row informativas repeat a casilla once per declared item, and their ordered row tuple is the multiplicity carrier. Callers decide whether repetition is ambiguity or payload; this helper only reports it.

Return type:

tuple[TypeAliasType, ...]

Parameters:

casilla_ids (Iterable[CasillaId])

casillas_by_id(revision)[source]

Return casilla definitions keyed by canonical casilla.id.

Parameters:

revision (ModeloRevision) – The ModeloRevision whose CasillaDefinition declarations are inspected.

Return type:

dict[TypeAliasType, CasillaDefinition]

declared_casilla_ids(revision)[source]

Return canonical ids declared by a registry revision.

The returned CasillaId set is scoped to one ModeloRevision; it is stronger than shape validation alone.

Return type:

frozenset[TypeAliasType]

Parameters:

revision (ModeloRevision)

row_template_casilla_ids(revision)[source]

Return the casillas that are one field of a record a row-set binding emits.

Such a casilla is written once per emitted row, never typed once as a scalar, so its completeness belongs to the row source. The record is named by the casilla’s leading section and by the row-set binding’s provider.

Core types: ModeloRevision.

Return type:

frozenset[TypeAliasType]

Parameters:

revision (ModeloRevision)

undeclared_casilla_ids(revision, casilla_ids)[source]

Return ids not declared by a registry revision.

The revision argument is a ModeloRevision. Use this after raw keys have already been validated as CasillaId shape-compatible.

Return type:

tuple[TypeAliasType, ...]

Parameters:
casilla_noncanonical_reference_tokens(revision)[source]

Return refused metadata tokens for a registry revision.

The revision argument is a ModeloRevision. The keys are printed numbers, form numbers, and export refs that are not canonical casilla.id values. Values are the canonical candidate CasillaId entries.

Return type:

dict[str, tuple[TypeAliasType, ...]]

Parameters:

revision (ModeloRevision)

casilla_noncanonical_reference_targets(revision, token)[source]

Return canonical ids whose revision metadata matches a token.

The revision argument is a ModeloRevision. Callers use this to reject printed numbers, form numbers, and export refs while still naming the canonical casilla candidates in diagnostics.

Return type:

tuple[TypeAliasType, ...]

Parameters:
format_noncanonical_casilla_reference(token, targets)[source]

Render a refused metadata token with its canonical casilla candidates.

targets comes from casilla_noncanonical_reference_targets(). A single target is rendered as a correction while multiple targets are rendered as an ambiguity so every boundary explains why it cannot infer an id from a printed number, form number, or export reference.

Return type:

str

Parameters: