Skip to content

fix(ui): honor model view scope - #39138

Open
lzhan011 wants to merge 4 commits into
BerriAI:litellm_internal_stagingfrom
lzhan011:litellm_fix_model_view_scope
Open

fix(ui): honor model view scope#39138
lzhan011 wants to merge 4 commits into
BerriAI:litellm_internal_stagingfrom
lzhan011:litellm_fix_model_view_scope

Conversation

@lzhan011

@lzhan011 lzhan011 commented Sep 1, 2026

Copy link
Copy Markdown

TLDR

Problem this solves:

  • All Available Models still used the selected team filter
  • Scope changes retained pagination from the previous dataset
  • The current UI lint budget exceeded its prefer-screen-queries limit

How it solves it:

  • Omit teamId when viewing all available models
  • Reset pagination whenever the view scope changes
  • Restore the selected team scope when switching back
  • Replace render-result queries in the models page tests with screen queries

User Flow

Before: an admin cannot reliably leave the selected team's model scope

  1. They open https://litellm-domain/ui/models-and-endpoints
  2. They select Team "Engineering" and go to page 2
  3. They select View "All Available Models"
  4. The model request still includes teamId=team-1 and page=2
  5. The table remains team-scoped or appears empty

After: the same view switch loads all available models from the first page

  1. They open https://litellm-domain/ui/models-and-endpoints
  2. They select Team "Engineering" and go to page 2
  3. They select View "All Available Models"
  4. The model request omits teamId and uses page=1
  5. The table shows all available models
  6. Switching back restores teamId=team-1 from page 1

Relevant issues

Discovered through a static query-state audit and the PR lint check

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • The focused component test files pass locally
  • The complete UI lint budget check passes locally
  • My PR passes all required CI/CD checks
  • My PR's changes are limited to the models-and-endpoints UI
  • I have received a Greptile Confidence Score of at least 4/5 on the latest head

Screenshots / Proof of Fix

Before (bad55da)

  1. Select Engineering in the team control and advance to page 2
  2. Select All Available Models in the view control
  3. The interaction regression receives teamId: "team-1" and page: 2
  4. The new test fails because the expected unscoped first-page query never occurs
  5. UI Lint reports testing-library/prefer-screen-queries: 21 | max: 18

After (e3ed5fd)

  1. Repeat the same team, pagination, and view selections
  2. The interaction regression receives teamId: undefined and page: 1
  3. Switch back to Current Team Models
  4. The next request receives teamId: "team-1" from page 1
  5. Both focused component files pass: 40 tests
  6. The full lint budget reports testing-library/prefer-screen-queries: 18 | max: 18

Type

Bug Fix

Caveats (if any)

CI baseline

Final Attestation

  • The tests cover scope changes from page 2 and the restore path
  • The complete lint budget check passes at its configured limits

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR corrects model query scoping and ensures scope changes begin on the first page.

  • Omits the selected team ID while viewing all available models and restores it for the current-team view.
  • Resets pagination whenever the model view changes.
  • Adds interaction coverage for switching from a team-scoped second page to the unscoped first page.
  • Updates page tests to use global screen queries.

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported pagination issue is fixed: changing model scope now resets pagination while the query derives the new page and team scope together, and no blocking failure remains.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/components/AllModelsTab.tsx The scope-dependent team query and pagination reset correctly address the previously reported stale-page behavior.
ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/components/AllModelsTab.test.tsx The added interaction test verifies that switching from team page two to all models requests the unscoped first page and restores the selected team afterward.
ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/page.test.tsx The test-query changes are a semantics-preserving cleanup from render-scoped queries to screen.

Reviews (3): Last reviewed commit: "test(ui): use screen queries in models p..." | Re-trigger Greptile

@lzhan011
lzhan011 requested a review from a team September 1, 2026 17:57
@lzhan011 lzhan011 changed the title fix(ui): make all available models ignore team filter fix(ui): honor model view scope and update browserslist Sep 1, 2026

lzhan011 commented Sep 1, 2026

Copy link
Copy Markdown
Author

@greptileai please re-review the pagination reset and patched browserslist lockfile at the latest head commit

@lzhan011
lzhan011 force-pushed the litellm_fix_model_view_scope branch from 250c919 to 67d6539 Compare September 1, 2026 22:09
@lzhan011 lzhan011 changed the title fix(ui): honor model view scope and update browserslist fix(ui): honor model view scope Sep 1, 2026
@lzhan011 lzhan011 changed the title fix(ui): honor model view scope fix: honor model view scope and update vulnerable dependencies Sep 1, 2026
@lzhan011
lzhan011 force-pushed the litellm_fix_model_view_scope branch from 9afb744 to 945f02f Compare September 1, 2026 22:12
@lzhan011 lzhan011 changed the title fix: honor model view scope and update vulnerable dependencies fix(ui): honor model view scope Sep 1, 2026
@codspeed-hq

codspeed-hq Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing lzhan011:litellm_fix_model_view_scope (9afb744) with litellm_internal_staging (8469003)

Open in CodSpeed

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

lzhan011 commented Sep 1, 2026

Copy link
Copy Markdown
Author

@greptileai please re-review the model scope fix and screen-query lint cleanup at the latest head commit

@lzhan011

lzhan011 commented Sep 2, 2026

Copy link
Copy Markdown
Author

OSV failure is tracked in #39217 and comes from unchanged staging locks; this PR only changes model scope UI code and tests

@lzhan011
lzhan011 force-pushed the litellm_fix_model_view_scope branch from e3ed5fd to 37e8a5c Compare September 2, 2026 19:47
The debounced refetch assertions leave no headroom against the 1s default
that @testing-library/react applies to waitFor/findBy*, which flaked on CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant