Files
openhuman/.github
a36535330b feat: add typed event bus for cross-module decoupling (#374)
* Add event bus integration to channels module

- Introduced an `event_bus` module to facilitate event-driven communication within the channels.
- Updated `ChannelRuntimeContext` to include an `event_bus` field for managing events.
- Enhanced the `start_channels` function to initialize the global event bus and register a tracing subscriber for logging domain events.
- Modified the cron scheduler to publish delivery requests as events, decoupling the delivery logic from specific channel implementations.
- Updated tests to ensure proper initialization and usage of the event bus across various contexts.

This change improves the modularity and scalability of the channels system by leveraging an event-driven architecture.

* refactor: move CronDeliverySubscriber to cron/bus.rs

Each domain owns its event bus handlers — move the delivery subscriber
from channels/cron_delivery.rs into cron/bus.rs so the cron module
contains both its publisher and subscriber logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: update Dockerfile to install system dependencies and refactor event bus logging

- Added installation of system dependencies (cmake, ALSA, X11) in the Dockerfile to support build requirements.
- Refactored event bus logging in various files for improved readability by consolidating multi-line log statements into single lines.

* chore: update Dockerfile to include webkit2gtk-driver installation

- Added installation of webkit2gtk-driver in the Dockerfile to support additional system dependencies.
- Removed redundant apt-get update command to streamline the installation process.

* docs: add event bus usage guide to CLAUDE.md

Documents the event bus pattern, core types, global access, and the
convention for adding domain events and subscribers so future modules
follow the established design.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: update Dockerfile to streamline Node.js installation

- Removed redundant cleanup command after installing yarn in the Dockerfile, simplifying the installation process.

* chore: update Dockerfile to fix yarn installation command

- Removed unnecessary trailing whitespace in the yarn installation command in the Dockerfile, ensuring cleaner code and consistency.

* chore: consolidate system dependencies installation in Dockerfile

- Merged the installation of webkit2gtk-driver with other system dependencies in the Dockerfile to streamline the setup process and reduce the number of RUN commands.

* refactor: enforce EventBus as a singleton

- Make EventBus::create() pub(crate) — only tests can construct isolated
  instances; production code must use the global singleton
- Add subscribe_global() convenience for subscribing from any module
- Remove event_bus field from ChannelRuntimeContext — all modules use
  init_global/publish_global/subscribe_global instead of passing instances
- Update CLAUDE.md to document the singleton API as the only way to use
  the event bus

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address PR review — panic safety, init_global, Dockerfiles, tests

- Wrap handler.handle() in catch_unwind so a panicking subscriber does
  not silently kill its task — logs the panic and continues the loop
- Call init_global() in cron scheduler::run() so delivery events are not
  silently dropped when the scheduler starts before start_channels()
- Export DEFAULT_CAPACITY and use it everywhere instead of hard-coded 256
- Add ALSA/X11/input dev libraries to e2e/Dockerfile to mirror CI runner
- Remove duplicate cmake install from .github/Dockerfile
- Add 4 unit tests for CronDeliverySubscriber (ignore non-delivery,
  dispatch to channel, missing channel, send failure)
- Replace scheduler announce-mode test with one that verifies event
  payload is actually received by a subscriber

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 14:16:27 -07:00
..