feat(auth): consolidate auth config in AuthSettings#57
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @olivermeyer's task in 3m 25s —— View job Code Review Complete ✅Comprehensive review of PR #57: feat(auth): consolidate auth config in AuthSettings Overall Assessment: Strong implementation with excellent test coverage (100%) and zero SonarQube issues. One blocking concern regarding breaking changes and migration risk. 🔴 Blocking Issues1. Breaking Change - Migration Risk Not AddressedLocation: Issue: This PR introduces a breaking change that could silently disable authentication in existing deployments: Before this PR:
After this PR:
Migration Impact:
Recommendation: Add migration documentation:
Example Migration Guide: # Required changes for existing deployments:
# 1. Rename env var
-MYAPP_AUTH_AUTH0_ROLE_CLAIM=https://example.com/role
+MYAPP_AUTH_ROLE_CLAIM=https://example.com/role
# 2. Add new required fields
+MYAPP_AUTH_ENABLED=true
+MYAPP_AUTH_SESSION_SECRET=<generate-secret>
+MYAPP_AUTH_SESSION_EXPIRATION=86400 # optional, has default
+MYAPP_AUTH_DOMAIN=example.auth0.com
+MYAPP_AUTH_CLIENT_ID=<client-id>
+MYAPP_AUTH_CLIENT_SECRET=<client-secret>💡 Suggestions (Non-Blocking)2. DRY Violation in Validator
|
|



Why?
Auth configuration was split between the
foundry-pythontemplate (seven fields under{APP}_AUTH0_*/{APP}_SESSION_*) and thefoundry-python-corelibrary (two required fields under{APP}_AUTH_*), making operator configuration inconsistent and error-prone.How?
All nine auth fields are moved into
AuthSettingsin the library under the uniform{APP}_AUTH_prefix, with empty-string defaults and a@model_validatorthat enforces cross-field dependencies (e.g.enabledrequiressession_enabled,client_secret, non-emptydomain, etc.) only when auth is actually enabled. The oldauth0_role_claimfield is renamed torole_claim, all internal references updated, and the README auth table expanded to document all nine fields.