cadrumo.domain.user_profile.registry_contract module

Cross-reference user-profile schema metadata against modelo registry use.

Validates every ModeloDefinition in the registry against the user-profile schema, checking that each ModeloRevision binding selector, filing schedule predicate, and deadline applicability condition maps to a declared profile fact path.

class UserProfileRegistryContractIssue(**data)[source]

Bases: BaseModel

One unresolved cross-reference between user-profile schema and modelos.

Parameters:

data (Any)

severity: Literal[BaseSeverity.ERROR, BaseSeverity.WARNING]
modelo_id: str
revision_id: RevisionId
surface: Literal['binding', 'filing_schedule', 'deadline_window', 'export_layout', 'cross_reference_applicability']
construct_id: str
selector: str
message: str
class UserProfileSelectorIndex(**data)[source]

Bases: BaseModel

Schema-owned selector namespaces consumed by modelo registry surfaces.

Parameters:

data (Any)

profile_selectors: frozenset[str]
schedule_predicates: frozenset[str]
field_paths: frozenset[str]
derived_selectors: tuple[ProfileDerivedSelectorDefinition, ...]

Namespaces the engine owns and computes. Kept as typed models rather than folded into profile_selectors because a pattern carrying a placeholder is not a literal set member – set membership could never see it – and because a caller resolving a selector this way needs to know WHICH pattern matched, not merely that one did.

class UserProfileRegistryContractReport(**data)[source]

Bases: BaseModel

Typed result for profile schema coverage against modelo registry usage.

Parameters:

data (Any)

schema_id: str
schema_version: int
checked_modelos: tuple[str, ...]
issues: tuple[UserProfileRegistryContractIssue, ...]
property errors: tuple[UserProfileRegistryContractIssue, ...]

Return blocking UserProfileRegistryContractIssue failures.

property warnings: tuple[UserProfileRegistryContractIssue, ...]

Return non-blocking UserProfileRegistryContractIssue coverage gaps.

property valid: bool

Return whether all blocking selector references resolve.

build_user_profile_selector_index(schema)[source]

Build the profile selector namespaces declared by the TOML schema.

Return type:

UserProfileSelectorIndex

Returns:

A UserProfileSelectorIndex with all declared selector namespaces.

Parameters:

schema (ProfileSchemaDefinition)

validate_user_profile_registry_contract(modelos, schema)[source]

Validate all profile-facing modelo registry references against the schema.

Blocking errors are reserved for model calculation and schedule selectors that cannot be resolved from schema-declared profile facts. Export header gaps are warnings during the rollout because several committed layouts use non-profile operational headers that will move behind an export-context backend rather than a live taxpayer profile fact.

Parameters:
Return type:

UserProfileRegistryContractReport

Returns:

A UserProfileRegistryContractReport with all issues found.

profile_binding_selectors(provider)[source]

Return the declared user-profile paths selected by one binding provider.

Only a ProfileProvider names a profile path; every other union member’s shape carries none, so it yields the empty tuple.

Return type:

tuple[str, ...]

Parameters:

provider (Annotated[ManualInputProvider | DesignConstantProvider | ProfileProvider | PreviousFilingProvider | RelationPrefillProvider | IvaCompensationAnnualPartitionProvider | M303RegimenSimplificadoAnnualSummaryProvider | ProrrataRegularizacionProvider | BienesInversionRegularizacionProvider | LedgerIvaProvider | LedgerOssProvider | LedgerRentaIncomeProvider | LedgerRentaGastosEstimacionDirectaProvider | LedgerRentaGastosPagoFraccionadoProvider | LedgerImpatriadoIncomeProvider | LedgerIrnrIncomeProvider | RetencionesAggregationProvider | WithholdingProvider | Withholding296Provider | LedgerTransactionProvider | PurchaseInvoiceEvidenceProvider | PayableInvoiceProvider | CollectibleInvoiceProvider | M347ThirdPartyOperationProvider | ForeignAssetProvider | RelatedPartyOperationProvider | AtribucionMemberProvider | RefundOperationProvider | DonativoDonorProvider | Gasto193ContributorProvider | InventoryProvider, FieldInfo(annotation=NoneType, required=True, discriminator='kind')])