aeat.domain.manuals._verify module

Verification report builder for aeat manual verify.

verify_manual_dir() walks a committed manual part, validates every JSON file against the strict Manual and Section schema, and reports dangling cross-references, missing multilingual completeness, and load failures as ManualVerificationIssue rows in a ManualVerificationReport.

class ManualVerificationIssue(**data)[source]

Bases: BaseModel

Single issue flagged by the verifier.

Variables:
  • level – Either 'error' or 'warning'.

  • code – Stable identifier for the issue category.

  • message – Human-readable description, including the offending path.

Parameters:
level: str
code: str
message: str
class ManualVerificationReport(**data)[source]

Bases: BaseModel

Aggregate report returned by verify_manual_dir().

Variables:
  • manual_id – Identifier of the verified handbook.

  • year – Tax year.

  • part – Volume split within the year.

  • issues – Every ManualVerificationIssue collected during the walk.

Parameters:
manual_id: ManualId
year: int
part: ManualPart
issues: tuple[ManualVerificationIssue, ...]
property errors: tuple[ManualVerificationIssue, ...]

Return only the ManualVerificationIssue items with level == 'error'.

property warnings: tuple[ManualVerificationIssue, ...]

Return only the level == 'warning' issues.

Returns:

Tuple of ManualVerificationIssue objects with warning-level severity.

property ok: bool

True when the report contains no error issues.

verify_manual_dir(*, manual_id, year, part=ManualPart.SINGLE, review_required=None, settings=None)[source]

Verify every record under a manual part on disk.

Parameters:
  • manual_id (ManualId) – Handbook identifier.

  • year (int) – Tax year.

  • part (ManualPart) – Volume split within the year.

  • review_required (bool | None) – Reserved for the future soft-review gate (sentinel-based reviewer placeholders). Currently this flag has no effect because the _Reviewer constrained type already enforces a non-empty reviewer at load time; records failing that constraint surface as load-failed errors. Defaults to the AEAT_MANUALS_REVIEW_REQUIRED setting value.

  • settings (Settings | None) – Optional settings instance.

Return type:

ManualVerificationReport

Returns:

A ManualVerificationReport summarising every issue found.

Raises:

ManualNotFoundError – If neither the structure nor the manifest exists for the requested manual part.

raise_on_errors(report)[source]

Raise ManualReviewRequiredError if the report has errors.

Thin helper so the CLI can collapse a report into a non-zero exit without re-implementing the error-check logic.

Parameters:

report (ManualVerificationReport) – Report produced by verify_manual_dir().

Raises:

ManualReviewRequiredError – When the report contains any error-level issues.

Return type:

None