Source code for cadrumo.domain.calculations.registry.legal
"""Runtime legal-reference eligibility checks.The authority artifact carries immutable, already-published legal evidence.Corpus extraction, textual-grounding and provenance verification are publisherresponsibilities completed before the artifact is published; runtime onlychecks whether the artifact's selected citation is eligible for filing."""from__future__importannotationsfromdatetimeimportdatefrom....core.revision_reviewimportREVIEWED_REVISION_REVIEW_STATUSESfrom.citation_blocklistimportfind_known_badfrom.errorsimportRegistryValidationErrorfrom.schema_referencesimportLegalReference
[docs]defverify_legal_reference(reference:LegalReference,*,filing_date:date|None=None)->None:"""Reject an artifact citation that is not eligible for filing. This deliberately does not open ``corpus_ref``. Publication has already established corpus provenance and textual grounding; installed runtime has no mutable authoring tree to verify or rebuild from. """ifreference.review_statusnotinREVIEWED_REVISION_REVIEW_STATUSES:raiseRegistryValidationError(f"legal reference {reference.id!r} is {reference.review_status.value!r}; ""filing-grade authority requires a reviewed status",)_validate_known_bad_citation(reference,filing_date=filing_date)