Skip to content

[Feature] Export Mailbox, Envelope and MailboxFactory — the documented mailbox escape hatch is unreachable #661

Description

@pathosDev

Problem

src/util/Constants.ts:78-83 tells users "Opt out per-actor via Props.withMailbox(() => new Mailbox())" — but Mailbox lives in src/internal/Mailbox.ts and is not re-exported: src/mailbox/index.ts exports only BoundedMailbox/PriorityMailbox, and the root barrel mirrors that (src/index.ts:697-712). A custom mailbox author also needs Envelope (unexported) and MailboxFactory (declared at src/Props.ts:7; the barrel exports ActorFactory and PropsConfig but not it, src/index.ts:66-67). The documented escape hatch is unreachable.

Same file: Props.withMailboxCapacity is silently ignored whenever withMailbox is set — src/internal/ActorCell.ts:154-165 only reads mailboxCapacity in the else branch.

Proposed behaviour

Re-export Mailbox, Envelope, MailboxFactory. Make withMailbox + withMailboxCapacity either compose or throw at Props construction.

Acceptance criteria

  • The snippet in Constants.ts compiles against the published barrel.
  • A test asserts the conflicting-Props error (or the composed behaviour).

Related: #414, #556

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: mediumUseful, not urgentproduction-goalBlocks or defines the path to production readiness

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions