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: RegistryModel

One grounded continuation across one exact predecessor edge.

Exactly one of member and continuidad_id is the stable family identity used by the inheritance policy. Identifier-keyed families use member; the casilla family uses continuidad_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, and predecessor_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
property identity: str

Return the one canonical family identity carried by this attestation.

target_key()[source]

Return the unique family/identity key at the target revision.

Return type:

tuple[str, str, str]

class LineageAttestationSet(**data)[source]

Bases: RegistryModel

A 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]) – Canonical to_revision -> from_revision relation.

  • members_by_revision (TypeAliasType) – Canonical revision -> family -> members index.

Raises:

RegistryValidationError – If an attestation is stale, is on the wrong edge, or conflicts with another attestation.

Return type:

tuple[LineageAttestation, ...]