cadrumo.application.modelo.verification_actions module¶
Verification actions and predicates for modelo filings.
verify_modelo_revision() evaluates a draft
CalculationRevision against its RegistrySnapshot, workflow
TaxpayerProfile, ledger diagnostics, registry verification predicates,
and cross-period clean-state verdicts before persisting a
VerificationReport.
Verification findings are the operator-facing gate vocabulary. BLOCKING-severity
findings refuse the verified-complete transition; WARNING-severity ADVISORY
findings remain visible in the report without bricking verify, file, or export.
Calculate-path source diagnostics are separate
CalculationSourceDiagnostic advisories;
this module converts only verify-time registry, profile, provenance, and
cross-period facts into ModeloVerificationFinding records.
Verification emits bucket-history entries through
BucketEventHistoryRepository, stores casilla-level
CasillaObservation provenance, and consumes the required
VerificationRepositoryBundle for all persistence capabilities.
Draft-construction structural validation is a distinct, nested stage, not a
parallel pipeline. When verification grants, this module runs the revision
workflow gate with VERIFY;
that gate builds a filing draft, and the draft builder stamps
ModeloValidationFinding rows produced by
ModeloValidator onto the draft, which the
workflow engine re-scans for ERROR severity. Those structural findings answer
whether the draft is well-formed against the casilla collection;
ModeloVerificationFinding answers operator-facing filing readiness and
carries registry legal_refs provenance the structural model does not. The
two vocabularies are not interchangeable.
See also
ModeloValidator:Draft-construction structural validator reached through the workflow gate’s draft builder; owns
ModeloValidationFinding.evaluate_cross_period_clean_state():Shared cross-period gate used by verify, file, and export.
calculation_diagnostics:Calculate-path diagnostics that feed advisory observations before verify.
modelos:Finding kind, severity, and completeness-status authority.
Core types:
ModeloRevision.
- m210_unresolved_outcome_findings(unresolved_outcomes, *, profile, snapshot, year, devengo_date, tipo_renta, blocking_finding_observer=None)[source]¶
Convert typed M210 unresolved engine outcomes into verification findings.
Core types:
RegistrySnapshot,TaxpayerProfile.- Return type:
- Parameters:
unresolved_outcomes (tuple[RegistryCalculationUnresolvedOutcome, ...])
profile (TaxpayerProfile)
snapshot (RegistrySnapshot)
year (int)
devengo_date (date)
tipo_renta (str)
blocking_finding_observer (Callable[[ModeloVerificationFinding, RegistryCalculationUnresolvedOutcome], None] | None)
- missing_evidence_findings(*, target, work_unit, transaction_repository, blocking_finding_observer=None)[source]¶
Build verification findings for evidence-less positive IVA rows.
Loads the
CalculationRevisionsource transactions for the suppliedWorkUnitand projects eachCalculationSourceDiagnostic(reasonmissing_transaction_evidence) into aModeloVerificationFinding. A deductible input-IVA gap BLOCKS the verified-complete transition; an output-IVA gap stays advisory. A revision with no contributing transactions, or whose significant rows all carry evidence, yields no findings.The split is deliberate and legally grounded rather than a severity preference. Deducting input IVA requires the original factura, so a deductible row without one is not a filing the operator may complete. Output IVA has no equivalent constitutive requirement and no CLI path that mints issued-invoice evidence, so blocking it would refuse a taxpayer who has no way to comply.
Blocking here is what keeps the export and local-filing refusals on the same condition unreachable rather than merely later: they remain in place as defence in depth over a state this gate no longer lets form.
- Return type:
- Parameters:
target (CalculationRevision)
work_unit (WorkUnit)
transaction_repository (TransactionCatalogueRepositoryProtocol)
blocking_finding_observer (Callable[[ModeloVerificationFinding, CalculationSourceDiagnostic], None] | None)
- verify_modelo_revision_with_preconditions(calculation_revision_id, *, certificate_secret_backend_factory, operator_scope_ports, actor, workflow_profile, verification_repositories, cross_period_expected_member_sets=(), workflow_engine=None, workflow_runs_dir=None, settings=None, clock=None, operation, profile=None)[source]¶
Evaluate a draft revision against registry, clean-state, provenance, and workflow gates.
The verifier loads the draft
CalculationRevision, resolves its work unit andRegistrySnapshot, builds verify-time findings, classifies the outcome, persists aVerificationReport, records bucket history, and updates theCalculationRevisiononly when the verified-complete transition is granted.The supplied
TaxpayerProfilescopes deadline/applicability decisions. The transaction port in the requiredVerificationRepositoryBundlesupplies non-blocking transaction-evidence advisories for source rows attached to the revision. WARNING-severity advisories remain report content; only BLOCKING severity can refuse the transition.- Parameters:
calculation_revision_id (
TypeAliasType) – Stable id of the draftCalculationRevisionto verify.certificate_secret_backend_factory (
CertificateSecretBackendFactory) – Factory for the certificate-secret capability used by the workflow gate when verification grants.operator_scope_ports (
OperatorScopePorts) – Operator-scope capabilities used by the workflow gate when verification grants.actor (
str) – Operator label recorded on the verification report and bucket history event.workflow_profile (
TaxpayerProfile) –TaxpayerProfilesupplying profile facts for workflow, deadline, applicability, and registry predicate gates.verification_repositories (
VerificationRepositoryBundle) – Required application-owned bundle containing every repository capability used by the verification gates and persistence path. The outer composition root binds all concrete implementations for one profile bucket.cross_period_expected_member_sets (
Iterable[CrossPeriodExpectedMemberSet]) – Optional expected-member overrides for the cross-period clean-state gate.workflow_engine (
WorkflowEngine|None) – OptionalWorkflowEngineoverride for tests and controlled workflow runs.workflow_runs_dir (
Path|None) – Optional workflow-runs directory override.settings (
Settings|None) – Optional runtime settings for workflow-engine construction.clock (
datetime|None) – Optional timestamp override for deterministic verification.operation (
PinnedAuthorityOperation) – Caller-owned generation-pinned authority operation. When supplied, every registry snapshot and point consumer in this path reads from that operation generation.profile (
ModeloWorkProfile|None) – The work profile the calling command already loaded for the revision’s bucket. When omitted, this entry loads it once; every profile read below uses the record the readiness gate checked.
- Return type:
- Returns:
The application result containing the persisted
VerificationReportand its ordered typed preconditions.- Raises:
CalculationRevisionNotFoundError – The requested calculation revision does not exist in the active catalogue.
CalculationRevisionStateError – The revision is not in
BORRADORstate.WorkUnitNotFoundError – The owning work unit is missing.
ModeloCrossPeriodCleanStateError – A required cross-period dependency has a blocking clean-state finding.
- verify_modelo_revision(calculation_revision_id, *, certificate_secret_backend_factory, operator_scope_ports, actor, workflow_profile, verification_repositories, cross_period_expected_member_sets=(), workflow_engine=None, workflow_runs_dir=None, settings=None, clock=None, operation, profile=None)[source]¶
Persist and return the domain verification report without transport recovery data.
The thin arm over
verify_modelo_revision_with_preconditions(), for callers that want the report and none of the transport-recovery envelope. It takes the same required application-owned repository bundle the gates are evaluated against.Core types:
TaxpayerProfile.- Return type:
- Parameters:
calculation_revision_id (CalculationRevisionId)
certificate_secret_backend_factory (CertificateSecretBackendFactory)
operator_scope_ports (OperatorScopePorts)
actor (str)
workflow_profile (TaxpayerProfile)
verification_repositories (VerificationRepositoryBundle)
cross_period_expected_member_sets (Iterable[CrossPeriodExpectedMemberSet])
workflow_engine (WorkflowEngine | None)
workflow_runs_dir (Path | None)
settings (Settings | None)
clock (datetime | None)
operation (PinnedAuthorityOperation)
profile (ModeloWorkProfile | None)