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_pdf profile whose label_pattern values were derived from the registry’s own casilla label_es fields — rather than verified against a real printed PDF — is a silently-provisional profile. Any such profile that is NOT marked provisional_pending_specimen = True must 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 .pdf file, 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 profile provisional_pending_specimen = true to acknowledge the open risk.

Return type:

list[str]

Parameters:
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_gate already handles the no-fixture case. This gate handles the complementary case: fixture EXISTS but neither corpus_round_trip_verified nor provisional_pending_specimen is 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

Return type:

list[str]

Parameters:
validate_bbox_anchor_consistency(scope, target)[source]

Registry-level defense-in-depth for bbox_anchor field/strategy consistency.

The ExtractionTargetDefinition model 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:

list[str]

Parameters:
validate_extraction_profile_artefacts(scope, profile)[source]
Return type:

list[str]

Parameters:
validate_dotted_callable(scope, owner, dotted_path)[source]

Validate that dotted_path is well-formed as a module.attribute path.

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 any adapters coupling (static or dynamic). See the ports-inversion ADR’s post-close honesty-review note.

Return type:

list[str]

Parameters: