omnibase_infra 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- omnibase_infra/__init__.py +101 -0
- omnibase_infra/cli/__init__.py +1 -0
- omnibase_infra/cli/commands.py +216 -0
- omnibase_infra/clients/__init__.py +0 -0
- omnibase_infra/contracts/handlers/filesystem/handler_contract.yaml +261 -0
- omnibase_infra/contracts/handlers/mcp/handler_contract.yaml +138 -0
- omnibase_infra/decorators/__init__.py +29 -0
- omnibase_infra/decorators/allow_any.py +109 -0
- omnibase_infra/dlq/__init__.py +90 -0
- omnibase_infra/dlq/constants_dlq.py +57 -0
- omnibase_infra/dlq/models/__init__.py +26 -0
- omnibase_infra/dlq/models/enum_replay_status.py +37 -0
- omnibase_infra/dlq/models/model_dlq_replay_record.py +135 -0
- omnibase_infra/dlq/models/model_dlq_tracking_config.py +184 -0
- omnibase_infra/dlq/service_dlq_tracking.py +611 -0
- omnibase_infra/enums/__init__.py +123 -0
- omnibase_infra/enums/enum_any_type_violation.py +104 -0
- omnibase_infra/enums/enum_backend_type.py +27 -0
- omnibase_infra/enums/enum_capture_outcome.py +42 -0
- omnibase_infra/enums/enum_capture_state.py +88 -0
- omnibase_infra/enums/enum_chain_violation_type.py +119 -0
- omnibase_infra/enums/enum_circuit_state.py +51 -0
- omnibase_infra/enums/enum_confirmation_event_type.py +27 -0
- omnibase_infra/enums/enum_contract_type.py +84 -0
- omnibase_infra/enums/enum_dedupe_strategy.py +46 -0
- omnibase_infra/enums/enum_dispatch_status.py +191 -0
- omnibase_infra/enums/enum_environment.py +46 -0
- omnibase_infra/enums/enum_execution_shape_violation.py +103 -0
- omnibase_infra/enums/enum_handler_error_type.py +101 -0
- omnibase_infra/enums/enum_handler_loader_error.py +178 -0
- omnibase_infra/enums/enum_handler_source_type.py +87 -0
- omnibase_infra/enums/enum_handler_type.py +77 -0
- omnibase_infra/enums/enum_handler_type_category.py +61 -0
- omnibase_infra/enums/enum_infra_transport_type.py +73 -0
- omnibase_infra/enums/enum_introspection_reason.py +154 -0
- omnibase_infra/enums/enum_message_category.py +213 -0
- omnibase_infra/enums/enum_node_archetype.py +74 -0
- omnibase_infra/enums/enum_node_output_type.py +185 -0
- omnibase_infra/enums/enum_non_retryable_error_category.py +224 -0
- omnibase_infra/enums/enum_policy_type.py +32 -0
- omnibase_infra/enums/enum_registration_state.py +261 -0
- omnibase_infra/enums/enum_registration_status.py +33 -0
- omnibase_infra/enums/enum_registry_response_status.py +28 -0
- omnibase_infra/enums/enum_response_status.py +26 -0
- omnibase_infra/enums/enum_retry_error_category.py +98 -0
- omnibase_infra/enums/enum_security_rule_id.py +103 -0
- omnibase_infra/enums/enum_selection_strategy.py +91 -0
- omnibase_infra/enums/enum_topic_standard.py +42 -0
- omnibase_infra/enums/enum_validation_severity.py +78 -0
- omnibase_infra/errors/__init__.py +156 -0
- omnibase_infra/errors/error_architecture_violation.py +152 -0
- omnibase_infra/errors/error_chain_propagation.py +188 -0
- omnibase_infra/errors/error_compute_registry.py +92 -0
- omnibase_infra/errors/error_consul.py +132 -0
- omnibase_infra/errors/error_container_wiring.py +243 -0
- omnibase_infra/errors/error_event_bus_registry.py +102 -0
- omnibase_infra/errors/error_infra.py +608 -0
- omnibase_infra/errors/error_message_type_registry.py +101 -0
- omnibase_infra/errors/error_policy_registry.py +112 -0
- omnibase_infra/errors/error_vault.py +123 -0
- omnibase_infra/event_bus/__init__.py +72 -0
- omnibase_infra/event_bus/configs/kafka_event_bus_config.yaml +86 -0
- omnibase_infra/event_bus/event_bus_inmemory.py +743 -0
- omnibase_infra/event_bus/event_bus_kafka.py +1658 -0
- omnibase_infra/event_bus/mixin_kafka_broadcast.py +184 -0
- omnibase_infra/event_bus/mixin_kafka_dlq.py +765 -0
- omnibase_infra/event_bus/models/__init__.py +29 -0
- omnibase_infra/event_bus/models/config/__init__.py +20 -0
- omnibase_infra/event_bus/models/config/model_kafka_event_bus_config.py +725 -0
- omnibase_infra/event_bus/models/model_dlq_event.py +206 -0
- omnibase_infra/event_bus/models/model_dlq_metrics.py +304 -0
- omnibase_infra/event_bus/models/model_event_headers.py +115 -0
- omnibase_infra/event_bus/models/model_event_message.py +60 -0
- omnibase_infra/event_bus/topic_constants.py +376 -0
- omnibase_infra/handlers/__init__.py +75 -0
- omnibase_infra/handlers/filesystem/__init__.py +48 -0
- omnibase_infra/handlers/filesystem/enum_file_system_operation.py +35 -0
- omnibase_infra/handlers/filesystem/model_file_system_request.py +298 -0
- omnibase_infra/handlers/filesystem/model_file_system_result.py +166 -0
- omnibase_infra/handlers/handler_consul.py +787 -0
- omnibase_infra/handlers/handler_db.py +1039 -0
- omnibase_infra/handlers/handler_filesystem.py +1478 -0
- omnibase_infra/handlers/handler_graph.py +1154 -0
- omnibase_infra/handlers/handler_http.py +920 -0
- omnibase_infra/handlers/handler_manifest_persistence.contract.yaml +184 -0
- omnibase_infra/handlers/handler_manifest_persistence.py +1539 -0
- omnibase_infra/handlers/handler_mcp.py +748 -0
- omnibase_infra/handlers/handler_qdrant.py +1076 -0
- omnibase_infra/handlers/handler_vault.py +422 -0
- omnibase_infra/handlers/mcp/__init__.py +19 -0
- omnibase_infra/handlers/mcp/adapter_onex_to_mcp.py +446 -0
- omnibase_infra/handlers/mcp/protocols.py +178 -0
- omnibase_infra/handlers/mcp/transport_streamable_http.py +352 -0
- omnibase_infra/handlers/mixins/__init__.py +42 -0
- omnibase_infra/handlers/mixins/mixin_consul_initialization.py +349 -0
- omnibase_infra/handlers/mixins/mixin_consul_kv.py +337 -0
- omnibase_infra/handlers/mixins/mixin_consul_service.py +277 -0
- omnibase_infra/handlers/mixins/mixin_vault_initialization.py +338 -0
- omnibase_infra/handlers/mixins/mixin_vault_retry.py +412 -0
- omnibase_infra/handlers/mixins/mixin_vault_secrets.py +450 -0
- omnibase_infra/handlers/mixins/mixin_vault_token.py +365 -0
- omnibase_infra/handlers/models/__init__.py +286 -0
- omnibase_infra/handlers/models/consul/__init__.py +81 -0
- omnibase_infra/handlers/models/consul/enum_consul_operation_type.py +57 -0
- omnibase_infra/handlers/models/consul/model_consul_deregister_payload.py +51 -0
- omnibase_infra/handlers/models/consul/model_consul_handler_config.py +153 -0
- omnibase_infra/handlers/models/consul/model_consul_handler_payload.py +89 -0
- omnibase_infra/handlers/models/consul/model_consul_kv_get_found_payload.py +55 -0
- omnibase_infra/handlers/models/consul/model_consul_kv_get_not_found_payload.py +49 -0
- omnibase_infra/handlers/models/consul/model_consul_kv_get_recurse_payload.py +50 -0
- omnibase_infra/handlers/models/consul/model_consul_kv_item.py +33 -0
- omnibase_infra/handlers/models/consul/model_consul_kv_put_payload.py +41 -0
- omnibase_infra/handlers/models/consul/model_consul_register_payload.py +53 -0
- omnibase_infra/handlers/models/consul/model_consul_retry_config.py +66 -0
- omnibase_infra/handlers/models/consul/model_payload_consul.py +66 -0
- omnibase_infra/handlers/models/consul/registry_payload_consul.py +214 -0
- omnibase_infra/handlers/models/graph/__init__.py +35 -0
- omnibase_infra/handlers/models/graph/enum_graph_operation_type.py +20 -0
- omnibase_infra/handlers/models/graph/model_graph_execute_payload.py +38 -0
- omnibase_infra/handlers/models/graph/model_graph_handler_config.py +54 -0
- omnibase_infra/handlers/models/graph/model_graph_handler_payload.py +44 -0
- omnibase_infra/handlers/models/graph/model_graph_query_payload.py +40 -0
- omnibase_infra/handlers/models/graph/model_graph_record.py +22 -0
- omnibase_infra/handlers/models/http/__init__.py +50 -0
- omnibase_infra/handlers/models/http/enum_http_operation_type.py +29 -0
- omnibase_infra/handlers/models/http/model_http_body_content.py +45 -0
- omnibase_infra/handlers/models/http/model_http_get_payload.py +88 -0
- omnibase_infra/handlers/models/http/model_http_handler_payload.py +90 -0
- omnibase_infra/handlers/models/http/model_http_post_payload.py +88 -0
- omnibase_infra/handlers/models/http/model_payload_http.py +66 -0
- omnibase_infra/handlers/models/http/registry_payload_http.py +212 -0
- omnibase_infra/handlers/models/mcp/__init__.py +23 -0
- omnibase_infra/handlers/models/mcp/enum_mcp_operation_type.py +24 -0
- omnibase_infra/handlers/models/mcp/model_mcp_handler_config.py +40 -0
- omnibase_infra/handlers/models/mcp/model_mcp_tool_call.py +32 -0
- omnibase_infra/handlers/models/mcp/model_mcp_tool_result.py +45 -0
- omnibase_infra/handlers/models/model_consul_handler_response.py +96 -0
- omnibase_infra/handlers/models/model_db_describe_response.py +83 -0
- omnibase_infra/handlers/models/model_db_query_payload.py +95 -0
- omnibase_infra/handlers/models/model_db_query_response.py +60 -0
- omnibase_infra/handlers/models/model_filesystem_config.py +98 -0
- omnibase_infra/handlers/models/model_filesystem_delete_payload.py +54 -0
- omnibase_infra/handlers/models/model_filesystem_delete_result.py +77 -0
- omnibase_infra/handlers/models/model_filesystem_directory_entry.py +75 -0
- omnibase_infra/handlers/models/model_filesystem_ensure_directory_payload.py +54 -0
- omnibase_infra/handlers/models/model_filesystem_ensure_directory_result.py +60 -0
- omnibase_infra/handlers/models/model_filesystem_list_directory_payload.py +60 -0
- omnibase_infra/handlers/models/model_filesystem_list_directory_result.py +68 -0
- omnibase_infra/handlers/models/model_filesystem_read_payload.py +62 -0
- omnibase_infra/handlers/models/model_filesystem_read_result.py +61 -0
- omnibase_infra/handlers/models/model_filesystem_write_payload.py +70 -0
- omnibase_infra/handlers/models/model_filesystem_write_result.py +55 -0
- omnibase_infra/handlers/models/model_graph_handler_response.py +98 -0
- omnibase_infra/handlers/models/model_handler_response.py +103 -0
- omnibase_infra/handlers/models/model_http_handler_response.py +101 -0
- omnibase_infra/handlers/models/model_manifest_metadata.py +75 -0
- omnibase_infra/handlers/models/model_manifest_persistence_config.py +62 -0
- omnibase_infra/handlers/models/model_manifest_query_payload.py +90 -0
- omnibase_infra/handlers/models/model_manifest_query_result.py +97 -0
- omnibase_infra/handlers/models/model_manifest_retrieve_payload.py +44 -0
- omnibase_infra/handlers/models/model_manifest_retrieve_result.py +98 -0
- omnibase_infra/handlers/models/model_manifest_store_payload.py +47 -0
- omnibase_infra/handlers/models/model_manifest_store_result.py +67 -0
- omnibase_infra/handlers/models/model_operation_context.py +187 -0
- omnibase_infra/handlers/models/model_qdrant_handler_response.py +98 -0
- omnibase_infra/handlers/models/model_retry_state.py +162 -0
- omnibase_infra/handlers/models/model_vault_handler_response.py +98 -0
- omnibase_infra/handlers/models/qdrant/__init__.py +44 -0
- omnibase_infra/handlers/models/qdrant/enum_qdrant_operation_type.py +26 -0
- omnibase_infra/handlers/models/qdrant/model_qdrant_collection_payload.py +42 -0
- omnibase_infra/handlers/models/qdrant/model_qdrant_delete_payload.py +36 -0
- omnibase_infra/handlers/models/qdrant/model_qdrant_handler_config.py +42 -0
- omnibase_infra/handlers/models/qdrant/model_qdrant_handler_payload.py +54 -0
- omnibase_infra/handlers/models/qdrant/model_qdrant_search_payload.py +42 -0
- omnibase_infra/handlers/models/qdrant/model_qdrant_search_result.py +30 -0
- omnibase_infra/handlers/models/qdrant/model_qdrant_upsert_payload.py +36 -0
- omnibase_infra/handlers/models/vault/__init__.py +69 -0
- omnibase_infra/handlers/models/vault/enum_vault_operation_type.py +35 -0
- omnibase_infra/handlers/models/vault/model_payload_vault.py +66 -0
- omnibase_infra/handlers/models/vault/model_vault_delete_payload.py +57 -0
- omnibase_infra/handlers/models/vault/model_vault_handler_config.py +148 -0
- omnibase_infra/handlers/models/vault/model_vault_handler_payload.py +101 -0
- omnibase_infra/handlers/models/vault/model_vault_list_payload.py +58 -0
- omnibase_infra/handlers/models/vault/model_vault_renew_token_payload.py +67 -0
- omnibase_infra/handlers/models/vault/model_vault_retry_config.py +66 -0
- omnibase_infra/handlers/models/vault/model_vault_secret_payload.py +106 -0
- omnibase_infra/handlers/models/vault/model_vault_write_payload.py +66 -0
- omnibase_infra/handlers/models/vault/registry_payload_vault.py +213 -0
- omnibase_infra/handlers/registration_storage/__init__.py +43 -0
- omnibase_infra/handlers/registration_storage/handler_registration_storage_mock.py +392 -0
- omnibase_infra/handlers/registration_storage/handler_registration_storage_postgres.py +915 -0
- omnibase_infra/handlers/registration_storage/models/__init__.py +23 -0
- omnibase_infra/handlers/registration_storage/models/model_delete_registration_request.py +58 -0
- omnibase_infra/handlers/registration_storage/models/model_update_registration_request.py +73 -0
- omnibase_infra/handlers/registration_storage/protocol_registration_persistence.py +191 -0
- omnibase_infra/handlers/service_discovery/__init__.py +43 -0
- omnibase_infra/handlers/service_discovery/handler_service_discovery_consul.py +747 -0
- omnibase_infra/handlers/service_discovery/handler_service_discovery_mock.py +258 -0
- omnibase_infra/handlers/service_discovery/models/__init__.py +22 -0
- omnibase_infra/handlers/service_discovery/models/model_discovery_result.py +64 -0
- omnibase_infra/handlers/service_discovery/models/model_registration_result.py +138 -0
- omnibase_infra/handlers/service_discovery/models/model_service_info.py +99 -0
- omnibase_infra/handlers/service_discovery/protocol_discovery_operations.py +170 -0
- omnibase_infra/idempotency/__init__.py +94 -0
- omnibase_infra/idempotency/models/__init__.py +43 -0
- omnibase_infra/idempotency/models/model_idempotency_check_result.py +85 -0
- omnibase_infra/idempotency/models/model_idempotency_guard_config.py +130 -0
- omnibase_infra/idempotency/models/model_idempotency_record.py +86 -0
- omnibase_infra/idempotency/models/model_idempotency_store_health_check_result.py +81 -0
- omnibase_infra/idempotency/models/model_idempotency_store_metrics.py +140 -0
- omnibase_infra/idempotency/models/model_postgres_idempotency_store_config.py +299 -0
- omnibase_infra/idempotency/protocol_idempotency_store.py +184 -0
- omnibase_infra/idempotency/store_inmemory.py +265 -0
- omnibase_infra/idempotency/store_postgres.py +923 -0
- omnibase_infra/infrastructure/__init__.py +0 -0
- omnibase_infra/mixins/__init__.py +71 -0
- omnibase_infra/mixins/mixin_async_circuit_breaker.py +655 -0
- omnibase_infra/mixins/mixin_dict_like_accessors.py +146 -0
- omnibase_infra/mixins/mixin_envelope_extraction.py +119 -0
- omnibase_infra/mixins/mixin_node_introspection.py +2465 -0
- omnibase_infra/mixins/mixin_retry_execution.py +386 -0
- omnibase_infra/mixins/protocol_circuit_breaker_aware.py +133 -0
- omnibase_infra/models/__init__.py +136 -0
- omnibase_infra/models/corpus/__init__.py +17 -0
- omnibase_infra/models/corpus/model_capture_config.py +133 -0
- omnibase_infra/models/corpus/model_capture_result.py +86 -0
- omnibase_infra/models/discovery/__init__.py +42 -0
- omnibase_infra/models/discovery/model_dependency_spec.py +319 -0
- omnibase_infra/models/discovery/model_discovered_capabilities.py +50 -0
- omnibase_infra/models/discovery/model_introspection_config.py +311 -0
- omnibase_infra/models/discovery/model_introspection_performance_metrics.py +169 -0
- omnibase_infra/models/discovery/model_introspection_task_config.py +116 -0
- omnibase_infra/models/dispatch/__init__.py +147 -0
- omnibase_infra/models/dispatch/model_dispatch_context.py +439 -0
- omnibase_infra/models/dispatch/model_dispatch_error.py +336 -0
- omnibase_infra/models/dispatch/model_dispatch_log_context.py +400 -0
- omnibase_infra/models/dispatch/model_dispatch_metadata.py +228 -0
- omnibase_infra/models/dispatch/model_dispatch_metrics.py +496 -0
- omnibase_infra/models/dispatch/model_dispatch_outcome.py +317 -0
- omnibase_infra/models/dispatch/model_dispatch_outputs.py +231 -0
- omnibase_infra/models/dispatch/model_dispatch_result.py +436 -0
- omnibase_infra/models/dispatch/model_dispatch_route.py +279 -0
- omnibase_infra/models/dispatch/model_dispatcher_metrics.py +275 -0
- omnibase_infra/models/dispatch/model_dispatcher_registration.py +352 -0
- omnibase_infra/models/dispatch/model_parsed_topic.py +135 -0
- omnibase_infra/models/dispatch/model_topic_parser.py +725 -0
- omnibase_infra/models/dispatch/model_tracing_context.py +285 -0
- omnibase_infra/models/errors/__init__.py +45 -0
- omnibase_infra/models/errors/model_handler_validation_error.py +594 -0
- omnibase_infra/models/errors/model_infra_error_context.py +99 -0
- omnibase_infra/models/errors/model_message_type_registry_error_context.py +71 -0
- omnibase_infra/models/errors/model_timeout_error_context.py +110 -0
- omnibase_infra/models/handlers/__init__.py +37 -0
- omnibase_infra/models/handlers/model_contract_discovery_result.py +80 -0
- omnibase_infra/models/handlers/model_handler_descriptor.py +185 -0
- omnibase_infra/models/handlers/model_handler_identifier.py +215 -0
- omnibase_infra/models/health/__init__.py +9 -0
- omnibase_infra/models/health/model_health_check_result.py +40 -0
- omnibase_infra/models/lifecycle/__init__.py +39 -0
- omnibase_infra/models/logging/__init__.py +51 -0
- omnibase_infra/models/logging/model_log_context.py +756 -0
- omnibase_infra/models/model_retry_error_classification.py +78 -0
- omnibase_infra/models/projection/__init__.py +43 -0
- omnibase_infra/models/projection/model_capability_fields.py +112 -0
- omnibase_infra/models/projection/model_registration_projection.py +434 -0
- omnibase_infra/models/projection/model_registration_snapshot.py +322 -0
- omnibase_infra/models/projection/model_sequence_info.py +182 -0
- omnibase_infra/models/projection/model_snapshot_topic_config.py +590 -0
- omnibase_infra/models/projectors/__init__.py +41 -0
- omnibase_infra/models/projectors/model_projector_column.py +289 -0
- omnibase_infra/models/projectors/model_projector_discovery_result.py +65 -0
- omnibase_infra/models/projectors/model_projector_index.py +270 -0
- omnibase_infra/models/projectors/model_projector_schema.py +415 -0
- omnibase_infra/models/projectors/model_projector_validation_error.py +63 -0
- omnibase_infra/models/projectors/util_sql_identifiers.py +115 -0
- omnibase_infra/models/registration/__init__.py +59 -0
- omnibase_infra/models/registration/commands/__init__.py +15 -0
- omnibase_infra/models/registration/commands/model_node_registration_acked.py +108 -0
- omnibase_infra/models/registration/events/__init__.py +56 -0
- omnibase_infra/models/registration/events/model_node_became_active.py +103 -0
- omnibase_infra/models/registration/events/model_node_liveness_expired.py +103 -0
- omnibase_infra/models/registration/events/model_node_registration_accepted.py +98 -0
- omnibase_infra/models/registration/events/model_node_registration_ack_received.py +98 -0
- omnibase_infra/models/registration/events/model_node_registration_ack_timed_out.py +112 -0
- omnibase_infra/models/registration/events/model_node_registration_initiated.py +107 -0
- omnibase_infra/models/registration/events/model_node_registration_rejected.py +104 -0
- omnibase_infra/models/registration/model_introspection_metrics.py +253 -0
- omnibase_infra/models/registration/model_node_capabilities.py +179 -0
- omnibase_infra/models/registration/model_node_heartbeat_event.py +126 -0
- omnibase_infra/models/registration/model_node_introspection_event.py +175 -0
- omnibase_infra/models/registration/model_node_metadata.py +79 -0
- omnibase_infra/models/registration/model_node_registration.py +162 -0
- omnibase_infra/models/registration/model_node_registration_record.py +162 -0
- omnibase_infra/models/registry/__init__.py +29 -0
- omnibase_infra/models/registry/model_domain_constraint.py +202 -0
- omnibase_infra/models/registry/model_message_type_entry.py +271 -0
- omnibase_infra/models/resilience/__init__.py +9 -0
- omnibase_infra/models/resilience/model_circuit_breaker_config.py +227 -0
- omnibase_infra/models/routing/__init__.py +25 -0
- omnibase_infra/models/routing/model_routing_entry.py +52 -0
- omnibase_infra/models/routing/model_routing_subcontract.py +70 -0
- omnibase_infra/models/runtime/__init__.py +40 -0
- omnibase_infra/models/runtime/model_contract_security_config.py +41 -0
- omnibase_infra/models/runtime/model_discovery_error.py +81 -0
- omnibase_infra/models/runtime/model_discovery_result.py +162 -0
- omnibase_infra/models/runtime/model_discovery_warning.py +74 -0
- omnibase_infra/models/runtime/model_failed_plugin_load.py +63 -0
- omnibase_infra/models/runtime/model_handler_contract.py +280 -0
- omnibase_infra/models/runtime/model_loaded_handler.py +120 -0
- omnibase_infra/models/runtime/model_plugin_load_context.py +93 -0
- omnibase_infra/models/runtime/model_plugin_load_summary.py +124 -0
- omnibase_infra/models/security/__init__.py +50 -0
- omnibase_infra/models/security/classification_levels.py +99 -0
- omnibase_infra/models/security/model_environment_policy.py +145 -0
- omnibase_infra/models/security/model_handler_security_policy.py +107 -0
- omnibase_infra/models/security/model_security_error.py +81 -0
- omnibase_infra/models/security/model_security_validation_result.py +328 -0
- omnibase_infra/models/security/model_security_warning.py +67 -0
- omnibase_infra/models/snapshot/__init__.py +27 -0
- omnibase_infra/models/snapshot/model_field_change.py +65 -0
- omnibase_infra/models/snapshot/model_snapshot.py +270 -0
- omnibase_infra/models/snapshot/model_snapshot_diff.py +203 -0
- omnibase_infra/models/snapshot/model_subject_ref.py +81 -0
- omnibase_infra/models/types/__init__.py +71 -0
- omnibase_infra/models/validation/__init__.py +89 -0
- omnibase_infra/models/validation/model_any_type_validation_result.py +118 -0
- omnibase_infra/models/validation/model_any_type_violation.py +141 -0
- omnibase_infra/models/validation/model_category_match_result.py +345 -0
- omnibase_infra/models/validation/model_chain_violation.py +166 -0
- omnibase_infra/models/validation/model_coverage_metrics.py +316 -0
- omnibase_infra/models/validation/model_execution_shape_rule.py +159 -0
- omnibase_infra/models/validation/model_execution_shape_validation.py +208 -0
- omnibase_infra/models/validation/model_execution_shape_validation_result.py +294 -0
- omnibase_infra/models/validation/model_execution_shape_violation.py +122 -0
- omnibase_infra/models/validation/model_localhandler_validation_result.py +139 -0
- omnibase_infra/models/validation/model_localhandler_violation.py +100 -0
- omnibase_infra/models/validation/model_output_validation_params.py +74 -0
- omnibase_infra/models/validation/model_validate_and_raise_params.py +84 -0
- omnibase_infra/models/validation/model_validation_error_params.py +84 -0
- omnibase_infra/models/validation/model_validation_outcome.py +287 -0
- omnibase_infra/nodes/__init__.py +48 -0
- omnibase_infra/nodes/architecture_validator/__init__.py +79 -0
- omnibase_infra/nodes/architecture_validator/contract.yaml +252 -0
- omnibase_infra/nodes/architecture_validator/contract_architecture_validator.yaml +208 -0
- omnibase_infra/nodes/architecture_validator/mixins/__init__.py +16 -0
- omnibase_infra/nodes/architecture_validator/mixins/mixin_file_path_rule.py +92 -0
- omnibase_infra/nodes/architecture_validator/models/__init__.py +36 -0
- omnibase_infra/nodes/architecture_validator/models/model_architecture_validation_request.py +56 -0
- omnibase_infra/nodes/architecture_validator/models/model_architecture_validation_result.py +311 -0
- omnibase_infra/nodes/architecture_validator/models/model_architecture_violation.py +163 -0
- omnibase_infra/nodes/architecture_validator/models/model_rule_check_result.py +265 -0
- omnibase_infra/nodes/architecture_validator/models/model_validation_request.py +105 -0
- omnibase_infra/nodes/architecture_validator/models/model_validation_result.py +314 -0
- omnibase_infra/nodes/architecture_validator/node.py +262 -0
- omnibase_infra/nodes/architecture_validator/node_architecture_validator.py +383 -0
- omnibase_infra/nodes/architecture_validator/protocols/__init__.py +9 -0
- omnibase_infra/nodes/architecture_validator/protocols/protocol_architecture_rule.py +225 -0
- omnibase_infra/nodes/architecture_validator/registry/__init__.py +28 -0
- omnibase_infra/nodes/architecture_validator/registry/registry_infra_architecture_validator.py +99 -0
- omnibase_infra/nodes/architecture_validator/validators/__init__.py +104 -0
- omnibase_infra/nodes/architecture_validator/validators/validator_no_direct_dispatch.py +422 -0
- omnibase_infra/nodes/architecture_validator/validators/validator_no_handler_publishing.py +481 -0
- omnibase_infra/nodes/architecture_validator/validators/validator_no_orchestrator_fsm.py +491 -0
- omnibase_infra/nodes/effects/README.md +358 -0
- omnibase_infra/nodes/effects/__init__.py +26 -0
- omnibase_infra/nodes/effects/contract.yaml +172 -0
- omnibase_infra/nodes/effects/models/__init__.py +32 -0
- omnibase_infra/nodes/effects/models/model_backend_result.py +190 -0
- omnibase_infra/nodes/effects/models/model_effect_idempotency_config.py +92 -0
- omnibase_infra/nodes/effects/models/model_registry_request.py +132 -0
- omnibase_infra/nodes/effects/models/model_registry_response.py +263 -0
- omnibase_infra/nodes/effects/protocol_consul_client.py +89 -0
- omnibase_infra/nodes/effects/protocol_effect_idempotency_store.py +143 -0
- omnibase_infra/nodes/effects/protocol_postgres_adapter.py +96 -0
- omnibase_infra/nodes/effects/registry_effect.py +525 -0
- omnibase_infra/nodes/effects/store_effect_idempotency_inmemory.py +425 -0
- omnibase_infra/nodes/node_registration_orchestrator/README.md +542 -0
- omnibase_infra/nodes/node_registration_orchestrator/__init__.py +120 -0
- omnibase_infra/nodes/node_registration_orchestrator/contract.yaml +475 -0
- omnibase_infra/nodes/node_registration_orchestrator/dispatchers/__init__.py +53 -0
- omnibase_infra/nodes/node_registration_orchestrator/dispatchers/dispatcher_node_introspected.py +376 -0
- omnibase_infra/nodes/node_registration_orchestrator/dispatchers/dispatcher_node_registration_acked.py +376 -0
- omnibase_infra/nodes/node_registration_orchestrator/dispatchers/dispatcher_runtime_tick.py +373 -0
- omnibase_infra/nodes/node_registration_orchestrator/handlers/__init__.py +62 -0
- omnibase_infra/nodes/node_registration_orchestrator/handlers/handler_node_heartbeat.py +376 -0
- omnibase_infra/nodes/node_registration_orchestrator/handlers/handler_node_introspected.py +609 -0
- omnibase_infra/nodes/node_registration_orchestrator/handlers/handler_node_registration_acked.py +458 -0
- omnibase_infra/nodes/node_registration_orchestrator/handlers/handler_runtime_tick.py +364 -0
- omnibase_infra/nodes/node_registration_orchestrator/introspection_event_router.py +544 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/__init__.py +75 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_consul_intent_payload.py +194 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_consul_registration_intent.py +67 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_intent_execution_result.py +50 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_node_liveness_expired.py +107 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_orchestrator_config.py +67 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_orchestrator_input.py +41 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_orchestrator_output.py +166 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_postgres_intent_payload.py +235 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_postgres_upsert_intent.py +68 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_reducer_execution_result.py +384 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_reducer_state.py +60 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_registration_intent.py +177 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_registry_intent.py +247 -0
- omnibase_infra/nodes/node_registration_orchestrator/node.py +195 -0
- omnibase_infra/nodes/node_registration_orchestrator/plugin.py +909 -0
- omnibase_infra/nodes/node_registration_orchestrator/protocols.py +439 -0
- omnibase_infra/nodes/node_registration_orchestrator/registry/__init__.py +41 -0
- omnibase_infra/nodes/node_registration_orchestrator/registry/registry_infra_node_registration_orchestrator.py +525 -0
- omnibase_infra/nodes/node_registration_orchestrator/timeout_coordinator.py +392 -0
- omnibase_infra/nodes/node_registration_orchestrator/wiring.py +742 -0
- omnibase_infra/nodes/node_registration_reducer/__init__.py +15 -0
- omnibase_infra/nodes/node_registration_reducer/contract.yaml +301 -0
- omnibase_infra/nodes/node_registration_reducer/models/__init__.py +38 -0
- omnibase_infra/nodes/node_registration_reducer/models/model_validation_result.py +113 -0
- omnibase_infra/nodes/node_registration_reducer/node.py +139 -0
- omnibase_infra/nodes/node_registration_reducer/registry/__init__.py +9 -0
- omnibase_infra/nodes/node_registration_reducer/registry/registry_infra_node_registration_reducer.py +79 -0
- omnibase_infra/nodes/node_registration_storage_effect/__init__.py +41 -0
- omnibase_infra/nodes/node_registration_storage_effect/contract.yaml +225 -0
- omnibase_infra/nodes/node_registration_storage_effect/models/__init__.py +44 -0
- omnibase_infra/nodes/node_registration_storage_effect/models/model_delete_result.py +132 -0
- omnibase_infra/nodes/node_registration_storage_effect/models/model_registration_record.py +199 -0
- omnibase_infra/nodes/node_registration_storage_effect/models/model_registration_update.py +155 -0
- omnibase_infra/nodes/node_registration_storage_effect/models/model_storage_health_check_details.py +123 -0
- omnibase_infra/nodes/node_registration_storage_effect/models/model_storage_health_check_result.py +117 -0
- omnibase_infra/nodes/node_registration_storage_effect/models/model_storage_query.py +100 -0
- omnibase_infra/nodes/node_registration_storage_effect/models/model_storage_result.py +136 -0
- omnibase_infra/nodes/node_registration_storage_effect/models/model_upsert_result.py +127 -0
- omnibase_infra/nodes/node_registration_storage_effect/node.py +109 -0
- omnibase_infra/nodes/node_registration_storage_effect/protocols/__init__.py +22 -0
- omnibase_infra/nodes/node_registration_storage_effect/protocols/protocol_registration_persistence.py +333 -0
- omnibase_infra/nodes/node_registration_storage_effect/registry/__init__.py +23 -0
- omnibase_infra/nodes/node_registration_storage_effect/registry/registry_infra_registration_storage.py +194 -0
- omnibase_infra/nodes/node_registry_effect/__init__.py +85 -0
- omnibase_infra/nodes/node_registry_effect/contract.yaml +682 -0
- omnibase_infra/nodes/node_registry_effect/handlers/__init__.py +70 -0
- omnibase_infra/nodes/node_registry_effect/handlers/handler_consul_deregister.py +211 -0
- omnibase_infra/nodes/node_registry_effect/handlers/handler_consul_register.py +212 -0
- omnibase_infra/nodes/node_registry_effect/handlers/handler_partial_retry.py +416 -0
- omnibase_infra/nodes/node_registry_effect/handlers/handler_postgres_deactivate.py +215 -0
- omnibase_infra/nodes/node_registry_effect/handlers/handler_postgres_upsert.py +208 -0
- omnibase_infra/nodes/node_registry_effect/models/__init__.py +43 -0
- omnibase_infra/nodes/node_registry_effect/models/model_partial_retry_request.py +92 -0
- omnibase_infra/nodes/node_registry_effect/node.py +165 -0
- omnibase_infra/nodes/node_registry_effect/registry/__init__.py +27 -0
- omnibase_infra/nodes/node_registry_effect/registry/registry_infra_registry_effect.py +196 -0
- omnibase_infra/nodes/node_service_discovery_effect/__init__.py +111 -0
- omnibase_infra/nodes/node_service_discovery_effect/contract.yaml +246 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/__init__.py +67 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/enum_health_status.py +72 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/enum_service_discovery_operation.py +58 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/model_discovery_query.py +99 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/model_discovery_result.py +98 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/model_health_check_config.py +121 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/model_query_metadata.py +63 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/model_registration_result.py +130 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/model_service_discovery_health_check_details.py +111 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/model_service_discovery_health_check_result.py +119 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/model_service_info.py +106 -0
- omnibase_infra/nodes/node_service_discovery_effect/models/model_service_registration.py +121 -0
- omnibase_infra/nodes/node_service_discovery_effect/node.py +111 -0
- omnibase_infra/nodes/node_service_discovery_effect/protocols/__init__.py +14 -0
- omnibase_infra/nodes/node_service_discovery_effect/protocols/protocol_discovery_operations.py +279 -0
- omnibase_infra/nodes/node_service_discovery_effect/registry/__init__.py +13 -0
- omnibase_infra/nodes/node_service_discovery_effect/registry/registry_infra_service_discovery.py +214 -0
- omnibase_infra/nodes/reducers/__init__.py +30 -0
- omnibase_infra/nodes/reducers/models/__init__.py +32 -0
- omnibase_infra/nodes/reducers/models/model_payload_consul_register.py +76 -0
- omnibase_infra/nodes/reducers/models/model_payload_postgres_upsert_registration.py +60 -0
- omnibase_infra/nodes/reducers/models/model_registration_confirmation.py +166 -0
- omnibase_infra/nodes/reducers/models/model_registration_state.py +433 -0
- omnibase_infra/nodes/reducers/registration_reducer.py +1137 -0
- omnibase_infra/observability/__init__.py +143 -0
- omnibase_infra/observability/constants_metrics.py +91 -0
- omnibase_infra/observability/factory_observability_sink.py +525 -0
- omnibase_infra/observability/handlers/__init__.py +118 -0
- omnibase_infra/observability/handlers/handler_logging_structured.py +967 -0
- omnibase_infra/observability/handlers/handler_metrics_prometheus.py +1120 -0
- omnibase_infra/observability/handlers/model_logging_handler_config.py +71 -0
- omnibase_infra/observability/handlers/model_logging_handler_response.py +77 -0
- omnibase_infra/observability/handlers/model_metrics_handler_config.py +172 -0
- omnibase_infra/observability/handlers/model_metrics_handler_payload.py +135 -0
- omnibase_infra/observability/handlers/model_metrics_handler_response.py +101 -0
- omnibase_infra/observability/hooks/__init__.py +74 -0
- omnibase_infra/observability/hooks/hook_observability.py +1223 -0
- omnibase_infra/observability/models/__init__.py +30 -0
- omnibase_infra/observability/models/enum_required_log_context_key.py +77 -0
- omnibase_infra/observability/models/model_buffered_log_entry.py +117 -0
- omnibase_infra/observability/models/model_logging_sink_config.py +73 -0
- omnibase_infra/observability/models/model_metrics_sink_config.py +156 -0
- omnibase_infra/observability/sinks/__init__.py +69 -0
- omnibase_infra/observability/sinks/sink_logging_structured.py +809 -0
- omnibase_infra/observability/sinks/sink_metrics_prometheus.py +710 -0
- omnibase_infra/plugins/__init__.py +27 -0
- omnibase_infra/plugins/examples/__init__.py +28 -0
- omnibase_infra/plugins/examples/plugin_json_normalizer.py +271 -0
- omnibase_infra/plugins/examples/plugin_json_normalizer_error_handling.py +210 -0
- omnibase_infra/plugins/models/__init__.py +21 -0
- omnibase_infra/plugins/models/model_plugin_context.py +76 -0
- omnibase_infra/plugins/models/model_plugin_input_data.py +58 -0
- omnibase_infra/plugins/models/model_plugin_output_data.py +62 -0
- omnibase_infra/plugins/plugin_compute_base.py +435 -0
- omnibase_infra/projectors/__init__.py +30 -0
- omnibase_infra/projectors/contracts/__init__.py +63 -0
- omnibase_infra/projectors/contracts/registration_projector.yaml +370 -0
- omnibase_infra/projectors/projection_reader_registration.py +1559 -0
- omnibase_infra/projectors/snapshot_publisher_registration.py +1329 -0
- omnibase_infra/protocols/__init__.py +99 -0
- omnibase_infra/protocols/protocol_capability_projection.py +253 -0
- omnibase_infra/protocols/protocol_capability_query.py +251 -0
- omnibase_infra/protocols/protocol_event_bus_like.py +127 -0
- omnibase_infra/protocols/protocol_event_projector.py +96 -0
- omnibase_infra/protocols/protocol_idempotency_store.py +142 -0
- omnibase_infra/protocols/protocol_message_dispatcher.py +247 -0
- omnibase_infra/protocols/protocol_message_type_registry.py +306 -0
- omnibase_infra/protocols/protocol_plugin_compute.py +368 -0
- omnibase_infra/protocols/protocol_projector_schema_validator.py +82 -0
- omnibase_infra/protocols/protocol_registry_metrics.py +215 -0
- omnibase_infra/protocols/protocol_snapshot_publisher.py +396 -0
- omnibase_infra/protocols/protocol_snapshot_store.py +567 -0
- omnibase_infra/runtime/__init__.py +296 -0
- omnibase_infra/runtime/binding_config_resolver.py +2706 -0
- omnibase_infra/runtime/chain_aware_dispatch.py +467 -0
- omnibase_infra/runtime/contract_handler_discovery.py +582 -0
- omnibase_infra/runtime/contract_loaders/__init__.py +42 -0
- omnibase_infra/runtime/contract_loaders/handler_routing_loader.py +464 -0
- omnibase_infra/runtime/dispatch_context_enforcer.py +427 -0
- omnibase_infra/runtime/enums/__init__.py +18 -0
- omnibase_infra/runtime/enums/enum_config_ref_scheme.py +33 -0
- omnibase_infra/runtime/enums/enum_scheduler_status.py +170 -0
- omnibase_infra/runtime/envelope_validator.py +179 -0
- omnibase_infra/runtime/handler_contract_source.py +669 -0
- omnibase_infra/runtime/handler_plugin_loader.py +2029 -0
- omnibase_infra/runtime/handler_registry.py +321 -0
- omnibase_infra/runtime/invocation_security_enforcer.py +427 -0
- omnibase_infra/runtime/kernel.py +40 -0
- omnibase_infra/runtime/mixin_policy_validation.py +522 -0
- omnibase_infra/runtime/mixin_semver_cache.py +378 -0
- omnibase_infra/runtime/mixins/__init__.py +17 -0
- omnibase_infra/runtime/mixins/mixin_projector_sql_operations.py +757 -0
- omnibase_infra/runtime/models/__init__.py +192 -0
- omnibase_infra/runtime/models/model_batch_lifecycle_result.py +217 -0
- omnibase_infra/runtime/models/model_binding_config.py +168 -0
- omnibase_infra/runtime/models/model_binding_config_cache_stats.py +135 -0
- omnibase_infra/runtime/models/model_binding_config_resolver_config.py +329 -0
- omnibase_infra/runtime/models/model_cached_secret.py +138 -0
- omnibase_infra/runtime/models/model_compute_key.py +138 -0
- omnibase_infra/runtime/models/model_compute_registration.py +97 -0
- omnibase_infra/runtime/models/model_config_cache_entry.py +61 -0
- omnibase_infra/runtime/models/model_config_ref.py +331 -0
- omnibase_infra/runtime/models/model_config_ref_parse_result.py +125 -0
- omnibase_infra/runtime/models/model_domain_plugin_config.py +92 -0
- omnibase_infra/runtime/models/model_domain_plugin_result.py +270 -0
- omnibase_infra/runtime/models/model_duplicate_response.py +54 -0
- omnibase_infra/runtime/models/model_enabled_protocols_config.py +61 -0
- omnibase_infra/runtime/models/model_event_bus_config.py +54 -0
- omnibase_infra/runtime/models/model_failed_component.py +55 -0
- omnibase_infra/runtime/models/model_health_check_response.py +168 -0
- omnibase_infra/runtime/models/model_health_check_result.py +228 -0
- omnibase_infra/runtime/models/model_lifecycle_result.py +245 -0
- omnibase_infra/runtime/models/model_logging_config.py +42 -0
- omnibase_infra/runtime/models/model_optional_correlation_id.py +167 -0
- omnibase_infra/runtime/models/model_optional_string.py +94 -0
- omnibase_infra/runtime/models/model_optional_uuid.py +110 -0
- omnibase_infra/runtime/models/model_policy_context.py +100 -0
- omnibase_infra/runtime/models/model_policy_key.py +138 -0
- omnibase_infra/runtime/models/model_policy_registration.py +139 -0
- omnibase_infra/runtime/models/model_policy_result.py +103 -0
- omnibase_infra/runtime/models/model_policy_type_filter.py +157 -0
- omnibase_infra/runtime/models/model_projector_plugin_loader_config.py +47 -0
- omnibase_infra/runtime/models/model_protocol_registration_config.py +65 -0
- omnibase_infra/runtime/models/model_retry_policy.py +105 -0
- omnibase_infra/runtime/models/model_runtime_config.py +150 -0
- omnibase_infra/runtime/models/model_runtime_scheduler_config.py +624 -0
- omnibase_infra/runtime/models/model_runtime_scheduler_metrics.py +233 -0
- omnibase_infra/runtime/models/model_runtime_tick.py +193 -0
- omnibase_infra/runtime/models/model_secret_cache_stats.py +82 -0
- omnibase_infra/runtime/models/model_secret_mapping.py +63 -0
- omnibase_infra/runtime/models/model_secret_resolver_config.py +107 -0
- omnibase_infra/runtime/models/model_secret_resolver_metrics.py +111 -0
- omnibase_infra/runtime/models/model_secret_source_info.py +72 -0
- omnibase_infra/runtime/models/model_secret_source_spec.py +66 -0
- omnibase_infra/runtime/models/model_shutdown_batch_result.py +75 -0
- omnibase_infra/runtime/models/model_shutdown_config.py +94 -0
- omnibase_infra/runtime/projector_plugin_loader.py +1462 -0
- omnibase_infra/runtime/projector_schema_manager.py +565 -0
- omnibase_infra/runtime/projector_shell.py +1102 -0
- omnibase_infra/runtime/protocol_contract_descriptor.py +92 -0
- omnibase_infra/runtime/protocol_contract_source.py +92 -0
- omnibase_infra/runtime/protocol_domain_plugin.py +474 -0
- omnibase_infra/runtime/protocol_handler_discovery.py +221 -0
- omnibase_infra/runtime/protocol_handler_plugin_loader.py +327 -0
- omnibase_infra/runtime/protocol_lifecycle_executor.py +435 -0
- omnibase_infra/runtime/protocol_policy.py +366 -0
- omnibase_infra/runtime/protocols/__init__.py +27 -0
- omnibase_infra/runtime/protocols/protocol_runtime_scheduler.py +468 -0
- omnibase_infra/runtime/registry/__init__.py +93 -0
- omnibase_infra/runtime/registry/mixin_message_type_query.py +326 -0
- omnibase_infra/runtime/registry/mixin_message_type_registration.py +354 -0
- omnibase_infra/runtime/registry/registry_event_bus_binding.py +268 -0
- omnibase_infra/runtime/registry/registry_message_type.py +542 -0
- omnibase_infra/runtime/registry/registry_protocol_binding.py +444 -0
- omnibase_infra/runtime/registry_compute.py +1143 -0
- omnibase_infra/runtime/registry_dispatcher.py +678 -0
- omnibase_infra/runtime/registry_policy.py +1502 -0
- omnibase_infra/runtime/runtime_scheduler.py +1070 -0
- omnibase_infra/runtime/secret_resolver.py +2110 -0
- omnibase_infra/runtime/security_metadata_validator.py +776 -0
- omnibase_infra/runtime/service_kernel.py +1573 -0
- omnibase_infra/runtime/service_message_dispatch_engine.py +1805 -0
- omnibase_infra/runtime/service_runtime_host_process.py +2260 -0
- omnibase_infra/runtime/util_container_wiring.py +1123 -0
- omnibase_infra/runtime/util_validation.py +314 -0
- omnibase_infra/runtime/util_version.py +98 -0
- omnibase_infra/runtime/util_wiring.py +566 -0
- omnibase_infra/schemas/schema_registration_projection.sql +320 -0
- omnibase_infra/services/__init__.py +68 -0
- omnibase_infra/services/corpus_capture.py +678 -0
- omnibase_infra/services/service_capability_query.py +945 -0
- omnibase_infra/services/service_health.py +897 -0
- omnibase_infra/services/service_node_selector.py +530 -0
- omnibase_infra/services/service_timeout_emitter.py +682 -0
- omnibase_infra/services/service_timeout_scanner.py +390 -0
- omnibase_infra/services/snapshot/__init__.py +31 -0
- omnibase_infra/services/snapshot/service_snapshot.py +647 -0
- omnibase_infra/services/snapshot/store_inmemory.py +637 -0
- omnibase_infra/services/snapshot/store_postgres.py +1279 -0
- omnibase_infra/shared/__init__.py +8 -0
- omnibase_infra/testing/__init__.py +10 -0
- omnibase_infra/testing/utils.py +23 -0
- omnibase_infra/types/__init__.py +48 -0
- omnibase_infra/types/type_cache_info.py +49 -0
- omnibase_infra/types/type_dsn.py +173 -0
- omnibase_infra/types/type_infra_aliases.py +60 -0
- omnibase_infra/types/typed_dict/__init__.py +21 -0
- omnibase_infra/types/typed_dict/typed_dict_introspection_cache.py +128 -0
- omnibase_infra/types/typed_dict/typed_dict_performance_metrics_cache.py +140 -0
- omnibase_infra/types/typed_dict_capabilities.py +64 -0
- omnibase_infra/utils/__init__.py +89 -0
- omnibase_infra/utils/correlation.py +208 -0
- omnibase_infra/utils/util_datetime.py +372 -0
- omnibase_infra/utils/util_dsn_validation.py +333 -0
- omnibase_infra/utils/util_env_parsing.py +264 -0
- omnibase_infra/utils/util_error_sanitization.py +457 -0
- omnibase_infra/utils/util_pydantic_validators.py +477 -0
- omnibase_infra/utils/util_semver.py +233 -0
- omnibase_infra/validation/__init__.py +307 -0
- omnibase_infra/validation/enums/__init__.py +11 -0
- omnibase_infra/validation/enums/enum_contract_violation_severity.py +13 -0
- omnibase_infra/validation/infra_validators.py +1486 -0
- omnibase_infra/validation/linter_contract.py +907 -0
- omnibase_infra/validation/mixin_any_type_classification.py +120 -0
- omnibase_infra/validation/mixin_any_type_exemption.py +580 -0
- omnibase_infra/validation/mixin_any_type_reporting.py +106 -0
- omnibase_infra/validation/mixin_execution_shape_violation_checks.py +596 -0
- omnibase_infra/validation/mixin_node_archetype_detection.py +254 -0
- omnibase_infra/validation/models/__init__.py +15 -0
- omnibase_infra/validation/models/model_contract_lint_result.py +101 -0
- omnibase_infra/validation/models/model_contract_violation.py +41 -0
- omnibase_infra/validation/service_validation_aggregator.py +395 -0
- omnibase_infra/validation/validation_exemptions.yaml +1710 -0
- omnibase_infra/validation/validator_any_type.py +715 -0
- omnibase_infra/validation/validator_chain_propagation.py +839 -0
- omnibase_infra/validation/validator_execution_shape.py +465 -0
- omnibase_infra/validation/validator_localhandler.py +261 -0
- omnibase_infra/validation/validator_registration_security.py +410 -0
- omnibase_infra/validation/validator_routing_coverage.py +1020 -0
- omnibase_infra/validation/validator_runtime_shape.py +915 -0
- omnibase_infra/validation/validator_security.py +410 -0
- omnibase_infra/validation/validator_topic_category.py +1152 -0
- omnibase_infra-0.2.1.dist-info/METADATA +197 -0
- omnibase_infra-0.2.1.dist-info/RECORD +675 -0
- omnibase_infra-0.2.1.dist-info/WHEEL +4 -0
- omnibase_infra-0.2.1.dist-info/entry_points.txt +4 -0
- omnibase_infra-0.2.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2025 OmniNode Team
|
|
3
|
+
"""
|
|
4
|
+
Structured Log Context Model.
|
|
5
|
+
|
|
6
|
+
This module provides the ModelLogContext Pydantic model for structured logging
|
|
7
|
+
in ONEX infrastructure components. It replaces the common union pattern
|
|
8
|
+
``dict[str, str | int | float]`` with a strongly-typed model that maintains
|
|
9
|
+
flexibility while providing type safety.
|
|
10
|
+
|
|
11
|
+
Design Pattern:
|
|
12
|
+
ModelLogContext is a structured data model that carries logging context
|
|
13
|
+
through infrastructure operations. It includes:
|
|
14
|
+
- Operation identification (operation, service_name)
|
|
15
|
+
- Correlation tracking (correlation_id)
|
|
16
|
+
- Performance metrics (duration_ms, retry_count)
|
|
17
|
+
- Extensible context (extra dict with string values)
|
|
18
|
+
|
|
19
|
+
The model provides builder methods for common use cases and a ``to_dict()``
|
|
20
|
+
method for integration with standard logging formatters.
|
|
21
|
+
|
|
22
|
+
Thread Safety:
|
|
23
|
+
ModelLogContext is immutable (frozen=True) after creation,
|
|
24
|
+
making it thread-safe for concurrent read access.
|
|
25
|
+
|
|
26
|
+
Sentinel Values:
|
|
27
|
+
This model uses sentinel values instead of nullable unions to minimize
|
|
28
|
+
union count in the codebase (OMN-1002). The sentinel convention is:
|
|
29
|
+
- Empty string ("") for string fields means "not set"
|
|
30
|
+
- -1.0 for float fields means "not set"
|
|
31
|
+
- -1 for int fields means "not set"
|
|
32
|
+
|
|
33
|
+
Use the ``has_*`` properties to check if a field has been set.
|
|
34
|
+
|
|
35
|
+
Union Reduction:
|
|
36
|
+
This model replaces the pattern::
|
|
37
|
+
|
|
38
|
+
def build_log_context() -> dict[str, str | int | float]:
|
|
39
|
+
return {
|
|
40
|
+
"operation": "dispatch",
|
|
41
|
+
"correlation_id": str(uuid),
|
|
42
|
+
"duration_ms": 42.5,
|
|
43
|
+
"retry_count": 3,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
With a structured approach that:
|
|
47
|
+
- Eliminates unions in favor of typed fields with sentinel defaults
|
|
48
|
+
- Provides IDE autocompletion and type checking
|
|
49
|
+
- Integrates with standard logging via ``to_dict()``
|
|
50
|
+
- Ensures consistent log context structure across components
|
|
51
|
+
|
|
52
|
+
Example:
|
|
53
|
+
>>> from uuid import uuid4
|
|
54
|
+
>>> from omnibase_infra.models.logging import ModelLogContext
|
|
55
|
+
>>>
|
|
56
|
+
>>> # Create context using builder methods
|
|
57
|
+
>>> ctx = (
|
|
58
|
+
... ModelLogContext.for_operation("dispatch")
|
|
59
|
+
... .with_correlation_id(str(uuid4()))
|
|
60
|
+
... .with_duration_ms(42.5)
|
|
61
|
+
... .with_retry_count(3)
|
|
62
|
+
... .with_service_name("kafka-event-bus")
|
|
63
|
+
... )
|
|
64
|
+
>>>
|
|
65
|
+
>>> # Use in logging
|
|
66
|
+
>>> import logging
|
|
67
|
+
>>> logger = logging.getLogger(__name__)
|
|
68
|
+
>>> logger.info("Event dispatched", extra=ctx.to_dict())
|
|
69
|
+
>>>
|
|
70
|
+
>>> # Direct construction
|
|
71
|
+
>>> ctx = ModelLogContext(
|
|
72
|
+
... operation="subscribe",
|
|
73
|
+
... service_name="kafka",
|
|
74
|
+
... correlation_id=str(uuid4()),
|
|
75
|
+
... )
|
|
76
|
+
|
|
77
|
+
See Also:
|
|
78
|
+
omnibase_infra.models.dispatch.ModelDispatchContext: Dispatch-specific context
|
|
79
|
+
omnibase_infra.models.dispatch.ModelDispatchResult: Dispatch result with metrics
|
|
80
|
+
|
|
81
|
+
.. versionadded:: 0.6.0
|
|
82
|
+
Added as part of OMN-1002 Union Reduction Phase 2.
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
from __future__ import annotations
|
|
86
|
+
|
|
87
|
+
from uuid import uuid4
|
|
88
|
+
|
|
89
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
90
|
+
|
|
91
|
+
from omnibase_core.types import PrimitiveValue
|
|
92
|
+
from omnibase_infra.enums import EnumInfraTransportType
|
|
93
|
+
from omnibase_infra.errors import ModelInfraErrorContext, ProtocolConfigurationError
|
|
94
|
+
|
|
95
|
+
# Sentinel constants for "not set" values
|
|
96
|
+
_SENTINEL_STR: str = ""
|
|
97
|
+
_SENTINEL_FLOAT: float = -1.0
|
|
98
|
+
_SENTINEL_INT: int = -1
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class ModelLogContext(BaseModel):
|
|
102
|
+
"""
|
|
103
|
+
Structured logging context for ONEX infrastructure operations.
|
|
104
|
+
|
|
105
|
+
Provides type-safe logging context that replaces the common pattern of
|
|
106
|
+
``dict[str, str | int | float]`` with explicit fields and builder methods.
|
|
107
|
+
|
|
108
|
+
Sentinel Values:
|
|
109
|
+
This model uses sentinel values to indicate "not set" instead of None:
|
|
110
|
+
- Empty string ("") for string fields
|
|
111
|
+
- -1.0 for duration_ms
|
|
112
|
+
- -1 for retry_count
|
|
113
|
+
|
|
114
|
+
Use ``has_*`` properties to check if a field is set.
|
|
115
|
+
|
|
116
|
+
Attributes:
|
|
117
|
+
operation: The operation being logged (e.g., "dispatch", "connect", "subscribe").
|
|
118
|
+
correlation_id: Correlation ID for request tracing. Empty string if not set.
|
|
119
|
+
duration_ms: Duration of the operation in milliseconds. -1.0 if not set.
|
|
120
|
+
retry_count: Number of retries attempted. -1 if not set.
|
|
121
|
+
service_name: Name of the service performing the operation. Empty string if not set.
|
|
122
|
+
topic: Topic name for event-related operations. Empty string if not set.
|
|
123
|
+
group_id: Consumer group ID for subscription operations. Empty string if not set.
|
|
124
|
+
error_type: Error type name when logging errors. Empty string if not set.
|
|
125
|
+
extra: Additional string-typed context fields.
|
|
126
|
+
|
|
127
|
+
Example:
|
|
128
|
+
>>> ctx = ModelLogContext(
|
|
129
|
+
... operation="dispatch",
|
|
130
|
+
... service_name="kafka-event-bus",
|
|
131
|
+
... duration_ms=42.5,
|
|
132
|
+
... )
|
|
133
|
+
>>> ctx.to_dict()
|
|
134
|
+
{'operation': 'dispatch', 'service_name': 'kafka-event-bus', 'duration_ms': 42.5}
|
|
135
|
+
|
|
136
|
+
.. versionadded:: 0.6.0
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
model_config = ConfigDict(
|
|
140
|
+
frozen=True,
|
|
141
|
+
extra="forbid",
|
|
142
|
+
from_attributes=True,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
# ---- Required Fields ----
|
|
146
|
+
operation: str = Field(
|
|
147
|
+
...,
|
|
148
|
+
description="The operation being logged (e.g., 'dispatch', 'connect', 'subscribe').",
|
|
149
|
+
min_length=1,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
# ---- Correlation Tracking ----
|
|
153
|
+
correlation_id: str = Field(
|
|
154
|
+
default=_SENTINEL_STR,
|
|
155
|
+
description="Correlation ID for request tracing. Empty string if not set.",
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
# ---- Performance Metrics ----
|
|
159
|
+
duration_ms: float = Field(
|
|
160
|
+
default=_SENTINEL_FLOAT,
|
|
161
|
+
description="Duration in milliseconds. -1.0 if not set. Must be >= 0 when set.",
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
retry_count: int = Field(
|
|
165
|
+
default=_SENTINEL_INT,
|
|
166
|
+
description="Number of retries attempted. -1 if not set. Must be >= 0 when set.",
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
# ---- Service Identification ----
|
|
170
|
+
service_name: str = Field(
|
|
171
|
+
default=_SENTINEL_STR,
|
|
172
|
+
description="Name of the service performing the operation. Empty string if not set.",
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
# ---- Event/Topic Context ----
|
|
176
|
+
topic: str = Field(
|
|
177
|
+
default=_SENTINEL_STR,
|
|
178
|
+
description="Topic name for event-related operations. Empty string if not set.",
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
group_id: str = Field(
|
|
182
|
+
default=_SENTINEL_STR,
|
|
183
|
+
description="Consumer group ID for subscription operations. Empty string if not set.",
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
# ---- Error Context ----
|
|
187
|
+
error_type: str = Field(
|
|
188
|
+
default=_SENTINEL_STR,
|
|
189
|
+
description="Error type name when logging errors. Empty string if not set.",
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
# ---- Extensible Context ----
|
|
193
|
+
extra: dict[str, str] = Field(
|
|
194
|
+
default_factory=dict,
|
|
195
|
+
description="Additional string-typed context fields for extensibility.",
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
# ---- Sentinel Check Properties ----
|
|
199
|
+
|
|
200
|
+
@property
|
|
201
|
+
def has_correlation_id(self) -> bool:
|
|
202
|
+
"""Check if correlation_id is set (not empty string)."""
|
|
203
|
+
return self.correlation_id != _SENTINEL_STR
|
|
204
|
+
|
|
205
|
+
@property
|
|
206
|
+
def has_duration_ms(self) -> bool:
|
|
207
|
+
"""Check if duration_ms is set (not -1.0)."""
|
|
208
|
+
return self.duration_ms >= 0
|
|
209
|
+
|
|
210
|
+
@property
|
|
211
|
+
def has_retry_count(self) -> bool:
|
|
212
|
+
"""Check if retry_count is set (not -1)."""
|
|
213
|
+
return self.retry_count >= 0
|
|
214
|
+
|
|
215
|
+
@property
|
|
216
|
+
def has_service_name(self) -> bool:
|
|
217
|
+
"""Check if service_name is set (not empty string)."""
|
|
218
|
+
return self.service_name != _SENTINEL_STR
|
|
219
|
+
|
|
220
|
+
@property
|
|
221
|
+
def has_topic(self) -> bool:
|
|
222
|
+
"""Check if topic is set (not empty string)."""
|
|
223
|
+
return self.topic != _SENTINEL_STR
|
|
224
|
+
|
|
225
|
+
@property
|
|
226
|
+
def has_group_id(self) -> bool:
|
|
227
|
+
"""Check if group_id is set (not empty string)."""
|
|
228
|
+
return self.group_id != _SENTINEL_STR
|
|
229
|
+
|
|
230
|
+
@property
|
|
231
|
+
def has_error_type(self) -> bool:
|
|
232
|
+
"""Check if error_type is set (not empty string)."""
|
|
233
|
+
return self.error_type != _SENTINEL_STR
|
|
234
|
+
|
|
235
|
+
def to_dict(self) -> dict[str, PrimitiveValue]:
|
|
236
|
+
"""
|
|
237
|
+
Convert to dictionary for use with logging formatters.
|
|
238
|
+
|
|
239
|
+
Returns a dictionary containing only fields that are set (excludes
|
|
240
|
+
sentinel values), suitable for passing to ``logging.Logger`` methods
|
|
241
|
+
via the ``extra`` parameter.
|
|
242
|
+
|
|
243
|
+
This method provides integration with standard logging interfaces that
|
|
244
|
+
expect ``dict[str, str | int | float]`` for logging context.
|
|
245
|
+
|
|
246
|
+
Returns:
|
|
247
|
+
Dictionary with string keys and string/int/float values.
|
|
248
|
+
Only includes fields that are actually set (not sentinel values).
|
|
249
|
+
|
|
250
|
+
Example:
|
|
251
|
+
>>> ctx = ModelLogContext(
|
|
252
|
+
... operation="dispatch",
|
|
253
|
+
... duration_ms=42.5,
|
|
254
|
+
... retry_count=3,
|
|
255
|
+
... )
|
|
256
|
+
>>> ctx.to_dict()
|
|
257
|
+
{'operation': 'dispatch', 'duration_ms': 42.5, 'retry_count': 3}
|
|
258
|
+
|
|
259
|
+
.. versionadded:: 0.6.0
|
|
260
|
+
"""
|
|
261
|
+
result: dict[str, PrimitiveValue] = {"operation": self.operation}
|
|
262
|
+
|
|
263
|
+
if self.has_correlation_id:
|
|
264
|
+
result["correlation_id"] = self.correlation_id
|
|
265
|
+
if self.has_duration_ms:
|
|
266
|
+
result["duration_ms"] = self.duration_ms
|
|
267
|
+
if self.has_retry_count:
|
|
268
|
+
result["retry_count"] = self.retry_count
|
|
269
|
+
if self.has_service_name:
|
|
270
|
+
result["service_name"] = self.service_name
|
|
271
|
+
if self.has_topic:
|
|
272
|
+
result["topic"] = self.topic
|
|
273
|
+
if self.has_group_id:
|
|
274
|
+
result["group_id"] = self.group_id
|
|
275
|
+
if self.has_error_type:
|
|
276
|
+
result["error_type"] = self.error_type
|
|
277
|
+
|
|
278
|
+
# Add extra fields
|
|
279
|
+
result.update(self.extra)
|
|
280
|
+
|
|
281
|
+
return result
|
|
282
|
+
|
|
283
|
+
# ---- Builder Methods ----
|
|
284
|
+
|
|
285
|
+
@classmethod
|
|
286
|
+
def for_operation(cls, operation: str) -> ModelLogContext:
|
|
287
|
+
"""
|
|
288
|
+
Create a log context for a specific operation.
|
|
289
|
+
|
|
290
|
+
This is the primary entry point for building log contexts using
|
|
291
|
+
the fluent builder pattern.
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
operation: The operation being logged.
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
A new ModelLogContext instance.
|
|
298
|
+
|
|
299
|
+
Example:
|
|
300
|
+
>>> ctx = ModelLogContext.for_operation("dispatch")
|
|
301
|
+
>>> ctx.operation
|
|
302
|
+
'dispatch'
|
|
303
|
+
|
|
304
|
+
.. versionadded:: 0.6.0
|
|
305
|
+
"""
|
|
306
|
+
return cls(operation=operation)
|
|
307
|
+
|
|
308
|
+
def with_correlation_id(self, correlation_id: str) -> ModelLogContext:
|
|
309
|
+
"""
|
|
310
|
+
Add correlation ID to the context.
|
|
311
|
+
|
|
312
|
+
Args:
|
|
313
|
+
correlation_id: Correlation ID for request tracing.
|
|
314
|
+
|
|
315
|
+
Returns:
|
|
316
|
+
A new ModelLogContext with correlation_id set.
|
|
317
|
+
|
|
318
|
+
Example:
|
|
319
|
+
>>> from uuid import uuid4
|
|
320
|
+
>>> ctx = (
|
|
321
|
+
... ModelLogContext.for_operation("dispatch")
|
|
322
|
+
... .with_correlation_id(str(uuid4()))
|
|
323
|
+
... )
|
|
324
|
+
|
|
325
|
+
.. versionadded:: 0.6.0
|
|
326
|
+
"""
|
|
327
|
+
return self.model_copy(update={"correlation_id": correlation_id})
|
|
328
|
+
|
|
329
|
+
def with_duration_ms(self, duration_ms: float) -> ModelLogContext:
|
|
330
|
+
"""
|
|
331
|
+
Add duration metric to the context.
|
|
332
|
+
|
|
333
|
+
Args:
|
|
334
|
+
duration_ms: Duration in milliseconds (must be >= 0).
|
|
335
|
+
|
|
336
|
+
Returns:
|
|
337
|
+
A new ModelLogContext with duration_ms set.
|
|
338
|
+
|
|
339
|
+
Raises:
|
|
340
|
+
ProtocolConfigurationError: If duration_ms is negative.
|
|
341
|
+
|
|
342
|
+
Example:
|
|
343
|
+
>>> ctx = (
|
|
344
|
+
... ModelLogContext.for_operation("query")
|
|
345
|
+
... .with_duration_ms(15.3)
|
|
346
|
+
... )
|
|
347
|
+
|
|
348
|
+
.. versionadded:: 0.6.0
|
|
349
|
+
"""
|
|
350
|
+
if duration_ms < 0:
|
|
351
|
+
context = ModelInfraErrorContext(
|
|
352
|
+
transport_type=EnumInfraTransportType.RUNTIME,
|
|
353
|
+
operation="with_duration_ms",
|
|
354
|
+
correlation_id=uuid4(),
|
|
355
|
+
)
|
|
356
|
+
raise ProtocolConfigurationError(
|
|
357
|
+
"duration_ms must be >= 0", context=context
|
|
358
|
+
)
|
|
359
|
+
return self.model_copy(update={"duration_ms": duration_ms})
|
|
360
|
+
|
|
361
|
+
def with_retry_count(self, retry_count: int) -> ModelLogContext:
|
|
362
|
+
"""
|
|
363
|
+
Add retry count to the context.
|
|
364
|
+
|
|
365
|
+
Args:
|
|
366
|
+
retry_count: Number of retries (must be >= 0).
|
|
367
|
+
|
|
368
|
+
Returns:
|
|
369
|
+
A new ModelLogContext with retry_count set.
|
|
370
|
+
|
|
371
|
+
Raises:
|
|
372
|
+
ProtocolConfigurationError: If retry_count is negative.
|
|
373
|
+
|
|
374
|
+
Example:
|
|
375
|
+
>>> ctx = (
|
|
376
|
+
... ModelLogContext.for_operation("connect")
|
|
377
|
+
... .with_retry_count(3)
|
|
378
|
+
... )
|
|
379
|
+
|
|
380
|
+
.. versionadded:: 0.6.0
|
|
381
|
+
"""
|
|
382
|
+
if retry_count < 0:
|
|
383
|
+
context = ModelInfraErrorContext(
|
|
384
|
+
transport_type=EnumInfraTransportType.RUNTIME,
|
|
385
|
+
operation="with_retry_count",
|
|
386
|
+
correlation_id=uuid4(),
|
|
387
|
+
)
|
|
388
|
+
raise ProtocolConfigurationError(
|
|
389
|
+
"retry_count must be >= 0", context=context
|
|
390
|
+
)
|
|
391
|
+
return self.model_copy(update={"retry_count": retry_count})
|
|
392
|
+
|
|
393
|
+
def with_service_name(self, service_name: str) -> ModelLogContext:
|
|
394
|
+
"""
|
|
395
|
+
Add service name to the context.
|
|
396
|
+
|
|
397
|
+
Args:
|
|
398
|
+
service_name: Name of the service.
|
|
399
|
+
|
|
400
|
+
Returns:
|
|
401
|
+
A new ModelLogContext with service_name set.
|
|
402
|
+
|
|
403
|
+
Example:
|
|
404
|
+
>>> ctx = (
|
|
405
|
+
... ModelLogContext.for_operation("publish")
|
|
406
|
+
... .with_service_name("kafka-event-bus")
|
|
407
|
+
... )
|
|
408
|
+
|
|
409
|
+
.. versionadded:: 0.6.0
|
|
410
|
+
"""
|
|
411
|
+
return self.model_copy(update={"service_name": service_name})
|
|
412
|
+
|
|
413
|
+
def with_topic(self, topic: str) -> ModelLogContext:
|
|
414
|
+
"""
|
|
415
|
+
Add topic name to the context.
|
|
416
|
+
|
|
417
|
+
Args:
|
|
418
|
+
topic: Topic name for event operations.
|
|
419
|
+
|
|
420
|
+
Returns:
|
|
421
|
+
A new ModelLogContext with topic set.
|
|
422
|
+
|
|
423
|
+
Example:
|
|
424
|
+
>>> ctx = (
|
|
425
|
+
... ModelLogContext.for_operation("subscribe")
|
|
426
|
+
... .with_topic("dev.user.events.v1")
|
|
427
|
+
... )
|
|
428
|
+
|
|
429
|
+
.. versionadded:: 0.6.0
|
|
430
|
+
"""
|
|
431
|
+
return self.model_copy(update={"topic": topic})
|
|
432
|
+
|
|
433
|
+
def with_group_id(self, group_id: str) -> ModelLogContext:
|
|
434
|
+
"""
|
|
435
|
+
Add consumer group ID to the context.
|
|
436
|
+
|
|
437
|
+
Args:
|
|
438
|
+
group_id: Consumer group ID.
|
|
439
|
+
|
|
440
|
+
Returns:
|
|
441
|
+
A new ModelLogContext with group_id set.
|
|
442
|
+
|
|
443
|
+
Example:
|
|
444
|
+
>>> ctx = (
|
|
445
|
+
... ModelLogContext.for_operation("consume")
|
|
446
|
+
... .with_group_id("user-service-consumers")
|
|
447
|
+
... )
|
|
448
|
+
|
|
449
|
+
.. versionadded:: 0.6.0
|
|
450
|
+
"""
|
|
451
|
+
return self.model_copy(update={"group_id": group_id})
|
|
452
|
+
|
|
453
|
+
def with_error_type(self, error_type: str) -> ModelLogContext:
|
|
454
|
+
"""
|
|
455
|
+
Add error type to the context.
|
|
456
|
+
|
|
457
|
+
Args:
|
|
458
|
+
error_type: Name of the error type (e.g., class name).
|
|
459
|
+
|
|
460
|
+
Returns:
|
|
461
|
+
A new ModelLogContext with error_type set.
|
|
462
|
+
|
|
463
|
+
Example:
|
|
464
|
+
>>> ctx = (
|
|
465
|
+
... ModelLogContext.for_operation("connect")
|
|
466
|
+
... .with_error_type("InfraConnectionError")
|
|
467
|
+
... )
|
|
468
|
+
|
|
469
|
+
.. versionadded:: 0.6.0
|
|
470
|
+
"""
|
|
471
|
+
return self.model_copy(update={"error_type": error_type})
|
|
472
|
+
|
|
473
|
+
def with_extra(self, key: str, value: str) -> ModelLogContext:
|
|
474
|
+
"""
|
|
475
|
+
Add an extra context field.
|
|
476
|
+
|
|
477
|
+
Use this method for context fields that don't fit the standard fields.
|
|
478
|
+
The value must be a string to maintain type consistency.
|
|
479
|
+
|
|
480
|
+
Args:
|
|
481
|
+
key: The context field name.
|
|
482
|
+
value: The context field value (must be string).
|
|
483
|
+
|
|
484
|
+
Returns:
|
|
485
|
+
A new ModelLogContext with the extra field added.
|
|
486
|
+
|
|
487
|
+
Example:
|
|
488
|
+
>>> ctx = (
|
|
489
|
+
... ModelLogContext.for_operation("dispatch")
|
|
490
|
+
... .with_extra("dispatcher_id", "user-event-dispatcher")
|
|
491
|
+
... .with_extra("route_id", "user-route")
|
|
492
|
+
... )
|
|
493
|
+
|
|
494
|
+
.. versionadded:: 0.6.0
|
|
495
|
+
"""
|
|
496
|
+
new_extra = dict(self.extra)
|
|
497
|
+
new_extra[key] = value
|
|
498
|
+
return self.model_copy(update={"extra": new_extra})
|
|
499
|
+
|
|
500
|
+
def with_extras(self, extras: dict[str, str]) -> ModelLogContext:
|
|
501
|
+
"""
|
|
502
|
+
Add multiple extra context fields at once.
|
|
503
|
+
|
|
504
|
+
Args:
|
|
505
|
+
extras: Dictionary of extra context fields (all values must be strings).
|
|
506
|
+
|
|
507
|
+
Returns:
|
|
508
|
+
A new ModelLogContext with the extra fields added.
|
|
509
|
+
|
|
510
|
+
Example:
|
|
511
|
+
>>> ctx = (
|
|
512
|
+
... ModelLogContext.for_operation("batch_process")
|
|
513
|
+
... .with_extras({
|
|
514
|
+
... "batch_id": "batch-123",
|
|
515
|
+
... "batch_size": "100", # Note: must be string
|
|
516
|
+
... })
|
|
517
|
+
... )
|
|
518
|
+
|
|
519
|
+
.. versionadded:: 0.6.0
|
|
520
|
+
"""
|
|
521
|
+
new_extra = dict(self.extra)
|
|
522
|
+
new_extra.update(extras)
|
|
523
|
+
return self.model_copy(update={"extra": new_extra})
|
|
524
|
+
|
|
525
|
+
# ---- Factory Methods for Common Patterns ----
|
|
526
|
+
|
|
527
|
+
@classmethod
|
|
528
|
+
def for_event_bus(
|
|
529
|
+
cls,
|
|
530
|
+
operation: str,
|
|
531
|
+
service_name: str,
|
|
532
|
+
*,
|
|
533
|
+
topic: str = _SENTINEL_STR,
|
|
534
|
+
group_id: str = _SENTINEL_STR,
|
|
535
|
+
correlation_id: str = _SENTINEL_STR,
|
|
536
|
+
) -> ModelLogContext:
|
|
537
|
+
"""
|
|
538
|
+
Create log context for event bus operations.
|
|
539
|
+
|
|
540
|
+
Factory method for common event bus logging patterns.
|
|
541
|
+
|
|
542
|
+
Args:
|
|
543
|
+
operation: The event bus operation (e.g., "publish", "subscribe", "start").
|
|
544
|
+
service_name: Name of the event bus service.
|
|
545
|
+
topic: Topic name. Empty string if not applicable.
|
|
546
|
+
group_id: Consumer group ID. Empty string if not applicable.
|
|
547
|
+
correlation_id: Correlation ID. Empty string if not applicable.
|
|
548
|
+
|
|
549
|
+
Returns:
|
|
550
|
+
A ModelLogContext configured for event bus operations.
|
|
551
|
+
|
|
552
|
+
Example:
|
|
553
|
+
>>> ctx = ModelLogContext.for_event_bus(
|
|
554
|
+
... operation="publish",
|
|
555
|
+
... service_name="kafka-event-bus",
|
|
556
|
+
... topic="dev.user.events.v1",
|
|
557
|
+
... )
|
|
558
|
+
|
|
559
|
+
.. versionadded:: 0.6.0
|
|
560
|
+
"""
|
|
561
|
+
return cls(
|
|
562
|
+
operation=operation,
|
|
563
|
+
service_name=service_name,
|
|
564
|
+
topic=topic,
|
|
565
|
+
group_id=group_id,
|
|
566
|
+
correlation_id=correlation_id,
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
@classmethod
|
|
570
|
+
def for_dispatch(
|
|
571
|
+
cls,
|
|
572
|
+
*,
|
|
573
|
+
dispatcher_id: str = _SENTINEL_STR,
|
|
574
|
+
route_id: str = _SENTINEL_STR,
|
|
575
|
+
topic: str = _SENTINEL_STR,
|
|
576
|
+
correlation_id: str = _SENTINEL_STR,
|
|
577
|
+
duration_ms: float = _SENTINEL_FLOAT,
|
|
578
|
+
) -> ModelLogContext:
|
|
579
|
+
"""
|
|
580
|
+
Create log context for dispatch operations.
|
|
581
|
+
|
|
582
|
+
Factory method for message dispatch logging patterns.
|
|
583
|
+
|
|
584
|
+
Args:
|
|
585
|
+
dispatcher_id: Dispatcher identifier. Empty string if not applicable.
|
|
586
|
+
route_id: Route identifier. Empty string if not applicable.
|
|
587
|
+
topic: Topic name. Empty string if not applicable.
|
|
588
|
+
correlation_id: Correlation ID. Empty string if not applicable.
|
|
589
|
+
duration_ms: Duration in milliseconds. -1.0 if not applicable.
|
|
590
|
+
|
|
591
|
+
Returns:
|
|
592
|
+
A ModelLogContext configured for dispatch operations.
|
|
593
|
+
|
|
594
|
+
Raises:
|
|
595
|
+
ProtocolConfigurationError: If duration_ms is negative (except sentinel -1.0).
|
|
596
|
+
|
|
597
|
+
Example:
|
|
598
|
+
>>> ctx = ModelLogContext.for_dispatch(
|
|
599
|
+
... dispatcher_id="user-dispatcher",
|
|
600
|
+
... route_id="user-route",
|
|
601
|
+
... topic="dev.user.events.v1",
|
|
602
|
+
... duration_ms=15.3,
|
|
603
|
+
... )
|
|
604
|
+
|
|
605
|
+
.. versionadded:: 0.6.0
|
|
606
|
+
"""
|
|
607
|
+
# Validate duration_ms: allow sentinel (-1.0) or non-negative values
|
|
608
|
+
if duration_ms != _SENTINEL_FLOAT and duration_ms < 0:
|
|
609
|
+
context = ModelInfraErrorContext(
|
|
610
|
+
transport_type=EnumInfraTransportType.RUNTIME,
|
|
611
|
+
operation="for_dispatch",
|
|
612
|
+
correlation_id=uuid4(),
|
|
613
|
+
)
|
|
614
|
+
raise ProtocolConfigurationError(
|
|
615
|
+
"duration_ms must be >= 0 when set", context=context
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
extra: dict[str, str] = {}
|
|
619
|
+
if dispatcher_id != _SENTINEL_STR:
|
|
620
|
+
extra["dispatcher_id"] = dispatcher_id
|
|
621
|
+
if route_id != _SENTINEL_STR:
|
|
622
|
+
extra["route_id"] = route_id
|
|
623
|
+
|
|
624
|
+
return cls(
|
|
625
|
+
operation="dispatch",
|
|
626
|
+
topic=topic,
|
|
627
|
+
correlation_id=correlation_id,
|
|
628
|
+
duration_ms=duration_ms,
|
|
629
|
+
extra=extra,
|
|
630
|
+
)
|
|
631
|
+
|
|
632
|
+
@classmethod
|
|
633
|
+
def for_connection(
|
|
634
|
+
cls,
|
|
635
|
+
operation: str,
|
|
636
|
+
service_name: str,
|
|
637
|
+
*,
|
|
638
|
+
host: str = _SENTINEL_STR,
|
|
639
|
+
port: int = _SENTINEL_INT,
|
|
640
|
+
retry_count: int = _SENTINEL_INT,
|
|
641
|
+
correlation_id: str = _SENTINEL_STR,
|
|
642
|
+
) -> ModelLogContext:
|
|
643
|
+
"""
|
|
644
|
+
Create log context for connection operations.
|
|
645
|
+
|
|
646
|
+
Factory method for infrastructure connection logging patterns.
|
|
647
|
+
|
|
648
|
+
Args:
|
|
649
|
+
operation: The connection operation (e.g., "connect", "disconnect", "reconnect").
|
|
650
|
+
service_name: Name of the service being connected to.
|
|
651
|
+
host: Host name (sanitized, no credentials). Empty string if not applicable.
|
|
652
|
+
port: Port number. -1 if not applicable.
|
|
653
|
+
retry_count: Retry count. -1 if not applicable.
|
|
654
|
+
correlation_id: Correlation ID. Empty string if not applicable.
|
|
655
|
+
|
|
656
|
+
Returns:
|
|
657
|
+
A ModelLogContext configured for connection operations.
|
|
658
|
+
|
|
659
|
+
Raises:
|
|
660
|
+
ProtocolConfigurationError: If retry_count is negative (except sentinel -1).
|
|
661
|
+
|
|
662
|
+
Example:
|
|
663
|
+
>>> ctx = ModelLogContext.for_connection(
|
|
664
|
+
... operation="connect",
|
|
665
|
+
... service_name="postgresql",
|
|
666
|
+
... host="db.example.com",
|
|
667
|
+
... port=5432,
|
|
668
|
+
... retry_count=2,
|
|
669
|
+
... )
|
|
670
|
+
|
|
671
|
+
.. versionadded:: 0.6.0
|
|
672
|
+
"""
|
|
673
|
+
# Validate retry_count: allow sentinel (-1) or non-negative values
|
|
674
|
+
if retry_count != _SENTINEL_INT and retry_count < 0:
|
|
675
|
+
context = ModelInfraErrorContext(
|
|
676
|
+
transport_type=EnumInfraTransportType.RUNTIME,
|
|
677
|
+
operation="for_connection",
|
|
678
|
+
correlation_id=uuid4(),
|
|
679
|
+
)
|
|
680
|
+
raise ProtocolConfigurationError(
|
|
681
|
+
"retry_count must be >= 0 when set", context=context
|
|
682
|
+
)
|
|
683
|
+
|
|
684
|
+
extra: dict[str, str] = {}
|
|
685
|
+
if host != _SENTINEL_STR:
|
|
686
|
+
extra["host"] = host
|
|
687
|
+
if port >= 0:
|
|
688
|
+
extra["port"] = str(port)
|
|
689
|
+
|
|
690
|
+
return cls(
|
|
691
|
+
operation=operation,
|
|
692
|
+
service_name=service_name,
|
|
693
|
+
retry_count=retry_count,
|
|
694
|
+
correlation_id=correlation_id,
|
|
695
|
+
extra=extra,
|
|
696
|
+
)
|
|
697
|
+
|
|
698
|
+
@classmethod
|
|
699
|
+
def for_error(
|
|
700
|
+
cls,
|
|
701
|
+
operation: str,
|
|
702
|
+
error_type: str,
|
|
703
|
+
*,
|
|
704
|
+
service_name: str = _SENTINEL_STR,
|
|
705
|
+
correlation_id: str = _SENTINEL_STR,
|
|
706
|
+
retry_count: int = _SENTINEL_INT,
|
|
707
|
+
) -> ModelLogContext:
|
|
708
|
+
"""
|
|
709
|
+
Create log context for error logging.
|
|
710
|
+
|
|
711
|
+
Factory method for error logging patterns.
|
|
712
|
+
|
|
713
|
+
Args:
|
|
714
|
+
operation: The operation that failed.
|
|
715
|
+
error_type: Name of the error type/class.
|
|
716
|
+
service_name: Service name. Empty string if not applicable.
|
|
717
|
+
correlation_id: Correlation ID. Empty string if not applicable.
|
|
718
|
+
retry_count: Retry count when error occurred. -1 if not applicable.
|
|
719
|
+
|
|
720
|
+
Returns:
|
|
721
|
+
A ModelLogContext configured for error logging.
|
|
722
|
+
|
|
723
|
+
Raises:
|
|
724
|
+
ProtocolConfigurationError: If retry_count is negative (except sentinel -1).
|
|
725
|
+
|
|
726
|
+
Example:
|
|
727
|
+
>>> ctx = ModelLogContext.for_error(
|
|
728
|
+
... operation="publish",
|
|
729
|
+
... error_type="InfraConnectionError",
|
|
730
|
+
... service_name="kafka",
|
|
731
|
+
... correlation_id="abc-123",
|
|
732
|
+
... )
|
|
733
|
+
|
|
734
|
+
.. versionadded:: 0.6.0
|
|
735
|
+
"""
|
|
736
|
+
# Validate retry_count: allow sentinel (-1) or non-negative values
|
|
737
|
+
if retry_count != _SENTINEL_INT and retry_count < 0:
|
|
738
|
+
context = ModelInfraErrorContext(
|
|
739
|
+
transport_type=EnumInfraTransportType.RUNTIME,
|
|
740
|
+
operation="for_error",
|
|
741
|
+
correlation_id=uuid4(),
|
|
742
|
+
)
|
|
743
|
+
raise ProtocolConfigurationError(
|
|
744
|
+
"retry_count must be >= 0 when set", context=context
|
|
745
|
+
)
|
|
746
|
+
|
|
747
|
+
return cls(
|
|
748
|
+
operation=operation,
|
|
749
|
+
error_type=error_type,
|
|
750
|
+
service_name=service_name,
|
|
751
|
+
correlation_id=correlation_id,
|
|
752
|
+
retry_count=retry_count,
|
|
753
|
+
)
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
__all__ = ["ModelLogContext"]
|