cadrumo.entrypoints.live_state_composition module

Shared composition for live IVA state and filed-observation persistence.

This is the single outer binding used by CLI, TUI, and recorded operations. It deliberately lives beside the entrypoint composition rather than inside the CLI package: shared operation registration must not acquire a transitive dependency on a frontend package.

compose_notifications_ports(*, settings)[source]

Compose the complete live-notifications capability bundle.

Return type:

NotificationsPorts

Parameters:

settings (Settings)

class LiveStateComposition(bucket_id, output_root, objects, ports, filed_data_port, iva_remote_state_port, notifications_ports, certificate_secret_backend_factory, browser_session_factory, operator_scope_ports)[source]

Bases: object

One immutable live-state dependency bundle for one bucket and root.

Parameters:
bucket_id: str
output_root: Path
objects: SecureObjectRepository
ports: FiledObservationPersistencePorts
filed_data_port: FiledDataCapturePort
iva_remote_state_port: IvaRemoteStatePort
notifications_ports: NotificationsPorts
certificate_secret_backend_factory: CertificateSecretBackendFactory
browser_session_factory: BrowserSessionFactoryPort
operator_scope_ports: OperatorScopePorts
compose_filed_observation_persistence_ports(*, bucket_id, output_root, objects)[source]

Compose every filed-observation port against one secure backend.

Core types: SecureObjectRepository.

Return type:

FiledObservationPersistencePorts

Parameters:
build_filed_data_capture_port(*, certificate_secret_backend_factory, browser_session_factory, operator_scope_ports)[source]

Build the AEAT Sede transport that reads filed declarations.

This is the only place the live composition constructs that transport, so a recorded in-memory port can stand in for AEAT while every capture, finalization and reconciliation step downstream stays real.

Return type:

FiledDataCapturePort

Parameters:
compose_live_state(output_root=None, *, bucket_id=None, objects=None)[source]

Compose the shared live-state port and filed-observation ports once.

Core types: SecureObjectRepository.

Return type:

LiveStateComposition

Parameters:
class AppIvaRemoteStatePort(*, objects, filed_observation_ports, certificate_secret_backend_factory, browser_session_factory, operator_scope_ports)[source]

Bases: object

Outer implementation of the live IVA application port.

Parameters:
property wallet_target_url: str

Return the read-only AEAT wallet endpoint.

active_storage_span()[source]

Require the active bucket session for every storage operation.

Return type:

Generator[None]

persist_manifest(manifest)[source]

Persist one redacted remote-state acquisition manifest.

Return type:

None

Parameters:

manifest (IvaRemoteStateAcquisitionManifest)

async active_verified_session(*, operation, target_url)[source]

Resolve the active authenticated AEAT session.

Return type:

tuple[AeatSession, Settings]

Parameters:
  • operation (str)

  • target_url (str | None)

async ensure_authenticated_session(settings, *, operation, target_url)[source]

Start the configured authentication flow.

Return type:

AuthenticatedAeatSessionResult

Parameters:
list_history(*, as_of_year)[source]

List persisted IVA history and authority decisions.

Return type:

IvaCompensationHistoryReport

Parameters:

as_of_year (int | None)

async capture_history(session, *, settings, year_from, year_to, output_root, progress_context)[source]

Capture and persist filed Modelo 303 history.

Return type:

IvaCompensationHistoryCaptureReport

Parameters:
async capture_wallet(session, *, settings, target_year, target_period, taxpayer_nif, output_root, progress_context)[source]

Capture, persist, and reconcile one IVA wallet observation.

Return type:

IvaWalletCaptureReport

Parameters:
persist_and_reconcile_iva_compensation_wallet(observation, *, output_root, objects=None, repository=None, decision_repository=None, decided_at=None)[source]

Persist, reload, reconcile, and project one wallet observation.

Core types: SecureObjectRepository.

Return type:

IvaWalletCaptureReport

Parameters:
aggregate_iva_compensation_history_reports(reports, *, output_root, year_from, year_to)[source]

Combine per-year history reports at the shared composition boundary.

Return type:

IvaCompensationHistoryCaptureReport

Parameters:
async pull_filed_history_with_shared_composition(payload, profile, repository, events, ports, filed_data_port, iva_remote_state_port, notifications_ports, certificate_secret_backend_factory, browser_session_factory, operator_scope_ports)[source]

Invoke the filed-history service with the explicitly composed bundle.

Core types: TaxpayerProfile.

Parameters:
taxpayer_ref(value)[source]

Return a redacted taxpayer identity reference.

Return type:

str

Parameters:

value (str | None)

carry_forward_lot_row(lot)[source]

Project one persisted carry-forward lot into the live-state DTO.

Return type:

IvaCompensationCarryForwardLotRow

Parameters:

lot (IvaCompensationCarryForwardLot)