@tdd_issue @tdd_issue_10377
Feature: TDD Issue #10377 — ReactiveEventBus missing close() method causes RxPY subscriber resource leaks
  As a developer using ReactiveEventBus with RxPY operators
  I want the bus to provide a close() method that completes the RxPY Subject
  So that buffering and aggregation operators can finalize their state without leaking resources

  This test suite captures bug #10378 / TDD issue #10377.
  The tests verify that ReactiveEventBus.close() completes the RxPY stream,
  that emit() raises RuntimeError after close(), and that the bus supports
  the context manager protocol for automatic cleanup.

  See CONTRIBUTING.md > Bug Fix Workflow > TDD Issue Test Tags.

  @tdd_issue @tdd_issue_10377
  Scenario: ReactiveEventBus.close() completes the RxPY stream
    Given a ReactiveEventBus instance for close testing
    And a subscriber collecting completion signal from bus stream
    When bus.close() is called
    Then the subscriber should have received the on_completed signal

  @tdd_issue @tdd_issue_10377
  Scenario: ReactiveEventBus.close() prevents further emit() calls
    Given a ReactiveEventBus instance for close testing
    When bus.close() is called
    And an event is emitted after close
    Then a RuntimeError should be raised

  @tdd_issue @tdd_issue_10377
  Scenario: ReactiveEventBus implements context manager protocol
    Given a ReactiveEventBus instance used as a context manager
    When the context manager exits
    Then bus.close() should have been called automatically
    And the RxPY stream should be completed

  @tdd_issue @tdd_issue_10377
  Scenario: ReactiveEventBus.close() is idempotent
    Given a ReactiveEventBus instance for close testing
    When bus.close() is called twice
    Then no exception should be raised on the second close call
