Skip to content

feat(OMN-10769): pure condition evaluator for interactive onboarding transitions - #1547

Merged
jonahgabriel merged 3 commits into
mainfrom
omn-10769-condition-evaluator
May 10, 2026
Merged

jonahgabriel merged 3 commits into
mainfrom
omn-10769-condition-evaluator

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented May 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds evaluate_condition(expr, state) supporting ==, in [literal], in state_key, not in, and compound and
  • None condition returns True; unknown state keys raise ConditionEvaluationError (strict, no silent fallback)
  • Uses object throughout — no Any in function signatures or generic containers
  • Covers all condition patterns used in interactive_onboarding.yaml
  • Bumps INFRA_MAX_UNIONS from 148→149 for the list[object] | str collection return type

Ticket

OMN-10769 (child of OMN-10767 Interactive Onboarding Executor epic)

Test plan

  • uv run pytest tests/unit/onboarding/test_condition_evaluator.py -v — 10/10 pass
  • All pre-commit hooks pass (union, any-type, pattern, SPDX, ruff)
  • uv run mypy src/omnibase_infra/onboarding/condition_evaluator.py --strict — clean

Summary by CodeRabbit

  • Tests

    • Expanded test coverage for condition evaluation including membership operators and error handling scenarios.
    • Added integration tests validating routing decisions based on policy conditions in onboarding workflows.
  • Chores

    • Added license header documentation.

Review Change Stack

Evidence-Source: 498cf95027d9d5661ee119de10575bd9fc55e392
Evidence-Ticket: OMN-10769

@coderabbitai

coderabbitai Bot commented May 9, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds comprehensive unit and integration test coverage for the onboarding condition evaluator. Unit tests extend membership operator checks with literal list support and state-based compound conditions; integration tests verify routing through an interactive onboarding policy using condition evaluation against dynamic state.

Changes

Condition Evaluator Test Coverage Expansion

Layer / File(s) Summary
Unit Test Module Documentation
tests/unit/onboarding/test_condition_evaluator.py
Module docstring updated to reference additional issue identifier.
Unit Test - Not In Literal Lists
tests/unit/onboarding/test_condition_evaluator.py
TestNotIn class gains two test methods validating not in operator against literal list values, covering both non-membership (true) and membership (false) cases.
Unit Test - Interactive Onboarding Conditions
tests/unit/onboarding/test_condition_evaluator.py
TestInteractiveOnboardingConditions class introduces tests for compound state-based conditions combining equality checks with service not in selected_local_services membership and item in response list membership that resolve against evaluator state.
Unit Test - Error Handling
tests/unit/onboarding/test_condition_evaluator.py
TestUnknownKeyErrors adds error assertion verifying that unknown state keys used on the left-hand side of membership expressions raise ConditionEvaluationError with the missing key name.
Integration Test Infrastructure
tests/integration/onboarding/__init__.py, tests/integration/onboarding/test_condition_evaluator_policy_integration.py
New integration test module with SPDX license header, imports, POLICY_PATH pointing to interactive_onboarding.yaml, and interactive_policy fixture that loads the YAML policy file.
Integration Test Helpers
tests/integration/onboarding/test_condition_evaluator_policy_integration.py
Helper functions _transition_from and _next_on_submit_step enable navigation through policy transitions by matching step ids and evaluating condition branches against test state.
Integration Test Cases
tests/integration/onboarding/test_condition_evaluator_policy_integration.py
Two integration tests verify routing behavior: local mode without LLM routes to write_config_local; hybrid mode without LLM routes to write_config_hybrid based on state shape and condition evaluation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 New tests blossom like spring clover,
Membership checks and conditions all over,
State flows through branches, routing takes flight,
Integration and units—the coverage shines bright!
Hops forward with each assertion, pure delight! 🌱✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.05% 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 accurately reflects the main change: adding a pure condition evaluator for interactive onboarding transitions, which aligns with the PR objectives and file modifications.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 omn-10769-condition-evaluator

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

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@tests/unit/onboarding/test_condition_evaluator.py`:
- Around line 98-106: The test named test_not_in_literal_list is using the wrong
operator string ("in") so it never exercises the `not in` code path; update the
test's expression passed to evaluate_condition to use "not in" (for example
"deployment_mode not in [local, hybrid]") so evaluate_condition is invoked with
a `not in` operator and the assertion remains that the result is False; locate
this change in the test function test_not_in_literal_list in
tests/unit/onboarding/test_condition_evaluator.py which calls
evaluate_condition.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c6edacb-87e2-4ad5-b426-58d2946c2b17

📥 Commits

Reviewing files that changed from the base of the PR and between 0b7694c and 0bfe701.

📒 Files selected for processing (3)
  • src/omnibase_infra/onboarding/condition_evaluator.py
  • src/omnibase_infra/validation/infra_validators.py
  • tests/unit/onboarding/test_condition_evaluator.py

Comment thread tests/unit/onboarding/test_condition_evaluator.py Outdated
@jonahgabriel
jonahgabriel enabled auto-merge (squash) May 9, 2026 20:56
jonahgabriel and others added 3 commits May 9, 2026 22:20
…ing transitions

evaluate_condition() supports ==, in [literal], in state_key, not in, and compound
'and'. Uses object instead of Any throughout. Unknown state keys raise
ConditionEvaluationError. No eval()/exec(). Bumps INFRA_MAX_UNIONS to 149.
The condition evaluator resolves the LHS of `in` / `not in` expressions
as a state key (not a literal string). Tests from the PR branch assumed
literal LHS values. Updated tests to provide the LHS as a state key,
matching the correct behavior of the regex-based evaluator from main.
@jonahgabriel
jonahgabriel force-pushed the omn-10769-condition-evaluator branch from 5af449d to a5b8b05 Compare May 10, 2026 02:27

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/integration/onboarding/test_condition_evaluator_policy_integration.py (1)

46-68: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add required integration test marker(s).

These tests are missing pytest markers. In this repo, tests must be explicitly marked; otherwise marker-based runs can skip them unintentionally. Please add @pytest.mark.integration on each test or set module-level pytestmark.

Suggested patch
 import pytest
 import yaml
 
 from omnibase_infra.onboarding.condition_evaluator import evaluate_condition
 
+pytestmark = pytest.mark.integration
+
 POLICY_PATH = (

As per coding guidelines: "Test files must use pytest markers: mark test functions with @pytest.mark.unit, @pytest.mark.integration, @pytest.mark.slow, @pytest.mark.chaos, or @pytest.mark.performance as appropriate".

🤖 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 `@tests/integration/onboarding/test_condition_evaluator_policy_integration.py`
around lines 46 - 68, The two integration tests
(test_policy_not_in_response_routes_local_without_llm_to_terminal and
test_policy_not_in_selected_services_routes_hybrid_without_llm_to_terminal) are
missing pytest markers; add `@pytest.mark.integration` above each test function or
define a module-level pytestmark = [pytest.mark.integration] to ensure pytest
recognizes them as integration tests, and import pytest at top if not already
present; keep the existing test names and assertions unchanged.
🤖 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.

Outside diff comments:
In `@tests/integration/onboarding/test_condition_evaluator_policy_integration.py`:
- Around line 46-68: The two integration tests
(test_policy_not_in_response_routes_local_without_llm_to_terminal and
test_policy_not_in_selected_services_routes_hybrid_without_llm_to_terminal) are
missing pytest markers; add `@pytest.mark.integration` above each test function or
define a module-level pytestmark = [pytest.mark.integration] to ensure pytest
recognizes them as integration tests, and import pytest at top if not already
present; keep the existing test names and assertions unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 99d4c604-bcb3-444a-90a5-c30e550d6a02

📥 Commits

Reviewing files that changed from the base of the PR and between 0bfe701 and a5b8b05.

📒 Files selected for processing (3)
  • tests/integration/onboarding/__init__.py
  • tests/integration/onboarding/test_condition_evaluator_policy_integration.py
  • tests/unit/onboarding/test_condition_evaluator.py
✅ Files skipped from review due to trivial changes (2)
  • tests/integration/onboarding/init.py
  • tests/unit/onboarding/test_condition_evaluator.py

@jonahgabriel
jonahgabriel merged commit 32fee6f into main May 10, 2026
48 checks passed
@jonahgabriel
jonahgabriel deleted the omn-10769-condition-evaluator branch May 10, 2026 02:40
jonahgabriel added a commit that referenced this pull request Aug 5, 2026
omnibase_core#1547 (round-#3 remediation of the msk-direct-broker-endpoint
url-authority rule) merged to dev at 478e205d6f415adb2b5edd06b61f185279bba12e.
Re-pins both url-authority-gate.yml git-SHA pins and the
.pre-commit-config.yaml rev from the provisional branch-head SHA
(75c851266b) to this real merge commit, per the plan disclosed in the
prior commit on this branch. This PR is no longer blocked on #1547 landing
(it has landed) but will still not go green on its own: the full-repo scan
will find 3 NEW, non-baselined, non-suppressible violations in
docker/docker-compose.gateway.yml:51-52 and
docker/gateway/beta-gateway-canary.yaml:35 — the sanctioned gateway
forwarder's own bastion-IP route, tracked on OMN-15694/OMN-15534.

Cites OMN-15692.
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.

2 participants