Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

docs(tests): stop naming the tenant guard this phase removed (CHOO-2723)

Wojciech Wojtyniakd66269a825de
diff --git a/core/tests/switch_core/db/test_tenant_exemption_allowlist.py b/core/tests/switch_core/db/test_tenant_exemption_allowlist.py
index 44b599076..64c129911 100644
--- a/core/tests/switch_core/db/test_tenant_exemption_allowlist.py
+++ b/core/tests/switch_core/db/test_tenant_exemption_allowlist.py
@@ -20,8 +20,10 @@ Short in both directions. A module reaches the exemption if it *can* call a
lookup, not if it happens to; a helper on an injected store, reachable by
anything that declares the store, put one module on this list and the
exemption within reach of every endpoint behind it. That is why
-`get_sole_tenant_id` lives in `gateway/auth.py` as a function rather than on a
-`TenantMemberStore`: the one caller it ever had is the one module named here.
+`_resolve_tenant_id` and `list_tenant_memberships` live in `gateway/auth.py`
+as functions rather than on a `TenantMemberStore`: whatever calls them —
+`gateway/tenants.py` included — reaches the exemption through this one
+module, never directly through a store any endpoint could declare for itself.
**A raw `session_factory()` call** is the other surface. It inherits whatever
is ambient, which in background code is nothing at all, since the long-lived
diff --git a/core/tests/switch_core/test_seed_admin_membership.py b/core/tests/switch_core/test_seed_admin_membership.py
index 1803acc82..d71f0adaa 100644
--- a/core/tests/switch_core/test_seed_admin_membership.py
+++ b/core/tests/switch_core/test_seed_admin_membership.py
@@ -202,13 +202,13 @@ class TestWhatBeingStrandedCosts:
def test_there_is_one_way_to_write_a_membership() -> None:
"""`UserStore.ensure_membership` is it, and nothing else writes one.
- "Exactly one membership per account" holds because a single idempotent
- function writes them all. There was a `TenantMemberStore.create` beside
- it, taking `tenant_id`, `user_id` and `role` from whatever the caller
- felt like; nothing ever called it, and an unguarded second way in is how
- an account ends up with two — which `sole_tenant_id` rejects just as
- firmly as it rejects none. The store is gone, so this asserts the
- property rather than the absence: only `UserStore` constructs a
+ Every membership traces back to a single idempotent function rather than
+ to every writer remembering to check first. There was a
+ `TenantMemberStore.create` beside it, taking `tenant_id`, `user_id` and
+ `role` from whatever the caller felt like; nothing ever called it, and an
+ unguarded second way in is how an account ends up with a membership
+ nothing else wrote or accounted for. The store is gone, so this asserts
+ the property rather than the absence: only `UserStore` constructs a
`TenantMember`.
"""
package = pathlib.Path(switch_core.__file__).resolve().parent