Summary
Currently, the core modules appear to be tightly coupled when handling state changes and cross-module communication. Implementing a robust Event-Driven Architecture (using an EventEmitter or Pub-Sub pattern) will decouple these services and improve the scalability and maintainability of the codebase.
Motivation
Tightly coupled services make unit testing difficult and increase the risk of regressions when modifying core flows. By introducing an event bus, we can allow different components to react to state changes asynchronously.
Acceptance Criteria
How to Test
- Run the unit test suite to ensure the event bus routes messages correctly.
- Verify that the refactored workflow behaves functionally identically to the old direct-invocation approach.
Assignment Request (L3/Core Feature)
I would like to be assigned to this issue. Below is my proposed implementation plan:
Step-by-Step Implementation Plan:
- Design Event Bus: Create a centralized EventBus class.
- Define Event Contracts: Define strict types/interfaces for the event payloads to ensure type safety across the application.
- Refactor Core Service: Identify a core service currently using direct dependencies, and replace the direct call with an EventBus.emit() and corresponding .on() listener.
- Testing: Write unit tests for the EventBus, verifying single, multiple, and wildcard event listeners.
Could you also please add the ECSoC26 label?
Summary
Currently, the core modules appear to be tightly coupled when handling state changes and cross-module communication. Implementing a robust Event-Driven Architecture (using an EventEmitter or Pub-Sub pattern) will decouple these services and improve the scalability and maintainability of the codebase.
Motivation
Tightly coupled services make unit testing difficult and increase the risk of regressions when modifying core flows. By introducing an event bus, we can allow different components to react to state changes asynchronously.
Acceptance Criteria
How to Test
Assignment Request (L3/Core Feature)
I would like to be assigned to this issue. Below is my proposed implementation plan:
Step-by-Step Implementation Plan:
Could you also please add the ECSoC26 label?