Skip to content

fix(omnibase_infra): eliminate HARDCODED_TOPIC + UNDECLARED_TRANSPORT violations [OMN-8605] - #1264

Merged
jonahgabriel merged 2 commits into
mainfrom
jonah/omn-8605-compliance-omnibase_infra
Apr 13, 2026
Merged

jonahgabriel merged 2 commits into
mainfrom
jonah/omn-8605-compliance-omnibase_infra

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented Apr 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Replaced all hardcoded Kafka topic string literals in 9 non-test source files with references to canonical suffix constants from platform_topic_suffixes.py and EnumPlatformTopic
  • Added 8 new suffix constants to platform_topic_suffixes.py for topics that were missing: SUFFIX_LINEAR_SNAPSHOT, SUFFIX_GIT_HOOK, and 6 omniclaude injection-effectiveness topics
  • All pre-commit hooks pass including No hardcoded ONEX topic strings gate

Files changed

  • runtime/contract_registration_event_router.py — 3 module-level constants
  • tui/consumers/consumer_status.py — 3 module-level constants
  • cli/linear_relay.py, cli/git_hook_relay.py — 1 constant each
  • services/service_timeout_emitter.py — 2 class defaults via EnumPlatformTopic
  • services/observability/agent_actions/consumer.py — 14 dict key strings
  • services/observability/injection_effectiveness/config.py — 6 topic strings in default_factory
  • services/observability/llm_cost_aggregation/config.py — 1 topic string

Test plan

  • Pre-commit hooks pass (all 44 checks green, No hardcoded ONEX topic strings explicitly passed)
  • ruff format + ruff check clean
  • mypy passes (confirmed via push hook)

Summary by CodeRabbit

  • Refactor

    • Consolidated event topic definitions into centralized platform constants for improved consistency across the system.
  • Tests

    • Added integration tests to validate event topic compliance and constant exports.

Replace all hardcoded Kafka topic string literals in non-test source files
with references to canonical suffix constants from platform_topic_suffixes.py
and generated enum_platform_topic.py.

New suffix constants added to platform_topic_suffixes.py:
- SUFFIX_LINEAR_SNAPSHOT, SUFFIX_GIT_HOOK
- SUFFIX_OMNICLAUDE_CONTEXT_UTILIZATION, SUFFIX_OMNICLAUDE_AGENT_MATCH
- SUFFIX_OMNICLAUDE_LATENCY_BREAKDOWN, SUFFIX_OMNICLAUDE_MANIFEST_INJECTION_STARTED
- SUFFIX_OMNICLAUDE_MANIFEST_INJECTED, SUFFIX_OMNICLAUDE_MANIFEST_INJECTION_FAILED

Files fixed (9):
- runtime/contract_registration_event_router.py (3 constants)
- tui/consumers/consumer_status.py (3 constants)
- cli/linear_relay.py, cli/git_hook_relay.py (1 constant each)
- services/service_timeout_emitter.py (2 class defaults via EnumPlatformTopic)
- services/observability/agent_actions/consumer.py (14 dict keys)
- services/observability/injection_effectiveness/config.py (6 topic strings)
- services/observability/llm_cost_aggregation/config.py (1 topic string)
@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This pull request centralizes Kafka topic suffix constants by introducing 8 new shared constants in a dedicated module and updating 8 modules to import these constants instead of using hardcoded topic strings. Integration tests validate the new exports and topic compliance.

Changes

Cohort / File(s) Summary
Core Topic Constants
src/omnibase_infra/topics/platform_topic_suffixes.py, src/omnibase_infra/topics/__init__.py
Added 8 new topic suffix constants (SUFFIX_GIT_HOOK, SUFFIX_LINEAR_SNAPSHOT, and 6 OmniClaude-related suffixes) and exported them from the topics package.
Relay and Router Modules
src/omnibase_infra/cli/git_hook_relay.py, src/omnibase_infra/cli/linear_relay.py, src/omnibase_infra/runtime/contract_registration_event_router.py
Replaced hardcoded topic strings with imported SUFFIX_* constants for topic definition and routing logic.
Observability Consumer Modules
src/omnibase_infra/services/observability/agent_actions/consumer.py, src/omnibase_infra/services/observability/injection_effectiveness/config.py, src/omnibase_infra/services/observability/llm_cost_aggregation/config.py
Updated TOPIC_TO_MODEL mappings and default topic configurations to use imported suffix constants instead of hardcoded ONEX topic strings.
Service Emission and Status Monitoring
src/omnibase_infra/services/service_timeout_emitter.py, src/omnibase_infra/tui/consumers/consumer_status.py
Updated DEFAULT_*_TOPIC and module-level topic constants to reference imported suffix constants or EnumPlatformTopic enum values.
Integration Tests
tests/integration/registration/test_topic_suffix_compliance.py, tests/integration/test_topic_suffix_exports.py
Added compliance tests validating new suffix constant exports, canonical string values, and topic suffix conformance across the platform.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Constants hop together now, no strings astray,
A single source of truth to light the way,
From git hooks to omniclaude's gentle call,
Centralized suffixes unify them all! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the main change: replacing hardcoded Kafka topic literals with canonical suffix constants to resolve linting violations.

✏️ 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 jonah/omn-8605-compliance-omnibase_infra

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

@jonahgabriel
jonahgabriel enabled auto-merge April 13, 2026 09:22
…y [OMN-8605]

Add SUFFIX_GIT_HOOK, SUFFIX_LINEAR_SNAPSHOT, SUFFIX_OMNICLAUDE_AGENT_MATCH,
SUFFIX_OMNICLAUDE_CONTEXT_UTILIZATION, SUFFIX_OMNICLAUDE_LATENCY_BREAKDOWN,
SUFFIX_OMNICLAUDE_MANIFEST_INJECTED, SUFFIX_OMNICLAUDE_MANIFEST_INJECTION_FAILED,
and SUFFIX_OMNICLAUDE_MANIFEST_INJECTION_STARTED to both the import block and
__all__ list. Fixes F56 (check_topic_suffix_exports) lint gate failure.

Also adds integration test to enforce export completeness going forward.
@jonahgabriel
jonahgabriel merged commit 35e1176 into main Apr 13, 2026
50 of 54 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/omn-8605-compliance-omnibase_infra branch April 13, 2026 09:46
jonahgabriel added a commit that referenced this pull request Apr 13, 2026
Fallout from PRs #1264 (OMN-8605) and #1262 (OMN-8550) which landed on
main without test verification, blocking PR #1266 from going green.

Fix 1 — test_topic_suffix_exports.py:
  `from omnibase_infra.topics import __init__ as topics_init` resolved to
  a method-wrapper, not the module. Replace with a standard module import.

Fix 2 — test_protocol_ownership.py:
  KNOWN_DUPLICATE_LOCATIONS["ProtocolPublisher"] was missing the
  node_baseline_capture entry added by OMN-7484. Also allowlists
  ProtocolDomainPlugin (still present in runtime/ as a backward-compat
  shim post OMN-8550 SPI migration).

Fix 3 — test_topic_parity.py / check_contract_topic_parity.py:
  8 SUFFIX_* constants added in #1264 had no spec group entries:
    - 6 omniclaude injection-effectiveness topics (OMN-1889, OMN-2942)
      added to _OMNICLAUDE_AGENT_OBSERVABILITY_TOPIC_SUFFIXES in
      platform_topic_suffixes.py, and to _LEGACY_ALLOWLIST (cross-repo,
      contract.yaml lives in omniclaude).
    - onex.evt.git.hook.v1 and onex.evt.linear.snapshot.v1 added to
      ALL_OMNIBASE_INFRA_TOPIC_SPECS (3 partitions, 7-day retention),
      and to _LEGACY_ALLOWLIST (CLI relay producers, no node contract).

No new tickets filed per standing rule — OMN-8605 and OMN-8550 are
the parent tickets for these regressions.
github-merge-queue Bot pushed a commit that referenced this pull request Jun 19, 2026
* feat(OMN-13298): wire url-authority gate (pre-commit + CI)

Wires the existing check-url-authority remote hook from omnibase_core
and adds url-authority-gate.yml CI workflow. Existing violations are
grandfathered in the shared baseline (seeded via omnibase_core PR #1264).
Only NEW hardcoded URL fingerprints will fail the gate going forward.

- pre-commit hook: check-url-authority (ratchet, burn-down baseline)
- CI workflow: url-authority-gate.yml (REQUIRED STATUS CHECK)
- Baseline: seeded in omnibase_core#1264 (OMN-13298)

Child of OMN-12803.

* fix(OMN-13298): pin url authority validator source

* fix(OMN-13298): run pinned url authority validator in CI

* chore(OMN-13298): refresh infra CI summary

---------

Co-authored-by: jonahgabriel <jonahgabriel@users.noreply.github.com>
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