feat(events): add EventBus protocol and ReactiveEventBus implementation #473

Closed
opened 2026-02-28 02:22:11 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit Message: feat(events): add EventBus protocol and ReactiveEventBus implementation
  • Branch: feature/m6plus-event-bus

Background

The specification (Section 18: Event-Driven Architecture) defines a DomainEvent base model, an EventBus Protocol interface, and a ReactiveEventBus implementation using RxPY for in-process real-time distribution. All significant state changes should emit domain events through this bus. Currently, only the ACP-scoped AcpEventQueue exists, but there is no general-purpose domain event bus.

This is distinct from the ACP event system — the EventBus is for internal domain events (plan state changes, decision recordings, resource modifications, etc.) and powers observability, audit logging, and future webhook/notification systems.

Acceptance Criteria

  • DomainEvent base model with event_type, timestamp, correlation_id, payload fields
  • EventBus Protocol with emit() and subscribe() methods
  • ReactiveEventBus implementation using RxPY reactive streams
  • LoggingEventBus implementation that writes events to structured logging
  • Domain services wired to emit events on significant state changes
  • DI registration as Singleton provider

Definition of Done

EventBus is registered in the DI container, domain services emit events, and events flow to both reactive subscribers and structured logs.

Subtasks

  • Code: Implement DomainEvent, EventBus, ReactiveEventBus, LoggingEventBus in src/cleveragents/infrastructure/events/
  • Docs: Add event bus reference documentation to docs/reference/event_bus.md
  • Tests-Behave: BDD scenarios for event emission, subscription, and filtering
  • Tests-Robot: Integration tests for end-to-end event flow through plan lifecycle
  • Tests-ASV: Benchmarks for event emission throughput and subscriber fan-out
  • Quality-coverage: Maintain >=97% coverage
  • Quality-nox: All nox sessions pass
## Metadata - **Commit Message**: feat(events): add EventBus protocol and ReactiveEventBus implementation - **Branch**: feature/m6plus-event-bus ## Background The specification (Section 18: Event-Driven Architecture) defines a `DomainEvent` base model, an `EventBus` Protocol interface, and a `ReactiveEventBus` implementation using RxPY for in-process real-time distribution. All significant state changes should emit domain events through this bus. Currently, only the ACP-scoped `AcpEventQueue` exists, but there is no general-purpose domain event bus. This is distinct from the ACP event system — the `EventBus` is for internal domain events (plan state changes, decision recordings, resource modifications, etc.) and powers observability, audit logging, and future webhook/notification systems. ## Acceptance Criteria - [ ] `DomainEvent` base model with `event_type`, `timestamp`, `correlation_id`, `payload` fields - [ ] `EventBus` Protocol with `emit()` and `subscribe()` methods - [ ] `ReactiveEventBus` implementation using RxPY reactive streams - [ ] `LoggingEventBus` implementation that writes events to structured logging - [ ] Domain services wired to emit events on significant state changes - [ ] DI registration as Singleton provider ## Definition of Done EventBus is registered in the DI container, domain services emit events, and events flow to both reactive subscribers and structured logs. ## Subtasks - [ ] **Code**: Implement `DomainEvent`, `EventBus`, `ReactiveEventBus`, `LoggingEventBus` in `src/cleveragents/infrastructure/events/` - [ ] **Docs**: Add event bus reference documentation to `docs/reference/event_bus.md` - [ ] **Tests-Behave**: BDD scenarios for event emission, subscription, and filtering - [ ] **Tests-Robot**: Integration tests for end-to-end event flow through plan lifecycle - [ ] **Tests-ASV**: Benchmarks for event emission throughput and subscriber fan-out - [ ] **Quality-coverage**: Maintain >=97% coverage - [ ] **Quality-nox**: All nox sessions pass
freemo added this to the v3.6.0 milestone 2026-02-28 02:22:19 +00:00
aditya self-assigned this 2026-03-02 09:13:19 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#473
No description provided.