Skip to content

feat(OMN-14822): regenerate node_invariant_evaluate_compute to canonical def-B - #2352

Merged
jonahgabriel merged 3 commits into
devfrom
jonah/omn-14822-node_invariant_evaluate_compute-defb
Jul 20, 2026
Merged

jonahgabriel merged 3 commits into
devfrom
jonah/omn-14822-node_invariant_evaluate_compute-defb

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

OMN-14822 — canonical def-B flip: node_invariant_evaluate_compute (Class-B Tier-1)

Regenerates the 3-operation COMPUTE node node_invariant_evaluate_compute to 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_bundle assertion 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

  • def-B flip: the three module-level async functions (handle_invariant_evaluate / _batch / _all) are deleted and their behavior moves onto three def-B handler classes — HandlerInvariantEvaluate / HandlerInvariantEvaluateBatch / HandlerInvariantEvaluateAll — each exposing async handle(request) -> response. No retained shim, no ModelEventEnvelope. The InvariantEvaluator business logic (evaluator_invariant.py) is untouched.
  • contract: routing cleaned to canonical name + module per operation (legacy function/type removed); contract_version patch bump.
  • baselines shrunk: node removed from canonical_handler_shape_baseline.py NON_CANONICAL (91→90, via --update) and from handler_dispatch_entrypoint_baseline.yaml known_entrypointless.
  • proof artifacts (scripts/ci/adequacy_receipts/): adequacy receipt + hand-flip proof, both bound to the same 6-input SELECTED corpus.
  • tests: unit + integration tests repointed to the class 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:

verify_flip_bundle OK — omnibase_infra.nodes.node_invariant_evaluate_compute: all six flip-bundle assertions hold

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):

  • RED on dev (pre-flip HandlerInvariantEvaluate exists but exposes no handle) driven through the REAL callback:
    ModelOnexError: Auto-wired handler HandlerInvariantEvaluate does not expose a callable handle() or handle_async() dispatch entrypoint.
  • GREEN on flip: 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-B handle entrypoints.

Generated vs hand-flip: HAND-FLIP (see Path above).

Local gates: ruff format --check clean, ruff check clean, mypy clean (9 files), focused pytest green, pre-commit run green, 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

    • Added dedicated handling for single, batch, and complete invariant evaluations.
    • Improved operation routing with explicit handler definitions and input/output details.
    • Preserved evaluation behavior while supporting ordered batch results and aggregate summaries.
  • Bug Fixes

    • Ensured dispatch consistently reaches the appropriate evaluation handler.
    • Prevented shared evaluator state between requests.
  • Tests

    • Added integration and dispatch coverage for successful, failed, batch, and fail-fast evaluations.
    • Added validation for required handler entry points and legacy routing removal.

…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.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The invariant evaluation node now routes operations to canonical class-based handlers with async handle entrypoints. Per-request evaluators support single, batch, and aggregate evaluation, while integration tests, dispatch tests, baselines, and adequacy receipts validate the migration.

Changes

Invariant evaluation handler migration

Layer / File(s) Summary
Canonical handler contract and implementation
src/omnibase_infra/nodes/node_invariant_evaluate_compute/contract.yaml, src/omnibase_infra/nodes/node_invariant_evaluate_compute/handlers/*
The contract routes each operation to a dedicated handler class, replacing legacy function fields. The handlers expose async handle methods and create per-request evaluators.
Dispatch and behavior validation
tests/integration/test_omn_11548_invariant_evaluate_compute.py, tests/unit/nodes/node_invariant_evaluate_compute/*
Tests verify canonical routing, removed free-function shims, real dispatch entrypoints, and preserved single, batch, and aggregate evaluation behavior.
Ratchet baselines and adequacy receipts
config/validation/handler_dispatch_entrypoint_baseline.yaml, scripts/ci/canonical_handler_shape_baseline.py, scripts/ci/adequacy_receipts/*node_invariant_evaluate_compute*
Baselines remove the node from legacy classifications, and adequacy receipts record parity and coverage results.

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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: regenerating node_invariant_evaluate_compute to canonical def-B for OMN-14822.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonah/omn-14822-node_invariant_evaluate_compute-defb

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/omnibase_infra/nodes/node_invariant_evaluate_compute/handlers/handler_invariant_evaluate.py (1)

27-89: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider deduplicating handler_type/handler_category across the three handler classes.

HandlerInvariantEvaluate, HandlerInvariantEvaluateBatch, and HandlerInvariantEvaluateAll each redefine the same two properties. A tiny shared base/mixin would remove the duplication while keeping each class's handle signature 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

📥 Commits

Reviewing files that changed from the base of the PR and between 03042f4 and 483d3d6.

📒 Files selected for processing (10)
  • config/validation/handler_dispatch_entrypoint_baseline.yaml
  • scripts/ci/adequacy_receipts/omnibase_infra.nodes.node_invariant_evaluate_compute.handflip.json
  • scripts/ci/adequacy_receipts/omnibase_infra.nodes.node_invariant_evaluate_compute.json
  • scripts/ci/canonical_handler_shape_baseline.py
  • src/omnibase_infra/nodes/node_invariant_evaluate_compute/contract.yaml
  • src/omnibase_infra/nodes/node_invariant_evaluate_compute/handlers/__init__.py
  • src/omnibase_infra/nodes/node_invariant_evaluate_compute/handlers/handler_invariant_evaluate.py
  • tests/integration/test_omn_11548_invariant_evaluate_compute.py
  • tests/unit/nodes/node_invariant_evaluate_compute/test_handler_invariant_evaluate.py
  • tests/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

@jonahgabriel
jonahgabriel merged commit c29f534 into dev Jul 20, 2026
150 of 153 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/omn-14822-node_invariant_evaluate_compute-defb branch July 20, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant