aeat.application.modelo._verification_predicates module

Registry-authored predicate runtime for modelo verification.

The verification action feeds this module predicate rows from the selected RegistrySnapshot. The runtime evaluates blocking and advisory DSL expressions against calculated casilla values, profile state, and typed unresolved calculation outcomes, then returns operator-facing verification findings.

See also

_verification_actions

Verification workflow that resolves the snapshot and persists reports.

VerificationPredicateDefinition

Registry-authored predicate records evaluated here.

RegistryCalculationUnresolvedOutcome

Typed unresolved engine outcomes converted into verification findings.

ModeloVerificationFinding

Finding records returned to the verification report.

evaluate_advisory_predicate_fires(expression, casilla_values, text_values=mappingproxy({}), profile=None)

Return True when a registered ADVISORY predicate condition fires.

Return type:

bool

Parameters:
evaluate_predicate_expression(expression, casilla_values, profile)

Return True when the predicate holds, False when it is violated.

Supports the DSL operators registered in KNOWN_VERIFICATION_PREDICATE_OPERATORS:

  • all_nonzero(["id1", "id2", ...]) — all ids must have a non-zero value.

  • any_nonzero(["id1", "id2", ...]) — at least one id must have a non-zero value.

  • at_most_one_positive(["id1", "id2", ...]) — no more than one named casilla may be strictly positive.

  • cap_le_when_positive(["limited_id", "ceiling_id"]) — when the ceiling casilla is strictly positive, the limited casilla MUST NOT exceed it.

  • equals(["lhs_id", "rhs_id"]) — binary consistency invariant: predicate holds iff the two named casillas hold the same value (M303 official-box projection consistency: box == its semantic source).

  • implies_nonzero(["antecedent_id", "consequent_id"]) — material implication with strictly-positive antecedent: predicate holds iff antecedent <= 0 OR consequent != 0.

  • implies_any_nonzero(["antecedent_id", "c1_id", ...]) — N-consequent generalisation: predicate holds iff antecedent <= 0 OR at least one listed consequent != 0 (M303 official-Diseño under-declaration shape).

  • profile_field_required("field_name", "applicability_filter") — profile-state-aware conditional non-zero requirement; sibling of implies_nonzero per the dsl-conditional-predicate ADR.

An expression that does not match any registered pattern is treated as holding (i.e. unknown predicates do not block the operator). The authoring-time validator in _validate_surfaces is the gate against typos reaching this branch.

Return type:

bool

Parameters:
evaluate_verification_predicates(predicates, casilla_values, profile, text_values=mappingproxy({}))

Evaluate Layer 2 cross-casilla predicates into verification findings.

predicates are VerificationPredicateDefinition entries from the selected registry snapshot. The returned records are ModeloVerificationFinding values.

text_values carries operator-entered raw strings (e.g. input_values_by_casilla_id), independent of the Decimal casilla_values projection. It defaults to an empty mapping and is consumed by text-aware ADVISORY operators such as casilla_equals_implies_nonzero; every other operator ignores it.

BLOCKING_RULE predicates use negative logic: the predicate expression must hold, and a violation emits a BLOCKING finding. ADVISORY predicates use affirmative logic: when their condition fires, the operator receives a WARNING-severity ADVISORY finding and the verified-complete grant remains possible if no blocking findings exist.

profile is a TaxpayerProfile threaded through to support profile-state-aware predicate operators such as profile_field_required and profile_flag_enabled. Casilla-only operators ignore the parameter.

See also

_evaluate_predicate_expression():

Evaluates the blocking-rule predicate DSL.

_evaluate_advisory_predicate_fires():

Evaluates the advisory predicate DSL.

_classify_verification_outcome():

Converts finding severity into report completeness and grant status.

Return type:

list[ModeloVerificationFinding]

Parameters: