Repository navigation
feat(OMN-14822): regenerate node_invariant_evaluate_compute to canonical def-B - #2352
Conversation
…cal def-B Hand-flip of the 3-operation COMPUTE node to canonical definition B: each operation now routes to its own def-B handler class (HandlerInvariantEvaluate / Batch / All) exposing handle(request) -> response. The three module-level free functions are deleted (no retained shim, no ModelEventEnvelope); business logic stays in the untouched InvariantEvaluator. - contract routing cleaned to canonical name+module (function/type removed), contract_version patch bump. - shared _new_evaluator helper + HandlerInvariantEvaluate classification properties preserved byte-identical base_ref<->HEAD (git-re-derived verbatim proof, .handflip.json). - adequacy receipt + hand-flip proof committed, input-set-bound (6-input corpus). - node removed from canonical_handler_shape_baseline NON_CANONICAL (91->90) and from handler_dispatch_entrypoint_baseline known_entrypointless. - tests-as-proof: dispatch-entrypoint test RED on dev (missing handle -> _missing_handle ModelOnexError) -> GREEN on flip; full-corpus behavior equivalence across all three operations. verify_flip_bundle seam gate: all six assertions PASS. Part of the canonical-shape ratchet-gate Class-B Tier-1 flip fan-out.
📝 WalkthroughWalkthroughThe invariant evaluation node now routes operations to canonical class-based handlers with async ChangesInvariant evaluation handler migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant EventDispatch
participant HandlerInvariantEvaluate
participant InvariantEvaluator
participant OutputEvent
EventDispatch->>HandlerInvariantEvaluate: dispatch operation payload
HandlerInvariantEvaluate->>InvariantEvaluator: create evaluator and evaluate
InvariantEvaluator-->>HandlerInvariantEvaluate: invariant result or summary
HandlerInvariantEvaluate-->>OutputEvent: return handler response
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…nvariant_evaluate_compute-defb
…nvariant_evaluate_compute-defb
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/omnibase_infra/nodes/node_invariant_evaluate_compute/handlers/handler_invariant_evaluate.py (1)
27-89: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider deduplicating
handler_type/handler_categoryacross the three handler classes.
HandlerInvariantEvaluate,HandlerInvariantEvaluateBatch, andHandlerInvariantEvaluateAlleach redefine the same two properties. A tiny shared base/mixin would remove the duplication while keeping each class'shandlesignature distinct.♻️ Proposed refactor
+class _ComputeHandlerBase: + `@property` + def handler_type(self) -> EnumHandlerType: + return EnumHandlerType.COMPUTE_HANDLER + + `@property` + def handler_category(self) -> EnumHandlerTypeCategory: + return EnumHandlerTypeCategory.COMPUTE + + -class HandlerInvariantEvaluate: +class HandlerInvariantEvaluate(_ComputeHandlerBase): """Canonical def-B handler: evaluate one invariant against an output payload.""" - - `@property` - def handler_type(self) -> EnumHandlerType: - return EnumHandlerType.COMPUTE_HANDLER - - `@property` - def handler_category(self) -> EnumHandlerTypeCategory: - return EnumHandlerTypeCategory.COMPUTE(repeat for the other two classes)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/omnibase_infra/nodes/node_invariant_evaluate_compute/handlers/handler_invariant_evaluate.py` around lines 27 - 89, Deduplicate the identical handler_type and handler_category properties shared by HandlerInvariantEvaluate, HandlerInvariantEvaluateBatch, and HandlerInvariantEvaluateAll by introducing a small shared base class or mixin. Have each handler inherit the shared implementation while preserving its distinct handle method signatures and evaluation behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@src/omnibase_infra/nodes/node_invariant_evaluate_compute/handlers/handler_invariant_evaluate.py`:
- Around line 27-89: Deduplicate the identical handler_type and handler_category
properties shared by HandlerInvariantEvaluate, HandlerInvariantEvaluateBatch,
and HandlerInvariantEvaluateAll by introducing a small shared base class or
mixin. Have each handler inherit the shared implementation while preserving its
distinct handle method signatures and evaluation behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8c1b4489-13ec-4126-9221-649c182381e0
📒 Files selected for processing (10)
config/validation/handler_dispatch_entrypoint_baseline.yamlscripts/ci/adequacy_receipts/omnibase_infra.nodes.node_invariant_evaluate_compute.handflip.jsonscripts/ci/adequacy_receipts/omnibase_infra.nodes.node_invariant_evaluate_compute.jsonscripts/ci/canonical_handler_shape_baseline.pysrc/omnibase_infra/nodes/node_invariant_evaluate_compute/contract.yamlsrc/omnibase_infra/nodes/node_invariant_evaluate_compute/handlers/__init__.pysrc/omnibase_infra/nodes/node_invariant_evaluate_compute/handlers/handler_invariant_evaluate.pytests/integration/test_omn_11548_invariant_evaluate_compute.pytests/unit/nodes/node_invariant_evaluate_compute/test_handler_invariant_evaluate.pytests/unit/nodes/node_invariant_evaluate_compute/test_invariant_evaluate_dispatch_entrypoint_omn14822.py
💤 Files with no reviewable changes (2)
- scripts/ci/canonical_handler_shape_baseline.py
- config/validation/handler_dispatch_entrypoint_baseline.yaml
OMN-14822 — canonical def-B flip:
node_invariant_evaluate_compute(Class-B Tier-1)Regenerates the 3-operation COMPUTE node
node_invariant_evaluate_computeto canonical definition B as part of the Class-B Tier-1 canonical-shape flip fan-out (parent epic OMN-14355; hand-flip proof path OMN-14781; seam gate OMN-14809). Mirrors canary #2349 (hand-flip) / #2350 (equivalence) templates.Path: HAND-FLIP (generated body not used)
The local RSD / equivalence-receipt path was not taken:
verify_flip_bundleassertion 6 (independent-author) cannot be honestly satisfied by a single git identity — the equivalence golden would be self-authored (E1 FAIL). The hand-flip proof path (OMN-14781) is git-re-derived verbatim-preservation and is exempt from assertion 6, so it is the honest single-identity route for this node.What changed
handle_invariant_evaluate/_batch/_all) are deleted and their behavior moves onto three def-B handler classes —HandlerInvariantEvaluate/HandlerInvariantEvaluateBatch/HandlerInvariantEvaluateAll— each exposingasync handle(request) -> response. No retained shim, noModelEventEnvelope. TheInvariantEvaluatorbusiness logic (evaluator_invariant.py) is untouched.name+moduleper operation (legacyfunction/typeremoved);contract_versionpatch bump.canonical_handler_shape_baseline.pyNON_CANONICAL(91→90, via--update) and fromhandler_dispatch_entrypoint_baseline.yamlknown_entrypointless.scripts/ci/adequacy_receipts/): adequacy receipt + hand-flip proof, both bound to the same 6-input SELECTED corpus.handle; new dispatch-entrypoint test drives the REAL_make_dispatch_callback(RED missing-handle → GREEN) plus full-corpus behavior equivalence.dod_evidence
verify_flip_bundle seam gate (OMN-14809) — all six assertions PASS:
Preserved-symbol verbatim proof (byte-identical base_ref↔HEAD, git-re-derived):
_new_evaluator,HandlerInvariantEvaluate.handler_type,HandlerInvariantEvaluate.handler_category— all IDENTICAL post-format.Tests-as-proof (RED-against-exists-but-wrong → GREEN):
HandlerInvariantEvaluateexists but exposes nohandle) driven through the REAL callback:ModelOnexError: Auto-wired handler HandlerInvariantEvaluate does not expose a callable handle() or handle_async() dispatch entrypoint.tests/unit/nodes/node_invariant_evaluate_compute/+ integration — 45 passed.Equivalence: full 6-input corpus across all three operations (
evaluate/evaluate_batch/evaluate_all) asserts identical outcomes through the def-Bhandleentrypoints.Generated vs hand-flip: HAND-FLIP (see Path above).
Local gates:
ruff format --checkclean,ruff checkclean,mypyclean (9 files), focused pytest green,pre-commit rungreen, canonical-shape ratchet OK (new=0 unproven_flips=0), entrypoint validator OK (0 new violations), pre-push mypy + architecture + impacted-test selector + deploy-scope-dod (NOTICE, companion unmerged) all passed.OCC autobind
Evidence-Source: OCC#4478
Evidence-Ticket: OMN-14822
Central OCC deploy-scope evidence is merged. No bypass tokens, no live deploy, no .201 mutation.
Parent epic: OMN-14355.
Evidence-Source: OCC#4478
Evidence-Ticket: OMN-14822
Summary by CodeRabbit
New Features
Bug Fixes
Tests