cadrumo.core.secure_object_write module

Boundary DTO for one prepared secure-object upsert.

SecureObjectWrite is the persistence-boundary contract between a domain repository port — which declares to_secure_object_write(...) -> SecureObjectWrite in modelos — and the storage adapter that persists it. It is a pure value object depending only on core (STRICT_FROZEN_CONFIG, SensitivityClass), so a domain port can name it in a method signature without importing the cadrumo.adapters layer. The storage adapter (storage) re-exports it unchanged.

See also

SecureObjectWrite

Public core facade export for this DTO.

SensitivityClass

Classification carried by every prepared secure-object write.

CalculationRevisionCatalogueRepositoryProtocol

Domain repository port that can prepare a calculation catalogue write without importing adapters.

ModeloRecordCatalogueRepositoryProtocol

Domain repository port that can co-write filing records through the same DTO.

SecureObjectRepository

Storage adapter that consumes these prepared writes.

save_many()

Unit-of-work API that persists one or more prepared writes atomically.

ABSENT_SECURE_OBJECT_REVISION_ID

CAS sentinel requiring that the addressed secure-object row is absent.

class SecureObjectWrite(**data)[source]

Bases: BaseModel

One encrypted secure-object upsert prepared for a unit of work.

written_at must be a UTC-aware instant. That contract is enforced at the storage write funnel rather than declared here as UtcInstant: this DTO is imported during core package initialisation, and reaching core.time from here loads core.config through the clock’s logger and closes an import cycle. The funnel is the honest single owner in any case – the constraint is a storage-substrate fact, not a property of the value. The stored row’s revision id hashes the instant, and SQLite drops tzinfo on write, so an offset-bearing value is persisted as its local wall clock while its revision was derived from the UTC instant: the row commits and then fails its own read-time self-consistency gate permanently.

See also

save()

Direct write boundary carrying the same UTC-aware contract.

Parameters:

data (Any)

namespace: str
object_key: str
classification: SensitivityClass
schema_version: int
written_at: datetime
payload: bytes
write_provenance: str
source_event_id: str | None
expected_revision_id: Hex64Str | None