Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d453cf6
feat(fsm): add MVP FSM contract models for NodeReducer v1.0 [OMN-578,…
jonahgabriel Dec 11, 2025
6bf8c2b
refactor(fsm): consolidate FSM models and fix dict[str, Any] violatio…
jonahgabriel Dec 11, 2025
ed56453
Merge branch 'main' into feature/fsm-contract-models-omn-578-581
jonahgabriel Dec 11, 2025
e85d072
fix(fsm): address PR #165 review feedback for FSM contract models
jonahgabriel Dec 11, 2025
fc49829
fix(tests): resolve ruff I001 import sorting violations and rename te…
jonahgabriel Dec 11, 2025
a561c27
fix(fsm): address remaining PR #165 review feedback
jonahgabriel Dec 11, 2025
9fed91b
fix(fsm): address PR #165 review feedback - add frozen models and val…
jonahgabriel Dec 12, 2025
59d1427
fix(fsm): complete PR #165 review - deep immutability and code quality
jonahgabriel Dec 12, 2025
5c1419c
merge: resolve main branch conflicts in FSM modules
jonahgabriel Dec 12, 2025
0f9a156
fix(types): correct return type for get_state_history
jonahgabriel Dec 12, 2025
7990263
fix(fsm): address PR #165 review - deep immutability, formatting, and…
jonahgabriel Dec 12, 2025
ac997c0
Merge remote-tracking branch 'origin/main' into feature/fsm-contract-…
jonahgabriel Dec 12, 2025
35f3034
style: fix ruff import sorting and single-class-per-file violations
jonahgabriel Dec 12, 2025
8dbcbb9
fix(fsm): address PR #165 review - type safety, immutability, and tests
jonahgabriel Dec 12, 2025
b7ceafc
fix(fsm): correct attribute name and test schema for ModelActionConfi…
jonahgabriel Dec 12, 2025
85a55e9
fix(fsm): address PR #165 review - type safety, immutability, and tests
jonahgabriel Dec 12, 2025
1e93935
Merge branch 'main' into feature/fsm-contract-models-omn-578-581
jonahgabriel Dec 12, 2025
08dbc8d
fix(fsm): resolve CI test failures for FSM contract models
jonahgabriel Dec 12, 2025
417e52a
fix(fsm): improve FSM validation and remove type aliases [OMN-578, OM…
jonahgabriel Dec 12, 2025
04255b9
fix(fsm): align FSM executor operators with condition validator [OMN-…
jonahgabriel Dec 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/omnibase_core/mixins/mixin_fsm_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from omnibase_core.models.contracts.subcontracts.model_fsm_subcontract import (
ModelFSMSubcontract,
)
from omnibase_core.types.type_serializable_value import SerializedDict
from omnibase_core.types.type_fsm_context import FSMContextType
from omnibase_core.utils.fsm_executor import (
FSMState,
FSMTransitionResult,
Expand Down Expand Up @@ -56,7 +56,7 @@ async def execute_fsm_transition(
self,
fsm_contract: ModelFSMSubcontract,
trigger: str,
context: "SerializedDict",
context: FSMContextType,
) -> FSMTransitionResult:
"""
Execute FSM transition from YAML contract.
Expand Down Expand Up @@ -104,13 +104,13 @@ async def execute_fsm_transition(
# Update internal state if successful
if result.success:
# Create new FSMState with updated current state and history
history = (self._fsm_state.history if self._fsm_state else []) + [
result.old_state
]
# Use tuple concatenation to maintain immutability
previous_history = self._fsm_state.history if self._fsm_state else ()
new_history = previous_history + (result.old_state,)
self._fsm_state = FSMState(
current_state=result.new_state,
context=context,
history=history,
history=new_history,
)

return result
Expand Down Expand Up @@ -155,18 +155,18 @@ def get_current_fsm_state(self) -> str | None:
"""
return self._fsm_state.current_state if self._fsm_state else None

def get_fsm_state_history(self) -> list[str]:
def get_fsm_state_history(self) -> tuple[str, ...]:
"""
Get FSM state transition history.

Returns:
List of previous state names in chronological order
Tuple of previous state names in chronological order (immutable)

Example:
history = self.get_fsm_state_history()
print(f"State history: {' -> '.join(history)}")
"""
return self._fsm_state.history if self._fsm_state else []
return self._fsm_state.history if self._fsm_state else ()

def reset_fsm_state(self, fsm_contract: ModelFSMSubcontract) -> None:
"""
Expand All @@ -183,7 +183,7 @@ def reset_fsm_state(self, fsm_contract: ModelFSMSubcontract) -> None:
self._fsm_state = get_initial_state(fsm_contract)

def initialize_fsm_state(
self, fsm_contract: ModelFSMSubcontract, context: SerializedDict | None = None
self, fsm_contract: ModelFSMSubcontract, context: FSMContextType | None = None
) -> None:
"""
Initialize FSM state with optional context.
Expand All @@ -202,7 +202,7 @@ def initialize_fsm_state(
self._fsm_state = FSMState(
current_state=fsm_contract.initial_state,
context=context or {},
history=[],
history=(),
)

def is_terminal_state(self, fsm_contract: ModelFSMSubcontract) -> bool:
Expand Down
4 changes: 3 additions & 1 deletion src/omnibase_core/mixins/mixin_node_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ def get_executor_health(self) -> "TypedDictNodeExecutorHealth":
Returns:
Typed dictionary containing health metrics and status
"""
from omnibase_core.types.typed_dict_mixin_types import TypedDictNodeExecutorHealth
from omnibase_core.types.typed_dict_mixin_types import (
TypedDictNodeExecutorHealth,
)

uptime_seconds = 0
if self._start_time:
Expand Down
4 changes: 3 additions & 1 deletion src/omnibase_core/mixins/mixin_workflow_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ def create_workflow_steps_from_config(
]
steps = self.create_workflow_steps_from_config(steps_config)
"""
from omnibase_core.types.typed_dict_mixin_types import TypedDictWorkflowStepConfig
from omnibase_core.types.typed_dict_mixin_types import (
TypedDictWorkflowStepConfig,
)

workflow_steps: list[ModelWorkflowStep] = []

Expand Down
4 changes: 3 additions & 1 deletion src/omnibase_core/models/common/model_dict_value_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ def validate_value_type_match(self) -> ModelDictValueUnion:
return self

# union-ok: discriminated_union - return type matches discriminated value field
def get_value(self) -> Union[bool, dict[str, object], float, int, list[object], str]:
def get_value(
self,
) -> Union[bool, dict[str, object], float, int, list[object], str]:
"""
Get the stored value with proper type.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import json
pass # no typing imports needed

# no typing imports needed
from pydantic import BaseModel, Field, model_validator

from omnibase_core.enums.enum_core_error_code import EnumCoreErrorCode
Expand Down
4 changes: 3 additions & 1 deletion src/omnibase_core/models/common/model_value_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ def validate_value_type_match(self) -> ModelValueUnion:
return self

# union-ok: discriminated_union - return type matches discriminated value field
def get_value(self) -> Union[bool, int, float, str, list[object], dict[str, object]]:
def get_value(
self,
) -> Union[bool, int, float, str, list[object], dict[str, object]]:
"""
Get the stored value with proper type.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
class ModelGitHubCommentChange(BaseModel):
"""Represents a change to a GitHub comment field."""

from_: str | None = Field(
default=None, alias="from", description="Previous value"
)
from_: str | None = Field(default=None, alias="from", description="Previous value")


class ModelGitHubIssueCommentChanges(BaseModel):
Expand Down
7 changes: 4 additions & 3 deletions src/omnibase_core/models/configuration/model_log_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

from pydantic import BaseModel, Field

from omnibase_core.types import SerializedDict

from omnibase_core.models.configuration.model_log_filter_config import (
ModelLogFilterConfig,
)
from omnibase_core.types import SerializedDict


class ModelLogFilter(BaseModel):
Expand Down Expand Up @@ -136,7 +135,9 @@ def _matches_custom(self, message: str, fields: dict[str, object]) -> bool:
def apply_filter(self, log_entry: dict[str, object]) -> dict[str, object] | None:
"""Apply this filter to a log entry."""
level_value_raw = log_entry.get("level", 0)
level_value = int(level_value_raw) if isinstance(level_value_raw, (int, float)) else 0
level_value = (
int(level_value_raw) if isinstance(level_value_raw, (int, float)) else 0
)
message_raw = log_entry.get("message", "")
message = str(message_raw) if message_raw is not None else ""
fields: dict[str, object] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Per-user limits model for defining user-specific rate limiting rules
with user tiers, quotas, and individual user overrides.
"""

from uuid import UUID

from pydantic import BaseModel, Field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ class ModelPriorityMetadataSummary(BaseModel):
approval_required: bool = Field(
default=False, description="Whether approval is required"
)
approved_users_count: int = Field(
default=0, description="Number of approved users"
)
approved_users_count: int = Field(default=0, description="Number of approved users")
approved_groups_count: int = Field(
default=0, description="Number of approved groups"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def get_enabled_features(self) -> dict[str, bool]:
"""Get features that should remain enabled during degradation"""
if not self.should_degrade_service():
# All features enabled when not degrading
return {key: True for key in self.degradation_features.keys()}
return dict.fromkeys(self.degradation_features.keys(), True)

# During degradation, return the configured feature states
return self.degradation_features.copy()
Expand All @@ -268,9 +268,7 @@ def get_throttle_response(
status_code=self.reject_status_code,
headers=self.get_response_headers(retry_after),
message=self.reject_message,
body=self.custom_response_body
if self.custom_response_enabled
else None,
body=self.custom_response_body if self.custom_response_enabled else None,
)

@classmethod
Expand Down
6 changes: 6 additions & 0 deletions src/omnibase_core/models/contracts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
)

from . import subcontracts
from .model_action_config_parameter import (
ModelActionConfigParameter,
ParameterType,
)
from .model_action_emission_config import ModelActionEmissionConfig
from .model_algorithm_config import ModelAlgorithmConfig
from .model_algorithm_factor_config import ModelAlgorithmFactorConfig
Expand Down Expand Up @@ -150,6 +154,8 @@
# Runtime Host Contract models
"ModelRuntimeHostContract",
# Configuration models
"ModelActionConfigParameter",
"ParameterType",
"ModelAlgorithmConfig",
"ModelAlgorithmFactorConfig",
"ModelBackupConfig",
Expand Down
Loading