omnibase_infra 0.3.1__py3-none-any.whl → 0.4.0__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 +1 -1
- omnibase_infra/enums/__init__.py +3 -0
- omnibase_infra/enums/enum_consumer_group_purpose.py +9 -0
- omnibase_infra/enums/enum_postgres_error_code.py +188 -0
- omnibase_infra/errors/__init__.py +4 -0
- omnibase_infra/errors/error_infra.py +60 -0
- omnibase_infra/handlers/__init__.py +3 -0
- omnibase_infra/handlers/handler_slack_webhook.py +426 -0
- omnibase_infra/handlers/models/__init__.py +14 -0
- omnibase_infra/handlers/models/enum_alert_severity.py +36 -0
- omnibase_infra/handlers/models/model_slack_alert.py +24 -0
- omnibase_infra/handlers/models/model_slack_alert_payload.py +77 -0
- omnibase_infra/handlers/models/model_slack_alert_result.py +73 -0
- omnibase_infra/handlers/registration_storage/handler_registration_storage_postgres.py +29 -20
- omnibase_infra/mixins/__init__.py +14 -0
- omnibase_infra/mixins/mixin_node_introspection.py +42 -20
- omnibase_infra/mixins/mixin_postgres_error_response.py +314 -0
- omnibase_infra/mixins/mixin_postgres_op_executor.py +298 -0
- omnibase_infra/models/__init__.py +3 -0
- omnibase_infra/models/discovery/model_dependency_spec.py +1 -0
- omnibase_infra/models/discovery/model_discovered_capabilities.py +1 -1
- omnibase_infra/models/discovery/model_introspection_config.py +28 -1
- omnibase_infra/models/discovery/model_introspection_performance_metrics.py +1 -0
- omnibase_infra/models/discovery/model_introspection_task_config.py +1 -0
- omnibase_infra/{nodes/effects/models → models}/model_backend_result.py +22 -6
- omnibase_infra/models/projection/__init__.py +11 -0
- omnibase_infra/models/projection/model_contract_projection.py +170 -0
- omnibase_infra/models/projection/model_topic_projection.py +148 -0
- omnibase_infra/models/runtime/__init__.py +4 -0
- omnibase_infra/models/runtime/model_resolved_dependencies.py +116 -0
- omnibase_infra/nodes/contract_registry_reducer/__init__.py +5 -0
- omnibase_infra/nodes/contract_registry_reducer/contract.yaml +6 -5
- omnibase_infra/nodes/contract_registry_reducer/contract_registration_event_router.py +689 -0
- omnibase_infra/nodes/contract_registry_reducer/reducer.py +9 -26
- omnibase_infra/nodes/effects/__init__.py +1 -1
- omnibase_infra/nodes/effects/models/__init__.py +6 -4
- omnibase_infra/nodes/effects/models/model_registry_response.py +1 -1
- omnibase_infra/nodes/effects/protocol_consul_client.py +1 -1
- omnibase_infra/nodes/effects/protocol_postgres_adapter.py +1 -1
- omnibase_infra/nodes/effects/registry_effect.py +1 -1
- omnibase_infra/nodes/node_contract_persistence_effect/__init__.py +101 -0
- omnibase_infra/nodes/node_contract_persistence_effect/contract.yaml +490 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/__init__.py +74 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_cleanup_topics.py +217 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_contract_upsert.py +242 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_deactivate.py +194 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_heartbeat.py +243 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_mark_stale.py +208 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_topic_update.py +298 -0
- omnibase_infra/nodes/node_contract_persistence_effect/models/__init__.py +15 -0
- omnibase_infra/nodes/node_contract_persistence_effect/models/model_persistence_result.py +52 -0
- omnibase_infra/nodes/node_contract_persistence_effect/node.py +131 -0
- omnibase_infra/nodes/node_contract_persistence_effect/registry/__init__.py +27 -0
- omnibase_infra/nodes/node_contract_persistence_effect/registry/registry_infra_contract_persistence_effect.py +251 -0
- omnibase_infra/nodes/node_registration_orchestrator/models/model_postgres_intent_payload.py +8 -12
- omnibase_infra/nodes/node_registry_effect/models/__init__.py +2 -2
- omnibase_infra/nodes/node_slack_alerter_effect/__init__.py +33 -0
- omnibase_infra/nodes/node_slack_alerter_effect/contract.yaml +291 -0
- omnibase_infra/nodes/node_slack_alerter_effect/node.py +106 -0
- omnibase_infra/projectors/__init__.py +6 -0
- omnibase_infra/projectors/projection_reader_contract.py +1301 -0
- omnibase_infra/runtime/__init__.py +12 -0
- omnibase_infra/runtime/baseline_subscriptions.py +13 -6
- omnibase_infra/runtime/contract_dependency_resolver.py +455 -0
- omnibase_infra/runtime/contract_registration_event_router.py +500 -0
- omnibase_infra/runtime/db/__init__.py +4 -0
- omnibase_infra/runtime/db/models/__init__.py +15 -10
- omnibase_infra/runtime/db/models/model_db_operation.py +40 -0
- omnibase_infra/runtime/db/models/model_db_param.py +24 -0
- omnibase_infra/runtime/db/models/model_db_repository_contract.py +40 -0
- omnibase_infra/runtime/db/models/model_db_return.py +26 -0
- omnibase_infra/runtime/db/models/model_db_safety_policy.py +32 -0
- omnibase_infra/runtime/emit_daemon/event_registry.py +34 -22
- omnibase_infra/runtime/event_bus_subcontract_wiring.py +63 -23
- omnibase_infra/runtime/intent_execution_router.py +430 -0
- omnibase_infra/runtime/models/__init__.py +6 -0
- omnibase_infra/runtime/models/model_contract_registry_config.py +41 -0
- omnibase_infra/runtime/models/model_intent_execution_summary.py +79 -0
- omnibase_infra/runtime/models/model_runtime_config.py +8 -0
- omnibase_infra/runtime/protocols/__init__.py +16 -0
- omnibase_infra/runtime/protocols/protocol_intent_executor.py +107 -0
- omnibase_infra/runtime/publisher_topic_scoped.py +16 -11
- omnibase_infra/runtime/registry_policy.py +29 -15
- omnibase_infra/runtime/request_response_wiring.py +793 -0
- omnibase_infra/runtime/service_kernel.py +295 -8
- omnibase_infra/runtime/service_runtime_host_process.py +149 -5
- omnibase_infra/runtime/util_version.py +5 -1
- omnibase_infra/schemas/schema_latency_baseline.sql +135 -0
- omnibase_infra/services/contract_publisher/config.py +4 -4
- omnibase_infra/services/contract_publisher/service.py +8 -5
- omnibase_infra/services/observability/injection_effectiveness/__init__.py +67 -0
- omnibase_infra/services/observability/injection_effectiveness/config.py +295 -0
- omnibase_infra/services/observability/injection_effectiveness/consumer.py +1461 -0
- omnibase_infra/services/observability/injection_effectiveness/models/__init__.py +32 -0
- omnibase_infra/services/observability/injection_effectiveness/models/model_agent_match.py +79 -0
- omnibase_infra/services/observability/injection_effectiveness/models/model_context_utilization.py +118 -0
- omnibase_infra/services/observability/injection_effectiveness/models/model_latency_breakdown.py +107 -0
- omnibase_infra/services/observability/injection_effectiveness/models/model_pattern_utilization.py +46 -0
- omnibase_infra/services/observability/injection_effectiveness/writer_postgres.py +596 -0
- omnibase_infra/services/registry_api/models/__init__.py +25 -0
- omnibase_infra/services/registry_api/models/model_contract_ref.py +44 -0
- omnibase_infra/services/registry_api/models/model_contract_view.py +81 -0
- omnibase_infra/services/registry_api/models/model_response_contracts.py +50 -0
- omnibase_infra/services/registry_api/models/model_response_topics.py +50 -0
- omnibase_infra/services/registry_api/models/model_topic_summary.py +57 -0
- omnibase_infra/services/registry_api/models/model_topic_view.py +63 -0
- omnibase_infra/services/registry_api/routes.py +205 -6
- omnibase_infra/services/registry_api/service.py +528 -1
- omnibase_infra/utils/__init__.py +7 -0
- omnibase_infra/utils/util_db_error_context.py +292 -0
- omnibase_infra/validation/infra_validators.py +3 -1
- omnibase_infra/validation/validation_exemptions.yaml +65 -0
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.4.0.dist-info}/METADATA +3 -3
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.4.0.dist-info}/RECORD +117 -58
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.4.0.dist-info}/WHEEL +0 -0
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.4.0.dist-info}/entry_points.txt +0 -0
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -632,30 +632,14 @@ class ContractRegistryReducer:
|
|
|
632
632
|
Parses the contract_yaml for consumed_events and published_events,
|
|
633
633
|
then creates postgres.update_topic intents for each topic suffix.
|
|
634
634
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
635
|
+
Realm-Agnostic Topics:
|
|
636
|
+
Topics in ONEX are realm-agnostic. The environment/realm is enforced via
|
|
637
|
+
envelope identity, not topic naming. Contract topics are stored without
|
|
638
|
+
any environment prefix (e.g., ``onex.evt.platform.contract-registered.v1``).
|
|
639
639
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
deterministic - it doesn't need to know about deployment environments.
|
|
644
|
-
|
|
645
|
-
2. **Effect Layer Responsibility**: The PostgresAdapter (Effect layer)
|
|
646
|
-
is responsible for resolving or stripping the ``{env}.`` placeholder
|
|
647
|
-
at write time, when the actual environment context is available.
|
|
648
|
-
|
|
649
|
-
3. **Auditing**: Storing the raw contract value preserves the original
|
|
650
|
-
contract specification for debugging and auditing purposes.
|
|
651
|
-
|
|
652
|
-
4. **Query Flexibility**: Downstream consumers can query topics with
|
|
653
|
-
or without the placeholder depending on their needs.
|
|
654
|
-
|
|
655
|
-
The Effect layer should handle ``{env}.`` resolution via one of:
|
|
656
|
-
- Stripping the prefix before storage (simple)
|
|
657
|
-
- Replacing with actual environment (e.g., ``dev.``, ``prod.``)
|
|
658
|
-
- Storing as-is with environment-aware queries
|
|
640
|
+
The Effect layer (PostgresAdapter) may still encounter legacy topics with
|
|
641
|
+
``{env}.`` placeholders and will strip them during storage normalization.
|
|
642
|
+
See ``normalize_topic_for_storage()`` in handler_postgres_topic_update.py.
|
|
659
643
|
|
|
660
644
|
Args:
|
|
661
645
|
event: Contract registered event with contract_yaml.
|
|
@@ -697,9 +681,8 @@ class ContractRegistryReducer:
|
|
|
697
681
|
if isinstance(consumed_events, list):
|
|
698
682
|
for consumed in consumed_events:
|
|
699
683
|
if isinstance(consumed, dict):
|
|
700
|
-
#
|
|
701
|
-
#
|
|
702
|
-
# We store it as-is; the Effect layer handles resolution.
|
|
684
|
+
# Topics are realm-agnostic (e.g., "onex.evt.platform.contract-registered.v1").
|
|
685
|
+
# Legacy topics with {env}. prefix are normalized by the Effect layer.
|
|
703
686
|
topic_suffix = consumed.get("topic")
|
|
704
687
|
if topic_suffix and isinstance(topic_suffix, str):
|
|
705
688
|
# Validate event_type is string (may be missing or wrong type in malformed YAML)
|
|
@@ -11,8 +11,8 @@ Available:
|
|
|
11
11
|
- ModelBackendResult: Individual backend result model
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
+
from omnibase_infra.models.model_backend_result import ModelBackendResult
|
|
14
15
|
from omnibase_infra.nodes.effects.models import (
|
|
15
|
-
ModelBackendResult,
|
|
16
16
|
ModelRegistryRequest,
|
|
17
17
|
ModelRegistryResponse,
|
|
18
18
|
)
|
|
@@ -5,15 +5,17 @@
|
|
|
5
5
|
This module exports models used by Effect layer nodes for external I/O operations.
|
|
6
6
|
|
|
7
7
|
Available Models:
|
|
8
|
-
- ModelBackendResult: Individual backend operation result
|
|
8
|
+
- ModelBackendResult: Individual backend operation result (re-exported)
|
|
9
9
|
- ModelEffectIdempotencyConfig: Configuration for effect idempotency store
|
|
10
10
|
- ModelRegistryRequest: Registry effect input request
|
|
11
11
|
- ModelRegistryResponse: Dual-backend registry operation response
|
|
12
|
+
|
|
13
|
+
Note:
|
|
14
|
+
ModelBackendResult canonical location is omnibase_infra.models.model_backend_result.
|
|
15
|
+
Re-exported here for backward compatibility.
|
|
12
16
|
"""
|
|
13
17
|
|
|
14
|
-
from omnibase_infra.
|
|
15
|
-
ModelBackendResult,
|
|
16
|
-
)
|
|
18
|
+
from omnibase_infra.models.model_backend_result import ModelBackendResult
|
|
17
19
|
from omnibase_infra.nodes.effects.models.model_effect_idempotency_config import (
|
|
18
20
|
ModelEffectIdempotencyConfig,
|
|
19
21
|
)
|
|
@@ -41,7 +41,7 @@ from uuid import UUID
|
|
|
41
41
|
from pydantic import BaseModel, ConfigDict, Field
|
|
42
42
|
|
|
43
43
|
from omnibase_infra.enums import EnumBackendType, EnumRegistryResponseStatus
|
|
44
|
-
from omnibase_infra.
|
|
44
|
+
from omnibase_infra.models.model_backend_result import (
|
|
45
45
|
ModelBackendResult,
|
|
46
46
|
)
|
|
47
47
|
|
|
@@ -24,7 +24,7 @@ from uuid import UUID
|
|
|
24
24
|
|
|
25
25
|
from omnibase_core.enums import EnumNodeKind
|
|
26
26
|
from omnibase_core.models.primitives import ModelSemVer
|
|
27
|
-
from omnibase_infra.
|
|
27
|
+
from omnibase_infra.models import ModelBackendResult
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
@runtime_checkable
|
|
@@ -100,7 +100,7 @@ from omnibase_infra.errors import (
|
|
|
100
100
|
InfraConnectionError,
|
|
101
101
|
InfraTimeoutError,
|
|
102
102
|
)
|
|
103
|
-
from omnibase_infra.
|
|
103
|
+
from omnibase_infra.models.model_backend_result import (
|
|
104
104
|
ModelBackendResult,
|
|
105
105
|
)
|
|
106
106
|
from omnibase_infra.nodes.effects.models.model_effect_idempotency_config import (
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2025 OmniNode Team
|
|
3
|
+
"""Node Contract Persistence Effect package - Declarative effect node for contract persistence.
|
|
4
|
+
|
|
5
|
+
This package provides NodeContractPersistenceEffect, a declarative effect node that
|
|
6
|
+
routes intents from ContractRegistryReducer to PostgreSQL handlers for contract
|
|
7
|
+
and topic persistence operations.
|
|
8
|
+
|
|
9
|
+
Architecture (OMN-1845):
|
|
10
|
+
This package follows the ONEX declarative node pattern:
|
|
11
|
+
- node.py: Declarative node shell extending NodeEffect
|
|
12
|
+
- handlers/: PostgreSQL operation handlers
|
|
13
|
+
- registry/: Infrastructure registry for dependency injection
|
|
14
|
+
- contract.yaml: Intent routing and I/O definitions
|
|
15
|
+
|
|
16
|
+
The node is 100% contract-driven with zero custom business logic in node.py.
|
|
17
|
+
All intent routing is defined in contract.yaml and handlers are resolved
|
|
18
|
+
via container dependency injection.
|
|
19
|
+
|
|
20
|
+
Node Type: EFFECT_GENERIC
|
|
21
|
+
Purpose: Execute PostgreSQL I/O operations based on intents from ContractRegistryReducer.
|
|
22
|
+
|
|
23
|
+
Implementation Details:
|
|
24
|
+
- Routes 6 intent types to specialized handlers
|
|
25
|
+
- Circuit breaker protection for PostgreSQL
|
|
26
|
+
- Error sanitization for security
|
|
27
|
+
- Retry policies for transient failures
|
|
28
|
+
|
|
29
|
+
Supported Intent Types:
|
|
30
|
+
- postgres.upsert_contract: Insert/update contract record
|
|
31
|
+
- postgres.update_topic: Update topic routing table
|
|
32
|
+
- postgres.mark_stale: Batch mark stale contracts
|
|
33
|
+
- postgres.update_heartbeat: Update heartbeat timestamp
|
|
34
|
+
- postgres.deactivate_contract: Soft delete contract
|
|
35
|
+
- postgres.cleanup_topic_references: Remove contract from topics
|
|
36
|
+
|
|
37
|
+
Handlers:
|
|
38
|
+
- HandlerPostgresContractUpsert: Contract upsert operations
|
|
39
|
+
- HandlerPostgresTopicUpdate: Topic routing updates
|
|
40
|
+
- HandlerPostgresMarkStale: Batch staleness marking
|
|
41
|
+
- HandlerPostgresHeartbeat: Heartbeat timestamp updates
|
|
42
|
+
- HandlerPostgresDeactivate: Contract deactivation
|
|
43
|
+
- HandlerPostgresCleanupTopics: Topic reference cleanup
|
|
44
|
+
|
|
45
|
+
Usage:
|
|
46
|
+
```python
|
|
47
|
+
from omnibase_core.models.container import ModelONEXContainer
|
|
48
|
+
from omnibase_infra.nodes.node_contract_persistence_effect import (
|
|
49
|
+
NodeContractPersistenceEffect,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Create via container injection
|
|
53
|
+
container = ModelONEXContainer()
|
|
54
|
+
effect = NodeContractPersistenceEffect(container)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Related:
|
|
58
|
+
- contract.yaml: Intent routing definition
|
|
59
|
+
- node.py: Declarative node implementation
|
|
60
|
+
- handlers/: PostgreSQL operation handlers
|
|
61
|
+
- registry/: Infrastructure registry
|
|
62
|
+
- contract_registry_reducer/: Source of intents
|
|
63
|
+
- OMN-1845: Implementation ticket
|
|
64
|
+
- OMN-1653: ContractRegistryReducer ticket
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
from __future__ import annotations
|
|
68
|
+
|
|
69
|
+
# Export handlers
|
|
70
|
+
from omnibase_infra.nodes.node_contract_persistence_effect.handlers import (
|
|
71
|
+
HandlerPostgresCleanupTopics,
|
|
72
|
+
HandlerPostgresContractUpsert,
|
|
73
|
+
HandlerPostgresDeactivate,
|
|
74
|
+
HandlerPostgresHeartbeat,
|
|
75
|
+
HandlerPostgresMarkStale,
|
|
76
|
+
HandlerPostgresTopicUpdate,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Export the declarative node
|
|
80
|
+
from omnibase_infra.nodes.node_contract_persistence_effect.node import (
|
|
81
|
+
NodeContractPersistenceEffect,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
# Export registry
|
|
85
|
+
from omnibase_infra.nodes.node_contract_persistence_effect.registry import (
|
|
86
|
+
RegistryInfraContractPersistenceEffect,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
__all__: list[str] = [
|
|
90
|
+
# Node
|
|
91
|
+
"NodeContractPersistenceEffect",
|
|
92
|
+
# Registry
|
|
93
|
+
"RegistryInfraContractPersistenceEffect",
|
|
94
|
+
# Handlers
|
|
95
|
+
"HandlerPostgresCleanupTopics",
|
|
96
|
+
"HandlerPostgresContractUpsert",
|
|
97
|
+
"HandlerPostgresDeactivate",
|
|
98
|
+
"HandlerPostgresHeartbeat",
|
|
99
|
+
"HandlerPostgresMarkStale",
|
|
100
|
+
"HandlerPostgresTopicUpdate",
|
|
101
|
+
]
|