cadrumo.application.live.borrador_100 module

Application-owned Modelo 100 borrador snapshot lifecycle.

Borrador100 is the proof-of-concept consumer of the shared snapshot lifecycle abstraction. The application owns the payload, identity, state machine, and repository capability; executable composition supplies the encrypted persistence implementation through Borrador100SnapshotRepository.

exception BorradorSnapshotNotFoundError(message=None, *, context=None, translated_message=None)[source]

Bases: SnapshotNotFoundError

Raised when a Modelo 100 borrador snapshot lookup misses by id.

SnapshotNotFoundError inherits CadrumoError first, so MRO routes __init__ through the structured constructor (accepts context= / translated_message= kwargs) rather than KeyError’s C-level constructor. Listing CadrumoError explicitly here would violate C3 linearization.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
class Borrador100Snapshot(**data)[source]

Bases: BaseModel

Captured Modelo 100 borrador values available to application consumers.

Parameters:

data (Any)

snapshot_id: SnapshotId
bucket_id: BucketId
modelo: str
filing_year: FilingYear
period: Period
registry_snapshot_ref: RegistrySnapshotRef
captured_at: datetime
source_url: BorradorSourceUrl
state: SnapshotLifecycleState
binding_values: Mapping[BindingId, _BorradorValue]
superseded_by_snapshot_id: SnapshotId | None
discarded_at: datetime | None
discarded_by: str
discard_reason: str
require_borrador_100_snapshot_coordinates_current(snapshot, *, operation)[source]

Return a persisted borrador only when its producing coordinate re-confirms.

Return type:

Borrador100Snapshot

Parameters:
borrador_100_snapshot_object_key(bucket_id, snapshot_id)[source]

Return the secure-object key for one bucket’s Modelo 100 borrador snapshot.

Return type:

str

Parameters:
  • bucket_id (str)

  • snapshot_id (str)

derive_borrador_100_snapshot_id(*, filing_year, period, registry_snapshot_ref, captured_at, source_url, binding_values)[source]

Return the content-addressed id for one Modelo 100 borrador capture.

The canonical-JSON shape is preserved exactly so existing on-disk snapshot ids remain valid: the core canonical JSON hash does not change the hashed bytes.

Return type:

str

Parameters:
class Borrador100SnapshotRepository(*args, **kwargs)[source]

Bases: SnapshotRepository[Borrador100Snapshot], Protocol

Application persistence capability for bucket-scoped borrador snapshots.

Encrypted secure-object storage, namespaces, object keys, and persistence errors belong to the outer adapter. Implementations satisfy this structural contract without inheriting application code.

class Borrador100SnapshotRepositoryFactory(*args, **kwargs)[source]

Bases: Protocol

Construct the required borrador repository for one profile bucket.

class Borrador100SnapshotService(*, bucket_id, repository)[source]

Bases: SnapshotService[Borrador100Snapshot, _Borrador100CaptureRequest]

Canonical backend service for bucket-scoped Modelo 100 borrador snapshots.

Parameters:
capture(*, filing_year, period, captured_at, source_url, binding_values)[source]

Execute this public contract operation.

Return type:

Borrador100Snapshot

Parameters:
list_snapshots(*, filing_year=None, state=SnapshotLifecycleState.ACTIVE)[source]

Execute this public contract operation.

Return type:

tuple[Borrador100Snapshot, ...]

Parameters:
show(snapshot_id, *, operation)[source]

Execute this public contract operation.

Return type:

Borrador100Snapshot

Parameters:
latest_for_year(*, filing_year, operation, period=None)[source]

Execute this public contract operation.

Return type:

Borrador100Snapshot | None

Parameters: