Skip to content

fix(OMN-14141): fail-closed guard + CI gate for handler_routing flat-schema silent-zero-parse - #2235

Merged
jonahgabriel merged 3 commits into
devfrom
jonah/omn-14141-fail-closed-guard-ci-gate-for-contract-handler_routing-flat
Jul 8, 2026
Merged

jonahgabriel merged 3 commits into
devfrom
jonah/omn-14141-fail-closed-guard-ci-gate-for-contract-handler_routing-flat

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Systemic enforcement for the contract handler_routing flat-schema silent-zero-parse defect class — the root cause behind the WI-14 saga (OMN-14139 / OMN-14135).

The defect (two-stage silent failure):

  1. runtime/auto_wiring/discovery.py::_parse_handler_routing silently skipped any handler_routing.handlers[] entry using the flat handler_class:/handler_module: keys instead of the nested handler: {name, module} dict — producing handlers=() with no error.
  2. handler_wiring.py::_commit_contract_wiring then reported EnumWiringOutcome.WIRED with zero dispatchers while still subscribing to and committing Kafka offsets on the topic — silent phantom-wiring (topic looks consumed, no handler ever runs).

Enforcement (CLAUDE.md Rule #5 — gate ships WITH the fixes, wired as CI gate + pre-commit in the same PR)

  • Guard A (parse-time) — _parse_handler_routing now raises ValueError on a flat/malformed handlers[] entry instead of silently skipping it. The legacy top-level handler: {module, class} fallback is preserved (an empty/absent handlers list never raises).
  • Guard B (wire-time) — _commit_contract_wiring returns FAILED (not WIRED) and does not subscribe when a contract declares subscribe topics but registers zero dispatchers. It never fires on legacy fallbacks (they produce ≥1 dispatcher) or on resolver-ownership / quarantine skips.
  • CI gate + pre-commit hook — new omnibase_infra.validators.handler_routing_schema scans every node contract.yaml and rejects flat entries. Wired as ci.yml step "handler_routing flat-schema gate (OMN-14141)" + pre-commit hook handler-routing-schema-gate, alongside the existing operation_match gate.

Contract fixes (7 infra contracts the gate would reject)

Converted flat handler_class/handler_module → nested handler: {name, module} (routing semantics preserved; node_ledger_write_effect already fixed in #2234):
node_savings_estimation_compute, node_build_loop_write_effect, node_session_state_effect, node_pattern_lifecycle_effect, node_validation_executor, node_decision_store_query_compute, node_baseline_comparison_compute.

Verification (dod_evidence)

  • Empirical loader run over the tree: 111/111 contracts discover with zero errors; all 7 defect contracts now parse to ≥1 handler (previously 0).
  • Real wire_from_manifest over all node contracts: Guard B fires on zero real contracts (only on a synthetic phantom fixture).
  • batch_validate_node_contracts.py: 111/111 passed. operation_match gate, published_events consistency, yamlfmt: green.
  • Tests: 354 auto_wiring + kernel-contract-loading tests green; 11 new guard tests (tests/unit/runtime/auto_wiring/test_handler_routing_flat_schema_guard.py) green.
  • Full local pre-commit (all hooks) green on commit; ruff format/check + mypy clean.

Follow-up (separate PR, out of scope here)

3 omnimarket flat-schema contracts + the omnimarket-side gate.

Closes OMN-14141
Evidence-Ticket: OMN-14141
Evidence-Source: OCC#3701

…schema silent-zero-parse

The flat handler_class:/handler_module: schema silently parsed to zero
handlers, then auto-wiring reported WIRED with zero dispatchers while still
subscribing to and committing Kafka offsets on the topic — silent
phantom-wiring (the WI-14 root cause, OMN-14139/OMN-14135).

Enforcement (CLAUDE.md Rule #5 — gate ships WITH the fixes):
- Guard A (parse-time): discovery._parse_handler_routing raises on a flat/
  malformed handlers[] entry instead of silently skipping it. Legacy top-level
  handler: fallback preserved (empty handlers list never raises).
- Guard B (wire-time): _commit_contract_wiring reports FAILED (not WIRED) and
  does NOT subscribe when a contract declares subscribe topics but registers
  zero dispatchers. Never fires on legacy fallbacks (>=1 dispatcher) or
  resolver-ownership/quarantine skips.
- CI gate + pre-commit hook: handler_routing_schema validator rejects flat
  entries across all node contracts (SYNC'd ci.yml step + pre-commit hook).

Contract fixes (7 infra contracts the gate would reject; ledger done in #2234):
node_savings_estimation_compute, node_build_loop_write_effect,
node_session_state_effect, node_pattern_lifecycle_effect, node_validation_executor,
node_decision_store_query_compute, node_baseline_comparison_compute.

Verified: 111/111 contracts discover with zero errors; Guard B fires on zero
real contracts; 354 auto-wiring/kernel tests + 11 new guard tests green.

Follow-up (separate PR): 3 omnimarket flat-schema contracts + omnimarket-side gate.
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ce24c119-bca0-4689-a2dc-dcdf4b2378a1

📥 Commits

Reviewing files that changed from the base of the PR and between 79c37ed and 6a10b51.

📒 Files selected for processing (14)
  • .github/workflows/ci.yml
  • .pre-commit-config.yaml
  • src/omnibase_infra/nodes/node_baseline_comparison_compute/contract.yaml
  • src/omnibase_infra/nodes/node_build_loop_write_effect/contract.yaml
  • src/omnibase_infra/nodes/node_decision_store_query_compute/contract.yaml
  • src/omnibase_infra/nodes/node_pattern_lifecycle_effect/contract.yaml
  • src/omnibase_infra/nodes/node_savings_estimation_compute/contract.yaml
  • src/omnibase_infra/nodes/node_session_state_effect/contract.yaml
  • src/omnibase_infra/nodes/node_validation_executor/contract.yaml
  • src/omnibase_infra/runtime/auto_wiring/discovery.py
  • src/omnibase_infra/runtime/auto_wiring/handler_wiring.py
  • src/omnibase_infra/validators/handler_routing_schema.py
  • tests/fixtures/dispatch_parity/baseline-selection-v2.json
  • tests/unit/runtime/auto_wiring/test_handler_routing_flat_schema_guard.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonah/omn-14141-fail-closed-guard-ci-gate-for-contract-handler_routing-flat

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

@jonahgabriel
jonahgabriel enabled auto-merge (squash) July 8, 2026 07:18
@jonahgabriel
jonahgabriel merged commit 340c539 into dev Jul 8, 2026
170 of 178 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/omn-14141-fail-closed-guard-ci-gate-for-contract-handler_routing-flat branch July 8, 2026 13:19
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