cadrumo.adapters.persistence.storage.bucket.export_archive_header module

Strict pydantic v2 record for the sealed-export archive header.

The export archive header is the plaintext frontmatter of every sealed export bundle. It carries only the product marker, the bucket identifier, the manifest digest, the archive schema version, and the export timestamp; the encrypted payload travels as the archive’s one other member.

Recovery material is not part of this transport. A profile’s optional recovery wrapper lives only in its committed capsule and is enrolled again explicitly after a restore, so no archive member, header flag, or member-count rule depends on it. Optional material that could not be produced, or arrived damaged, can therefore never make an otherwise complete backup read as malformed.

ARCHIVE_SCHEMA_VERSION

The one archive framing this build reads and writes. The header declares it and the model refuses every other value, so a bundle carrying a superseded framing is rejected at the boundary rather than parsed under assumptions its bytes do not satisfy. There is deliberately no branch that accepts a lower version: this is a forward marker, not a compatibility axis.

class ExportArchiveHeader(**data)[source]

Bases: BaseModel

Plaintext frontmatter for a sealed bucket-export archive.

manifest_digest is the canonical ContentDigest of the archive manifest. It previously carried a locally-restated lowercase-hex-64 rule, which agreed with the canonical alias on every malformed value but disagreed on a valid one: the alias strips surrounding whitespace, so a digest that arrived padded – as it can from a text transport – normalized everywhere else in the codebase and was refused here alone. The header sits beside bucket_id, already typed through the same identity module, so routing the digest through it keeps one rule rather than two that happen to match.

Parameters:

data (Any)

product: str
bucket_id: BucketId
manifest_digest: ContentDigest
archive_schema_version: int
created_at: datetime