Tenant isolation belongs in the access layer
Why every query for events must carry a tenant ID — and why that is not left to whoever writes a rule.
A multi-tenant CRM keeps many client companies in one system, and so does the analysis behind it. The events of one tenant must never show up in the rules, reports or portal of another — not by design, and not by mistake.
The usual way to get this wrong is to make isolation a habit: every rule author remembers to add the tenant filter. It works until one rule, written in a hurry, forgets — and the mistake stays invisible until someone sees data that is not theirs.
So isolation sits one level lower. Every query for events must carry a tenant ID, and the access layer refuses one that does not. A rule cannot forget the filter, because without it the rule gets nothing at all.
The same thinking separates the parts of the system: the part that sees request bodies has no database access, and the part with database access never sees bodies. Compromising one gives no full picture.