aeat.domain.calculations.registry._validate_extraction_profiles module¶
Extraction-profile artefact and parser validation helpers.
- validate_declaracion_pdf_specimen_gate(scope, modelo_id, profile, corpus_root)[source]¶
Enforce that a declaracion_pdf profile without a corpus specimen is explicitly acknowledged.
A
declaracion_pdfprofile whoselabel_patternvalues were derived from the registry’s own casillalabel_esfields — rather than verified against a real printed PDF — is a silently-provisional profile. Any such profile that is NOT markedprovisional_pending_specimen = Truemust fail the snapshot-build gate, because the patterns have not been round-trip verified against a corpus PDF and silent extraction failure is the probable result.If a corpus fixture directory exists at
corpus_root / <modelo_id>containing at least one.pdffile, the profile is considered grounded and the field default (False) is correct. If no fixture exists, the author MUST either acquire a specimen or explicitly mark the profileprovisional_pending_specimen = trueto acknowledge the open risk.
- validate_declaracion_pdf_round_trip_gate(scope, modelo_id, profile, corpus_root)[source]¶
Enforce that a declaracion_pdf profile with a corpus fixture has a real round-trip test.
The
validate_declaracion_pdf_specimen_gatealready handles the no-fixture case. This gate handles the complementary case: fixture EXISTS but neithercorpus_round_trip_verifiednorprovisional_pending_specimenis set.A profile in that state has real corpus PDFs but no confirmed round-trip test, which is the exact silent-failure class the M111/M130 audit surfaced — fixture presence gave a false signal of extraction correctness.
Gate logic: - surface != declaracion_pdf → dormant - provisional_pending_specimen → dormant (explicit opt-out, no check) - corpus_round_trip_verified → dormant (author asserts verified) - no corpus fixture → dormant (specimen gate handles this case) - fixture EXISTS, neither flag set → FAIL
- validate_bbox_anchor_consistency(scope, target)[source]¶
Registry-level defense-in-depth for bbox_anchor field/strategy consistency.
The
ExtractionTargetDefinitionmodel validator enforces this at construction time; this function provides an additional snapshot-build check so that targets loaded from TOML that somehow bypass the in-memory validator (e.g. via future schema migration tools) are caught at registry validation.- Return type:
- Parameters:
scope (str)
target (ExtractionTargetDefinition)
- validate_extraction_profile_artefacts(scope, profile)[source]¶
- Return type:
- Parameters:
scope (str)
profile (ExtractionProfileDefinition)
- validate_dotted_callable(scope, owner, dotted_path)[source]¶
Validate that
dotted_pathis well-formed as amodule.attributepath.Structural shape only: the domain registry validation must not name or import the adapter parser modules. Resolution — the allowed-authority prefix, importability, and callability of the target — is enforced by the adapter-legal CI gate
test_extraction_parser_paths_resolve, so this validator stays free of anyadapterscoupling (static or dynamic). See the ports-inversion ADR’s post-close honesty-review note.