Skip to content

arch: stop exporting makeEventBus from public @vibest/server/events #272

Description

@cursor

Problem

Architecture requires a single EventBusLayer reference because Effect memoizes layers by reference; a second bus silently drops events.

Production wiring in runtime.ts is correct, but @vibest/server/events publicly exports makeEventBus, and unit tests already construct standalone buses via makeEventBus() instead of sharing EventBusLayer. New code could repeat that in production layers.

Severity

P3

Affected files

  • packages/server/src/events/index.ts
  • packages/server/src/events/event-bus.ts
  • Correct production pattern: packages/server/src/rpc/runtime.ts
  • Test footgun examples: packages/server/test/harness/session-manager.test.ts, session-service.test.ts

Suggested fix

Stop exporting makeEventBus from the public @vibest/server/events entry; keep it module-private to event-bus.ts. Tests that need an isolated bus can import from the internal path or use Layer.build(EventBusLayer) as turn-log.test.ts already does.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions