fix: align DefaultInternalUserParams Pydantic default with runtime fallback #23666
Conversation
…llback The Pydantic default for user_role was INTERNAL_USER, but all runtime provisioning paths (SSO, SCIM, JWT) fall back to INTERNAL_USER_VIEW_ONLY when no settings are saved. This caused the UI to show "Internal User" on fresh instances while new users actually got "Internal Viewer".
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes a mismatch between the Pydantic default value of Key changes:
Concern: The Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/_types.py | Single-line change: default for DefaultInternalUserParams.user_role changed from INTERNAL_USER to INTERNAL_USER_VIEW_ONLY to align the Pydantic default with the runtime fallback used in SSO/SCIM/JWT provisioning paths. |
| tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.py | New integration test test_get_internal_user_settings_fresh_db_defaults_to_viewer added to verify the fresh-DB (no config) scenario returns INTERNAL_USER_VIEW_ONLY from the GET endpoint — directly covering the scenario fixed by this PR. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[New User Created] --> B{How?}
B -->|SSO / SCIM / JWT| C[Runtime fallback logic]
B -->|/user/new API| D[DefaultInternalUserParams default]
B -->|UI GET /get/internal_user_settings| E[DefaultInternalUserParams default]
C --> F{Config saved?}
F -->|Yes| G[Use saved user_role]
F -->|No| H[INTERNAL_USER_VIEW_ONLY]
D --> I{Config saved?}
I -->|Yes| J[Use saved user_role]
I -->|No| K["BEFORE: INTERNAL_USER (was wrong)\nAFTER: INTERNAL_USER_VIEW_ONLY (now aligned)"]
E --> L{Config saved?}
L -->|Yes| M[Return saved user_role]
L -->|No| N["BEFORE: INTERNAL_USER (displayed wrong)\nAFTER: INTERNAL_USER_VIEW_ONLY (now correct)"]
style K fill:#f9a,stroke:#f00
style N fill:#afa,stroke:#0a0
Last reviewed commit: c95783e
Asserts that GET /get/internal_user_settings returns INTERNAL_USER_VIEW_ONLY on a fresh DB with no saved settings, matching the runtime fallback in SSO/SCIM/JWT provisioning.
tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.py
Show resolved
Hide resolved
…endpoints.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Type
🐛 Bug Fix
Changes
The Pydantic default for user_role was INTERNAL_USER, but all runtime provisioning paths (SSO, SCIM, JWT) fall back to INTERNAL_USER_VIEW_ONLY when no settings are saved. This caused the UI to show "Internal User" on fresh instances while new users actually got "Internal Viewer".
Changed the default to be INTERNAL_USER_VIEW_ONLY to match what we have and be consistent.