#248 — Provide visibility into tenants origins
Repo: Twill-AI/facade State: closed | Status: done Assignee: Unassigned
Created: 2024-12-19 · Updated: 2025-09-15
Description
Intent.
We often have issues with understanding tenants. GET /api/v1/master/tenants doesn’t show user email to identify tenant origin (need to use Supabase UI because even GET /api/v1/master/profiles/list doesn’t provide email - it is loaded only lazily and if user logged into tenant). Also Facade and BD has different tenants sets.
We can’t distinguish real tenants in Prod because of it.
Ideas:
- Force load emails of tenant’s owners on service startup and provide in “master” API’s. Cons: longer start-up.
- Persist users in “master” persistence. Cons: duplication of Supabase’s persistence which need to synchronize.
Acceptance criteria:
- Facade’s API provides information about tenant’s origins (not users, tenants!).
- New PostHog event is sent on a very app start up (with version at least).
- PostHog event is sent on tenant creation and deletion (better out of transaction bounds).
- There is PostHog dashboard to see real-time (1 hour tolerance is OK) Facade’s and BD tenants information on all environments. - https://us.posthog.com/project/112605/dashboard/287292
Implementation details
It turned out that loading information of all tenant owners during startup may be very long. Because Supabase uses “gotrue” client under the hood and it a) is not async, b) doesn’t provide ability to get only specific set of users in bulk, only by pages. Therefore with using Supabase Python
Notes
Add implementation notes, blockers, and context here
Related
Add wikilinks to related people, meetings, or other tickets