cadrumo.domain.calculations.registry.authority_artifact module

Typed authority values and the indexed component codec.

Product runtime admits only the descriptor-selected SQLite generation and decodes addressed immutable components from it. AuthorityArtifact is the development compiler’s in-memory typed handoff into that database builder. This module knows no registry root and provides no eager runtime loader.

Core types: ModeloDefinition, ModeloRevision.

class AuthorityComponentKind(*values)[source]

Bases: StrEnum

Closed component families addressable in one authority generation.

MODELO_REVISION
MODELO_DIRECTORY
GOVERNED_FACT
PROFILE_SCHEMA
RUNTIME_CATALOGUE
LEGAL_REFERENCE
SOURCE_REFERENCE
LEGAL_EVIDENCE
SOURCE_EVIDENCE
EXPORT_LAYOUT
SNAPSHOT_GLOBALS
class AuthorityGenerationPin(logical_generation, reader_incarnation)[source]

Bases: object

Immutable identity of the reader incarnation used by one operation.

Parameters:
  • logical_generation (str)

  • reader_incarnation (str)

logical_generation: str
reader_incarnation: str
class ModeloRevisionComponentQuery(modelo_id, revision_id, kind=AuthorityComponentKind.MODELO_REVISION)[source]

Bases: object

Retrieve one complete modelo revision by its canonical identity.

Parameters:
modelo_id: str
revision_id: str
kind: Final[AuthorityComponentKind]
class ModeloDirectoryComponentQuery(modelo_id, kind=AuthorityComponentKind.MODELO_DIRECTORY)[source]

Bases: object

Retrieve complete canonical selection metadata for one modelo.

Parameters:
modelo_id: str
kind: Final[AuthorityComponentKind]
class GovernedFactComponentQuery(fact_id, kind=AuthorityComponentKind.GOVERNED_FACT)[source]

Bases: object

Retrieve one governed fact declaration and all its resolved variants.

Parameters:
fact_id: str
kind: Final[AuthorityComponentKind]
class ProfileSchemaComponentQuery(schema_id='cadrumo.user_profile', kind=AuthorityComponentKind.PROFILE_SCHEMA)[source]

Bases: object

Retrieve the complete public profile declaration for a pinned operation.

Parameters:
schema_id: str
kind: Final[AuthorityComponentKind]
class RuntimeCatalogueComponentQuery(family, kind=AuthorityComponentKind.RUNTIME_CATALOGUE)[source]

Bases: object

Retrieve one named runtime catalogue without hydrating sibling families.

Parameters:
family: str
kind: Final[AuthorityComponentKind]
class SnapshotGlobalsComponentQuery(key='snapshot', kind=AuthorityComponentKind.SNAPSHOT_GLOBALS)[source]

Bases: object

Retrieve the small registry-wide values needed by point snapshots.

Parameters:
key: Final[str]
kind: Final[AuthorityComponentKind]
class ReferenceComponentQuery(reference_id, kind)[source]

Bases: object

Retrieve one legal or public-source declaration by canonical id.

Parameters:
reference_id: str
kind: AuthorityComponentKind
class ExportLayoutComponentQuery(modelo_id, revision_id, layout_id, kind=AuthorityComponentKind.EXPORT_LAYOUT)[source]

Bases: object

Retrieve one substantial export layout separated from its revision.

Parameters:
modelo_id: str
revision_id: str
layout_id: str
kind: Final[AuthorityComponentKind]
class EvidenceComponentQuery(reference_id, kind)[source]

Bases: object

Retrieve one legal or public-source evidence projection by canonical id.

Parameters:
reference_id: str
kind: AuthorityComponentKind
class AuthorityComponentReader(*args, **kwargs)[source]

Bases: Protocol

Generation-pinned typed component access used by runtime consumers.

pin()[source]

Pin the currently published reader incarnation for one operation.

Return type:

AuthorityGenerationPin

load(query, *, pin)[source]

Load one component from exactly pin or refuse a stale/cross-reader pin.

Return type:

object

Parameters:
component_queries()[source]

Return deterministic addresses without hydrating component payloads.

Return type:

tuple[TypeAliasType, ...]

class ProfileCreateContext(schema, generation)[source]

Bases: object

Schema authority required when creating taxpayer profile values.

Parameters:
schema: ProfileSchemaDefinition
generation: AuthorityGenerationPin
class ProfileDecodeContext(schema, generation)[source]

Bases: object

Schema authority required when decoding encrypted persisted profile values.

Parameters:
schema: ProfileSchemaDefinition
generation: AuthorityGenerationPin
exception AuthorityComponentCodecError(message=None, *, context=None, translated_message=None)[source]

Bases: CadrumoError

One addressed component failed canonical encoding or strict decoding.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
encode_authority_component(query, value)[source]

Encode one typed component with the canonical authority value vocabulary.

Return type:

bytes

Parameters:
  • query (AuthorityComponentQuery)

  • value (object)

decode_authority_component(query, payload, *, dependencies=(), fact_query_observer=None)[source]

Strictly decode one addressed component using only declared dependencies.

Return type:

object

Parameters:
authority_component_identity(query)[source]

Return the stable database identity for one public typed query.

Return type:

tuple[AuthorityComponentKind, str]

Parameters:

query (AuthorityComponentQuery)

authority_query_from_identity(kind, key)[source]

Reconstruct a public typed query from one validated component directory row.

Return type:

TypeAliasType

Parameters:
class PublishedLegalEvidence(legal_reference_id, anchored_text, text_sha256, provenance=NormativeCorpusProvenance.OUT_OF_SCOPE)[source]

Bases: object

One publisher-validated, anchor-scoped legal text projection.

This is deliberately text and identity, rather than a corpus filename or source root. The release artifact is the runtime evidence boundary.

Parameters:
legal_reference_id: str
anchored_text: str
text_sha256: str
provenance: NormativeCorpusProvenance
class PublishedSourceEvidence(source_reference_id, payload, payload_sha256)[source]

Bases: object

Publisher-validated source bytes required by a shipped workflow.

Corpus paths remain descriptive catalogue metadata. A runtime reader gets bytes only through this digest-checked projection, never by joining that path to a package or checkout root.

Parameters:
  • source_reference_id (str)

  • payload (bytes)

  • payload_sha256 (str)

source_reference_id: str
payload: bytes
payload_sha256: str
class AuthorityEvidenceProjection(legal=(), sources=())[source]

Bases: object

Immutable evidence needed by citation consumers after publication.

Parameters:
legal: tuple[PublishedLegalEvidence, ...]
sources: tuple[PublishedSourceEvidence, ...]
legal_text(legal_reference_id)[source]

Return publisher-validated text for one legal citation or refuse.

Return type:

str

Parameters:

legal_reference_id (str)

quotation_is_grounded(legal_reference_id, quotation)[source]

Answer a citation query without opening any authoring corpus path.

Return type:

bool

Parameters:
  • legal_reference_id (str)

  • quotation (str)

legal_provenance(legal_reference_id)[source]

Return the publisher-derived provenance for one legal reference.

Return type:

NormativeCorpusProvenance

Parameters:

legal_reference_id (str)

source_bytes(source_reference_id)[source]

Return digest-checked runtime source bytes for one source reference.

Return type:

bytes

Parameters:

source_reference_id (str)

class AuthorityBuildIdentity(source_identity_digest, compiler_identity_digest, component_dependency_digest)[source]

Bases: object

Distinct source, compiler, and whole-generation dependency receipts.

Parameters:
  • source_identity_digest (str)

  • compiler_identity_digest (str)

  • component_dependency_digest (str)

source_identity_digest: str
compiler_identity_digest: str
component_dependency_digest: str
classmethod from_inputs(source_identity_digest, compiler_identity_digest)[source]

Create the dependency receipt for a full canonical compilation.

Return type:

AuthorityBuildIdentity

Parameters:
  • source_identity_digest (str)

  • compiler_identity_digest (str)

property identity_digest: str

Combine the distinct receipts into the runtime generation identity.

class AuthorityArtifact(modelos, catalogues, identity_digest, build_identity, profile_schema, evidence=AuthorityEvidenceProjection(legal=(), sources=()))[source]

Bases: object

Complete typed authority payload emitted only after registry validation.

identity_digest is the content-addressed identity of the registry and source-evidence inputs development validated to produce this authority. The graph is deeply immutable: its models are frozen and its mappings are frozen mappings, so a consumer cannot change what any other holder of the same instance observes.

Parameters:
modelos: tuple[ModeloDefinition, ...]
catalogues: RegistryCatalogues
identity_digest: str
build_identity: AuthorityBuildIdentity
profile_schema: ProfileSchemaDefinition
evidence: AuthorityEvidenceProjection