Add Supabase tenant extension#267
Conversation
nicoloboschi
left a comment
There was a problem hiding this comment.
Hey! Thanks for this contribution! we need to make this part of the api package otherwise users will not abble to use without modifying the package/docker image
3adb345 to
703c9ea
Compare
|
Thanks for the feedback @nicoloboschi! I've updated the PR to address this: Moved to built-in package: The extension now lives at HINDSIGHT_API_TENANT_EXTENSION=hindsight_api.extensions.builtin.supabase_tenant:SupabaseTenantExtension
HINDSIGHT_API_TENANT_SUPABASE_URL=https://your-project.supabase.coOther changes in this update:
The old |
703c9ea to
1124533
Compare
|
hey @jerryhenley can you rebase and resolve conflicts? after that I will merge the PR |
Move the Supabase tenant extension into the hindsight-api package so users can enable it with just an environment variable — no file copying or Docker image modifications needed. Key improvements over the original submission: - JWKS-based local JWT verification (no network call per request) with automatic fallback to /auth/v1/user for legacy HS256 projects - Service key is now optional (only needed for HS256 or health checks) - UUID validation on user IDs before schema name construction - Schema prefix validation against Postgres identifier rules - Key rotation handling with automatic JWKS cache refresh - Proper logging via Python logging module - Tenant extension lifecycle hooks (on_startup/on_shutdown) wired into the server lifespan - Public tenant_extension property on MemoryEngine - 54 unit tests covering both verification modes, cache behavior, error paths, and the extension loader - README updated to reflect JWKS-first architecture Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1124533 to
4d8e9ed
Compare
|
Rebased onto latest main, conflicts resolved, all tests passing. |
Adds a TenantExtension for validating Supabase JWTs and providing multi-tenant memory isolation. Each authenticated user gets their own PostgreSQL schema.
Features:
Includes complete documentation with installation, usage examples, and troubleshooting guide.