-
Notifications
You must be signed in to change notification settings - Fork 429
Remove legacy tenancy config #802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
😱 Found 1 issue. Time to roll up your sleeves! 😱 🗒️ View all ignored comments in this repo
Need help? Join our Discord for support! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR represents a comprehensive refactoring to remove legacy tenancy configuration patterns throughout the Stack Auth codebase. The changes migrate from a dual configuration system (with both config
and completeConfig
properties) to a unified, hierarchical configuration structure.
The key architectural changes include:
-
Configuration Structure Modernization: The PR eliminates the legacy
completeConfig
property from tenancy objects and consolidates all configuration access through theconfig
property, which now directly contains the rendered organization configuration. -
Hierarchical Configuration Schema: The flat configuration structure has been replaced with a nested organization where related settings are grouped logically:
- Authentication settings moved from
credential_enabled
,sign_up_enabled
,passkey_enabled
toauth.password.allowSignIn
,auth.allowSignUp
,auth.passkey.allowSignIn
- Domain configuration restructured from flat arrays to
domains.trustedDomains
objects withbaseUrl
andhandlerPath
properties - OAuth providers reorganized from arrays to keyed objects under
auth.oauth.providers
- Email configuration moved from
email_config.type
toemails.server.isShared
- Authentication settings moved from
-
API Simplification: Functions like
validateRedirectUrl
have been updated to accept entire tenancy objects instead of individual configuration parameters, centralizing configuration access logic and reducing parameter coupling. -
Transformation Layer: The
renderedOrganizationConfigToProjectCrud
function is now used to transform the new organization config format into the expected project CRUD interface format for API responses, maintaining backward compatibility while supporting the new internal structure. -
New Environment Config CRUD: A new environment configuration management system has been introduced with proper CRUD operations, supporting the transition from legacy tenancy-based configuration to environment-level configuration management.
The changes affect authentication flows (password, OTP, passkey, OAuth), email systems, domain validation, API key management, team creation, user management, and various internal configuration endpoints. All modifications maintain functional equivalence while adopting the cleaner, more maintainable configuration architecture.
Confidence score: 3/5
• This PR has significant architectural changes that could introduce subtle bugs if configuration transformations are incorrect
• The migration from legacy to new config structure requires careful validation to ensure all property mappings are accurate
• Files like apps/backend/src/app/api/latest/auth/otp/send-sign-in-code/route.tsx
have inconsistent error messaging and several files use generic yupMixed()
validation that lacks type safety
46 files reviewed, 6 comments
apps/backend/src/app/api/latest/auth/otp/send-sign-in-code/route.tsx
Outdated
Show resolved
Hide resolved
apps/backend/src/app/api/latest/internal/environment-config/current/crud.tsx
Outdated
Show resolved
Hide resolved
apps/backend/src/app/api/latest/integrations/neon/oauth-providers/crud.tsx
Outdated
Show resolved
Hide resolved
…ers/crud.tsx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…te.tsx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Important
Refactor codebase to remove legacy tenancy configuration, updating domain, OAuth, email, and permission handling to use new config structure.
tenancy.config
instead oftenancy.completeConfig
in multiple files for domains, OAuth providers, and email configurations.validateRedirectUrl()
to usetenancy.config.domains.trustedDomains
.getProvider()
to handleprovider.isShared
andprovider.type
.crud.tsx
files for custom and neon integrations to usetrustedDomains
.crud.tsx
files to use new config structure.getProviderConfig()
and related functions to accommodate new config.tenancy.config.emails
.tenancy.config.rbac.permissions
.send-sign-in-code.test.ts
to reflect changes in OTP sign-in logic.prisma-client.tsx
to align with new tenancy config.This description was created by
for bc069b0. You can customize this summary. It will automatically update as commits are pushed.