cadrumo.application.export.google_operation module

Canonical supervised Google Sheets calculation-workbook export.

This module owns the application sequence for a Google calculation-workbook export: exact active-profile admission, registry snapshot selection, plan construction, effect truth, and encrypted settlement. The remote transport is an injected port. Its concrete Google credentials, Drive-root configuration, preview/apply adapter calls, and sync-run repository are deliberately composed outside this application package by the authorised production composition step.

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

Bases: CadrumoError

The active profile has not admitted Google workbook export.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

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

Bases: CadrumoError

The composed transport has no configured Drive root folder.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

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

Bases: CadrumoError

The active profile has no registered Google OAuth client.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

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

Bases: CadrumoError

The active profile has no persisted Google OAuth token.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

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

Bases: CadrumoError

The Google authentication dependency is unavailable.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

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

Bases: CadrumoError

The requested export profile is no longer the active profile.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

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

Bases: CadrumoError

The supervised subject contradicts the export payload profile.

Parameters:
  • message (str | None)

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

  • translated_message (str | None)

Return type:

None

code
class GoogleSheetsExportOperationRequest(**data)[source]

Bases: CredentialFreeOperationRequest

Immutable target for one active-profile Google Sheets export.

Parameters:

data (Any)

profile_id: UUID
modelo: ModeloId
filing_year: FilingYear
period: str
prefill_relations: bool
dry_run: bool
property filing_period: Period

Build the typed period at the canonical core boundary.

class GoogleSheetsWorkbookWriteFacts(**data)[source]

Bases: BaseModel

What one Google Sheets workbook write did, previewed or applied.

One concept with two carriers: the port returns these facts, and the operation retains them in encrypted custody alongside the provenance identifying which calculation produced them. Declaring them once keeps the carriers from drifting field by field – a counter added to the port’s return and not to the retained record would read as a silent zero downstream.

dry_run belongs here rather than to either carrier because the port must return it exactly as received, so a preview can never be settled as an applied write.

Parameters:

data (Any)

dry_run: bool
root_folder_id: str | None
spreadsheet_exists: bool | None
folder_id: str | None
spreadsheet_id: str | None
spreadsheet_url: str | None
value_cells_written: NonNegativeInt
formula_cells_written: NonNegativeInt
protected_ranges_written: NonNegativeInt
tab_count: int
ranges_to_clear: tuple[str, ...]
value_cells_changed: int | None
value_cells_unchanged: int | None
formula_cells_to_write: int | None
class GoogleSheetsExportRemoteResult(**data)[source]

Bases: GoogleSheetsWorkbookWriteFacts

Safe normalized facts returned by the injected remote export port.

This is the sole application-side translation boundary for concrete Google preview and apply records. The port must return dry_run exactly as it received it, so an accidentally inverted composition cannot be settled as a successful operation.

Parameters:
class GoogleSheetsExportOperationResult(**data)[source]

Bases: GoogleSheetsWorkbookWriteFacts

Safe completed or previewed workbook facts retained in encrypted custody.

Parameters:
profile_id: UUID
modelo: ModeloId
revision: RevisionId
period: Period
engine_version: str
registry_sha: str
class GoogleSheetsExportPublicResultV1(**data)[source]

Bases: GoogleSheetsWorkbookWriteFacts

Renderer-neutral settled export result with no domain-only field types.

Parameters:
profile_id: UUID
modelo: ModeloId
revision: RevisionId
period: str
filing_year: FilingYear
engine_version: str
registry_sha: str
class GoogleSheetsExportPreparedPort(*args, **kwargs)[source]

Bases: Protocol

In-memory prepared transport whose remaining call may mutate remotely.

execute(plan, dry_run)[source]

Preview or apply the plan after configuration and authentication succeeded.

Return type:

GoogleSheetsExportRemoteResult

Parameters:
project_google_sheets_export_result(result, _terminal_receipt)[source]

Project the private settled result into its strict public V1 shape.

Return type:

BaseModel

Parameters:
  • result (BaseModel)

  • _terminal_receipt (object)

class GoogleSheetsExportService(*, prepare_port=<function _unconfigured_google_sheets_export_prepare_port>, snapshot_resolver=<function _resolve_snapshot>, plan_builder=<function build_export_plan>)[source]

Bases: object

Canonical application planning and remote handoff for one workbook export.

Parameters:
  • prepare_port (GoogleSheetsExportPreparePort)

  • snapshot_resolver (GoogleSnapshotResolver)

  • plan_builder (GoogleExportPlanBuilder)

execute(payload)[source]

Perform the synchronous application service for a frontend consumer.

The registered executor below owns supervision, durability, and effect truth. This service is deliberately the one reusable business path for legacy synchronous frontends while they are migrated to the supervisor; it never imports an adapter or constructs a concrete transport.

Return type:

GoogleSheetsExportOperationResult

Parameters:

payload (GoogleSheetsExportOperationRequest)

admit(payload)[source]

Apply the active-profile and egress-capability admissions once.

Return type:

str

Parameters:

payload (GoogleSheetsExportOperationRequest)

snapshot(payload)[source]

Resolve the exact temporal registry authority snapshot.

Return type:

RegistrySnapshot

Parameters:

payload (GoogleSheetsExportOperationRequest)

plan(snapshot, *, prefill_relations)[source]

Build one canonical workbook plan from the resolved snapshot.

Core types: RegistrySnapshot.

Return type:

SheetExportPlan

Parameters:
prepare(active_bucket_id)[source]

Resolve credentials and mandatory root configuration before mutation.

Return type:

GoogleSheetsExportPreparedPort

Parameters:

active_bucket_id (str)

remote(prepared, plan, *, dry_run)[source]

Cross the injected remote boundary without choosing an adapter.

Return type:

GoogleSheetsExportRemoteResult

Parameters:
static result(payload, snapshot, plan, remote)[source]

Normalize the safe, durable application result once.

Core types: RegistrySnapshot.

Return type:

GoogleSheetsExportOperationResult

Parameters:
class GoogleSheetsExportOperationExecutor(*, service)[source]

Bases: object

Run the sole Google calculation-workbook export under supervision.

Parameters:

service (GoogleSheetsExportService)

async execute(request, context)[source]

Plan, preview, or apply one export while preserving effect truth.

Return type:

str

Parameters:
build_google_sheets_export_operation_definition(*, prepare_port=<function _unconfigured_google_sheets_export_prepare_port>, snapshot_resolver=<function _resolve_snapshot>, plan_builder=<function build_export_plan>)[source]

Bind an injected remote-export port without importing concrete adapters.

Return type:

OperationDefinition

Parameters:
  • prepare_port (GoogleSheetsExportPreparePort)

  • snapshot_resolver (GoogleSnapshotResolver)

  • plan_builder (GoogleExportPlanBuilder)

build_google_sheets_export_service(*, prepare_port=<function _unconfigured_google_sheets_export_prepare_port>, snapshot_resolver=<function _resolve_snapshot>, plan_builder=<function build_export_plan>)[source]

Build the reusable application service from injected boundary ports.

Return type:

GoogleSheetsExportService

Parameters:
  • prepare_port (GoogleSheetsExportPreparePort)

  • snapshot_resolver (GoogleSnapshotResolver)

  • plan_builder (GoogleExportPlanBuilder)

build_google_sheets_export_operation_registration(definition)[source]

Bind the operation request and safe settled result to public identities.

Return type:

OperationPublicDefinitionRegistrationV1

Parameters:

definition (OperationDefinition)