cadrumo.adapters.persistence.profile.submission module¶
Governed-persistence repository for submission audit records.
Submission audit records keep the local or imported
domain.submission.models.ModeloPresentado lifecycle: draft id, modelo,
period, taxpayer identity, AEAT receipt metadata when observed, and attempt
summaries. They are stored as encrypted byte objects in the primary SQL backend
at AUDIT SensitivityClass; no
plaintext submission JSON or envelope file lands on disk.
This concrete repository is the persistence adapter behind the read-side
domain.submission.protocols.SubmissionRepositoryProtocol. It lives in the
persistence adapter (not in domain.submission) because its base
SecureBoundRepository is
SQL/crypto-coupled; the domain package depends only on the structural port.
See also
domain.submission.models.ModeloPresentadoPayload model encrypted by this repository.
domain.submission.protocols.SubmissionRepositoryProtocolDomain-facing read port this repository satisfies structurally.
adapters.persistence.storage.sql.secure_objects.SecureObjectRepositorySQL object store underlying the bound repository.
- class SubmissionRepository(*, bucket_id=None, objects=None, settings=None)[source]¶
Bases:
SecureBoundRepository[ModeloPresentado]Encrypted AUDIT repository for
ModeloPresentadorecords.The
SecureBoundRepositorybase stores eachModeloPresentadoin aEnveloperow under the AUDIT submission-records namespace. The natural key is the submission id, so the list and iteration APIs expose historical filing attempts rather than any live submission capability.See also
domain.submission.protocols.SubmissionRepositoryProtocolDomain read port this class satisfies.
SecureObjectRepositorySQL object store composed by the bound repository base.
- Parameters:
bucket_id (str | None)
objects (SecureObjectRepository | None)
settings (Settings | None)
- namespace: ClassVar[str]¶
- sensitivity: ClassVar[SensitivityClass]¶
- schema_version: ClassVar[int]¶
- classmethod payload_model()[source]¶
Return the concrete Pydantic payload model for this repository.
- Return type:
- extract_identifier(payload)[source]¶
Return the natural id for
payload(used as the SQL object key).Subclasses MUST override. The base implementation raises
NotImplementedError.- Return type:
- Parameters:
payload (ModeloPresentado)
- list_submission_ids()[source]¶
Return every submission id persisted in this repository, in lexicographic order.
- iter_submissions()[source]¶
Yield every persisted submission, in lexicographic id order.
Audit-record enumeration is resilient: rows that fail classification or schema-version gates are logged and skipped rather than aborting the iteration. Diagnostic surfaces depend on listing all healthy submissions even when a single row is unreadable.
An identity mismatch is NOT in that resilient category and raises. This scan is custom rather than the base repository’s, so the identity check
loadperforms did not reach it: a valid filing attempt B stored under A’s row key was yielded here as an ordinary submission, corrupting audit-history identity. Such a row is perfectly READABLE – it is simply filed under a key it does not describe – so skipping it would both hide the inconsistency and silently shorten the history a caller is auditing.- Return type:
- Returns:
Iterator over
ModeloPresentadorecords.- Raises:
SecureObjectRowIdentityError – A row’s payload rebuilds a different submission id than the key it is filed under.