Repository navigation
refactor(contracts): rename handler_kind to node_archetype [OMN-1465] - #428
Conversation
Rename the `handler_kind` field to `node_archetype` across omnibase_core to align with omnibase_infra PR #187 and establish canonical vocabulary for contract-level architectural role classification. Changes: - Add EnumNodeArchetype enum (COMPUTE, EFFECT, REDUCER, ORCHESTRATOR) - Add NodeArchetypeField type alias with BeforeValidator for YAML coercion - Update ModelHandlerBehavior field: handler_kind → node_archetype - Update ModelHandlerContract validator for consistency checks - Update JSON schema with node_archetype property - Update all factory profiles to use EnumNodeArchetype enum values - Update validators, merge engine, and execution resolver - Update validation script (handler_contract_validator.py) - Update all tests (15 files), docs (4 files), and YAML examples (4 files) Breaking change: Contracts must use `node_archetype` instead of `handler_kind`. No backwards compatibility - schema rejects `handler_kind` field.
📝 WalkthroughWalkthroughThis PR renames the public field Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
…[OMN-1465] Remove unnecessary str() cast - EnumNodeArchetype inherits from str, so enum values compare directly with strings.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/omnibase_core/schemas/handler_contract.schema.json`:
- Line 262: Update the stale enum reference in the long description string:
replace the "See Also" entry that mentions EnumNodeKind with EnumNodeArchetype
and update its brief text to "Enum defining node archetype values" so the
description matches the renamed symbol; look for the description field in
handler_contract.schema.json (the block containing "See Also:") and change the
EnumNodeKind reference to EnumNodeArchetype.
🧹 Nitpick comments (1)
src/omnibase_core/models/contracts/model_handler_contract.py (1)
46-59: Prefer EnumNodeArchetype constants in the prefix map to avoid string drift.Using enum values keeps the mapping aligned with the canonical set and reduces typo risk in future edits.
♻️ Suggested refactor
-from omnibase_core.enums.enum_core_error_code import EnumCoreErrorCode +from omnibase_core.enums.enum_core_error_code import EnumCoreErrorCode +from omnibase_core.enums.enum_node_archetype import EnumNodeArchetype @@ - # Map common prefixes to node archetypes - prefix_to_archetype = { - "node": None, # Generic, any archetype allowed - "handler": None, # Generic, any archetype allowed - "compute": "compute", - "effect": "effect", - "reducer": "reducer", - "orchestrator": "orchestrator", - } + # Map common prefixes to node archetypes + prefix_to_archetype = { + "node": None, # Generic, any archetype allowed + "handler": None, # Generic, any archetype allowed + "compute": EnumNodeArchetype.COMPUTE, + "effect": EnumNodeArchetype.EFFECT, + "reducer": EnumNodeArchetype.REDUCER, + "orchestrator": EnumNodeArchetype.ORCHESTRATOR, + } @@ - # EnumNodeArchetype inherits from str, so string comparison works - if ( - expected_archetype is not None - and str(self.descriptor.node_archetype) != expected_archetype - ): + # EnumNodeArchetype inherits from str, so direct comparison works + if expected_archetype is not None and self.descriptor.node_archetype != expected_archetype: raise ModelOnexError( message=( f"Handler ID prefix '{prefix}' implies node_archetype='{expected_archetype}' " f"but descriptor has node_archetype='{self.descriptor.node_archetype}'" ), error_code=EnumCoreErrorCode.VALIDATION_ERROR, handler_id=self.handler_id, - expected_archetype=expected_archetype, + expected_archetype=str(expected_archetype), actual_archetype=str(self.descriptor.node_archetype), )Also applies to: 364-404
- Bump version from 0.9.1 to 0.9.2 in pyproject.toml and __init__.py - Fix schema description to reference EnumNodeArchetype instead of EnumNodeKind
Summary
handler_kindfield tonode_archetypeacross omnibase_coreChanges
New Files
src/omnibase_core/enums/enum_node_archetype.py- New enum with COMPUTE, EFFECT, REDUCER, ORCHESTRATOR valuesCore Model Updates
ModelHandlerBehavior: Field renamed withNodeArchetypeFieldtype alias (includesBeforeValidatorfor YAML string coercion)ModelHandlerContract: Validator renamed tovalidate_descriptor_node_archetype_consistencynode_archetypepropertyFactory & Validation Updates
EnumNodeArchetype.Xenum valuesvalidator_expanded_contract.py: Method renamedcontract_merge_engine.py: Uses enum valueshandler_contract_validator.pyscript: Complete updateDocumentation & Examples
Breaking Change
Contracts must use
node_archetypeinstead ofhandler_kind. The schema hard-rejectshandler_kind- no backwards compatibility per ONEX "break now, no shims" policy.Test plan
handler_kindreferences remain (except changelog docs)Related
Summary by CodeRabbit
Documentation
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.