aeat.application.modelo._settlement_grade_advisory module

Calculate-path advisory for revisions that do not compute settlement casillas.

A settlement-bearing modelo’s terminal liquidación casilla (Modelo 100 cuota resultante de la autoliquidación / resultado de la declaración) is computed via formula on a fully-modelled revision. A partially-modelled revision leaves those casillas as input_kind = "manual": formulas for upstream inputs and intermediates exist, yet the final liquidación cells remain operator-entered. A ledger-driven calculate on such a revision populates the inputs but never computes the settlement, so an operator could file a blank or zero liquidación on positive activity (no-silent-under-declaration). M100 2020-2023 are the live advisory case.

This module surfaces that STRUCTURAL gap on the calculate path as a non-blocking CalculationSourceDiagnostic, grounded in the loaded ModeloRevision casilla input_kind and its InputKind value (format-agnostic: inline and fragmented registry content have already been merged) – never the formula output, so it is non-tautological. It is the structural complement to the value-level settlement-completeness ADVISORY predicate (implies_nonzero) the verify gate runs on revisions whose settlement IS computed (#24-B / #38): together they cover the no-formula (structural) and formula-resolves-to-zero (value) shapes of the same under-declaration.

Scope: the guard fires only for the grounded terminal-liquidación semantic_role set below (Modelo 100 today, the confirmed live candidate from the #39 settlement-completeness audit); extend the set as further modelos’ settlement chains are modelled. A revision with no formula chain at all yields no advisory (an informativa or an unmodelled revision is not a partial-settlement calc surface).

See also

collect_bucket_aggregation_advisory_diagnostics():

Wires this structural advisory into the bucket-aggregation calculate path.

_verification_actions:

Evaluates the value-level settlement-completeness predicates that complement this structural guard.

InputKind:

The registry enum used to distinguish manual settlement cells from computed ones.

collect_settlement_not_computed_diagnostics(revision)[source]

Return advisories for settlement casillas that are manual (not computed).

For a revision that carries a substantial formula chain (a partially-modelled calc surface) whose terminal liquidación casilla is input_kind = "manual", the calculate path populates the inputs but does not compute the final liquidación – the operator must enter / verify it. Read from the loaded snapshot’s casilla input_kind (structural), not the formula output, so the advisory cannot drift with the numbers. A revision that computes the settlement (input_kind = "computed") yields no advisory; a revision with no formula chain yields no advisory (not a partial-settlement calc surface).

Parameters:

revision (ModeloRevision) – The ModeloRevision whose settlement casillas are inspected (from the loaded, format-agnostic snapshot).

Return type:

tuple[CalculationSourceDiagnostic, ...]

Returns:

Tuple of CalculationSourceDiagnostic advisories for settlement casillas that require operator verification.

See also

SETTLEMENT_SEMANTIC_ROLES:

The narrow terminal-liquidación role allowlist this collector inspects.

collect_bucket_aggregation_advisory_diagnostics():

Calls this collector after calculation revision creation.