The outbox contract
An event is written in the same transaction as the rows it describes. That single rule buys the guarantee that matters: an event never describes a write that rolled back, and a write that committed never fails to produce its event. Publishing after the commit would make both possible, and both are the kind of bug that surfaces as “the counter is wrong sometimes”. After the commit, the API nudges the queue to drain the outbox. The nudge is best-effort: it buys latency. A periodic sweep is what actually guarantees the outbox drains, even when every nudge is lost.What is published today
Every event carries the organization it belongs to; customer-plane events carry the
environment too.