Add _closed flag and close() method to ReactiveEventBus to complete the
RxPY Subject, preventing subscriber resource leaks. close() is idempotent
and raises RuntimeError when called on a closed bus.
Also adds:
- emit() guard against post-close calls (RuntimeError)
- __enter__/__exit__ context manager protocol for automatic cleanup
- BDD scenarios in event_bus.feature and TDD tests in
tdd_reactive_event_bus_close.feature
ISSUES CLOSED: #10378
- Update event_bus_steps.py to call record_decision() with individual
parameters (plan_id, decision_type, question, chosen_option, rationale)
instead of passing a Decision object, matching the master branch API
- Remove ctx.test_decision construction from DecisionService setup steps
as it is no longer needed with the new signature
- Update robot/helper_event_bus.py decision_service_emits_event() to use
the new record_decision() parameter signature
- All 9 Robot Framework event bus tests passing
- Behave scenarios at lines 125 and 131 now passing
Fixes event bus test failures after master merge.
- Fix CHANGELOG EventType count from 40 to 38 and add missing domains
(invariant, context) for accurate documentation
- Document correlation_id field as spec extension for request traceability
in DomainEvent model
- Add thread safety documentation to ReactiveEventBus and LoggingEventBus
noting single-threaded design and external sync requirements
- Document _persist_audit deferral in ReactiveEventBus.emit() explaining
audit logging via handler subscription or LoggingEventBus following
single-responsibility principle
- Replace bare MagicMock() with create_autospec(Settings, instance=True)
at 5 locations for type-safe test mocking
- Replace nested bare MagicMock for UnitOfWork with create_autospec at 3
locations to prevent silent breakage on API changes
All changes maintain backward compatibility. No linter errors.