feat(ui): migrate the Playground page to App Router path routing - #29963
feat(ui): migrate the Playground page to App Router path routing#29963ryan-crabbe-berri wants to merge 5 commits into
Conversation
Add llm-playground -> playground to MIGRATED_PAGES and remove the page's arm from the legacy switch in page.tsx. The playground route already sources all its data from useAuthorized and fetches its own proxy settings, so this is a pure cutover with no prop or state changes. Visiting /ui/?page=llm-playground now redirects to /ui/playground, the sidebar links to and highlights it, and navigating away returns to the legacy switch. Cover the new mapping with a reverse-lookup test so the sidebar highlight is pinned.
Greptile SummaryThis PR completes the second page in the strangler-fig App Router migration by cutting the Playground page over to path-based routing. The change is deliberately minimal: one entry added to
Confidence Score: 5/5The change is a one-line addition to a registry object and a removal of a now-redundant switch arm; the redirect plumbing that makes the cutover safe was already in place from the previous wave. All three modified files are small and well-understood. The redirect-before-render guard in No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/utils/migratedPages.ts | One-line addition of "llm-playground": "playground" to MIGRATED_PAGES; correctly wires the redirect and sidebar-highlight flows. |
| ui/litellm-dashboard/src/utils/migratedPages.test.ts | Two new assertions added for the playground mapping and its reverse lookup; minor test-name mismatch and missing trailing-slash coverage for the new route. |
| ui/litellm-dashboard/src/app/page.tsx | Removes PlaygroundPage import and its page == "llm-playground" arm from the legacy switch; safe because the redirect-before-render path in MIGRATED_PAGES intercepts the legacy URL first. |
Comments Outside Diff (1)
-
ui/litellm-dashboard/src/utils/migratedPages.test.ts, line 31-38 (link)The test name no longer describes all of its assertions — after this change it also verifies the
llm-playground → playgroundmapping, which has nothing to do with the "api_ref hyphenated alias" described in the title. A misleading name makes it harder to understand what broke when this test fails.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Reviews (1): Last reviewed commit: "feat(ui): migrate the Playground page to..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Add the /ui/playground/ trailing-slash assertion for parity with the api-reference case, and rename the mapping test so its name covers the llm-playground entry it now also asserts.
The playground migration moved LLM Playground from the legacy ?page=llm-playground switch to the /ui/playground/ path route, but sidebar.spec.ts still asserted the query-param URL, so both clicking the sidebar item and the direct-nav helper failed. Drive the expected URL off a small migrated-segment map (mirroring MIGRATED_PAGES) so migrated pages assert their path route while legacy pages keep ?page=
Append "playground" to MIGRATED_E2E_SEGMENTS so the data-driven smoke covers the migrated Playground page in both mounts, and the migrated->migrated navigation test now runs (api-reference <-> playground) instead of skipping.
Relevant issues
Part of the App Router migration (Wave A), building on the plumbing merged in #29953. Targets
litellm_internal_stagingdirectly.Linear ticket
None
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
make test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Screenshots / Proof of Fix
Behavior change, so verify on a live proxy after building the UI into
litellm/proxy/_experimental/out:Type
🆕 New Feature
Changes
Second page migrated under the strangler-fig plan, and the first to confirm the cutover is now a one-line change on top of the plumbing from #29953. The Playground route already existed at
(dashboard)/playground/page.tsxand already sourced everything fromuseAuthorizedplus its own proxy-settings fetch, so there was no prop or shared-state work: this addsllm-playground -> playgroundtoMIGRATED_PAGESand deletes the page's arm (and import) from the legacypage.tsxswitch.Tests pin the new mapping:
MIGRATED_PAGES["llm-playground"]resolves toplayground, andlegacyKeyForPathname("/ui/playground")resolves back to thellm-playgroundsidebar key so highlighting stays correct.Migration counter: 2 / 35.