cadrumo.domain.calculations.registry.lineage_attestation module¶
Typed, edge-local attestations for registry lineage.
An attestation is the small piece of authored evidence that lets a later revision carry one family member from its exact predecessor. It is kept separate from the revision’s materialised declarations so a compiler can strip inherited rows without losing the decision that made the inheritance safe.
This module deliberately contains no registry loading or family dispatch. A
loader integration supplies the already-selected predecessor relation and a
membership index from the canonical revisions, then calls
validate_lineage_attestations() before publishing its snapshot. Raw
TOML, display numbers, and labels cannot satisfy that validation on their own.
- class LineageAttestation(**data)[source]¶
Bases:
RegistryModelOne grounded continuation across one exact predecessor edge.
Exactly one of
memberandcontinuidad_idis the stable family identity used by the inheritance policy. Identifier-keyed families usemember; the casilla family usescontinuidad_id. Keeping the two alternatives explicit prevents a revision-local id and a cross-revision chain id from being silently conflated.Origins that describe absence (
new_on_form,not_on_form, andpredecessor_edition_silent) do not belong in this sidecar: they have no predecessor edge to attest. They remain ordinary row declarations.- Parameters:
data (Any)
- family: LineageFamilyId¶
- member: LineageMemberId | None¶
- continuidad_id: ContinuidadId | None¶
- from_revision: RevisionId¶
- to_revision: RevisionId¶
- origin: CasillaLineageOriginField¶
- evidence: str | None¶
- legal_refs: LegalRefs¶
- source_refs: SourceRefs¶
- class LineageAttestationSet(**data)[source]¶
Bases:
RegistryModelA typed sidecar payload whose target attestations are unique.
- Parameters:
data (Any)
- attestations: tuple[LineageAttestation, ...]¶
- validate_lineage_attestations(attestations, *, predecessors, members_by_revision)[source]¶
Validate sidecar attestations against a canonical revision snapshot.
The function is pure: it returns the same authored order and does not load, mutate, or materialise registry declarations. Every target must be present in the target revision and in its exact predecessor revision, and the declared edge must equal the canonical predecessor relation. This catches stale sidecar rows as well as duplicate and many-to-one identity claims before a loader publishes a snapshot.
- Parameters:
attestations (
Iterable[LineageAttestation]) – Authored edge-local continuation statements.predecessors (
Mapping[str,str]) – Canonicalto_revision -> from_revisionrelation.members_by_revision (
TypeAliasType) – Canonicalrevision -> family -> membersindex.
- Raises:
RegistryValidationError – If an attestation is stale, is on the wrong edge, or conflicts with another attestation.
- Return type: