Skip to content

test(ui): pin token-exchange field visibility to the oauth2_token_exchange auth type - #32385

Merged
tin-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_mcp_te_fields_visibility_test
Jul 7, 2026
Merged

test(ui): pin token-exchange field visibility to the oauth2_token_exchange auth type#32385
tin-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_mcp_te_fields_visibility_test

Conversation

@tin-berri

@tin-berri tin-berri commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Relevant issues

Stacked on #31772 (base is that branch; retargets to litellm_internal_staging when it merges). Follow-up test-only PR split out during #31772's review.

Linear ticket

N/A

Type

🧪 Tests

Changes

The create form renders the token-exchange field section (Token Exchange Endpoint, Client ID, Client Secret, Audience, Subject Token Type, Scopes) only when the auth type is oauth2_token_exchange — both #31772 forms gate it on authType === AUTH_TYPE.OAUTH2_TOKEN_EXCHANGE. No test asserted that visibility contract in either direction, so a regression (e.g. rendering the section for plain oauth2, or dropping it for token exchange) would pass CI. This adds one test walking the auth selector OAuth → OAuth Token Exchange (OBO) → API Key and asserting the section is hidden, shown, and hidden again.

[REQUIRED] Testing

npx vitest run src/components/mcp_tools/create_mcp_server.test.tsx
Test Files  1 passed (1)
     Tests  33 passed (33)

🤖 Generated with Claude Code


Note

Low Risk
Test-only change in the dashboard; no runtime behavior or API surface is modified.

Overview
Adds a Vitest case in create_mcp_server.test.tsx that locks in when OAuth token-exchange UI appears on the Add MCP Server form.

The test walks Authentication from plain OAuthOAuth Token Exchange (OBO)API Key, asserting Token Exchange Endpoint and Subject Token Type stay hidden except for OBO. It also switches transport to Standard Input/Output after OBO and expects those fields to disappear with the HTTP-only Authentication block.

No application or form logic changes—only regression coverage for the oauth2_token_exchange visibility contract.

Reviewed by Cursor Bugbot for commit 7ececc3. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a single Vitest test to create_mcp_server.test.tsx that asserts the token-exchange field section (Token Exchange Endpoint, Subject Token Type, etc.) is rendered only when the auth type is oauth2_token_exchange and is hidden for oauth2 and api_key.

  • Covers three auth-type transitions (OAuth → OAuth Token Exchange (OBO) → API Key) and a fourth transport-level gate (switching to stdio unmounts the whole auth section).
  • No existing tests are modified; all assertions follow the established selectAntOption + waitFor pattern already used throughout the file.

Confidence Score: 5/5

Test-only addition with no production code changes; safe to merge.

The change is a single additive test. No existing assertions are weakened, all network calls are mocked, and the test logic is consistent with the surrounding test suite. No production code is touched.

No files require special attention.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.test.tsx Adds one test asserting token-exchange field visibility is gated on the oauth2_token_exchange auth type; no existing tests modified, no real network calls, all mocks in place.

Reviews (2): Last reviewed commit: "test(ui): assert the stdio transport swi..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Base automatically changed from litellm_mcp_token_exchange_ui to litellm_internal_staging July 7, 2026 22:26
tin-berri and others added 2 commits July 7, 2026 15:30
…h2_token_exchange auth type

No form section asserted the visibility contract: the token-exchange fields
(Token Exchange Endpoint, Audience, Subject Token Type) must appear when
'OAuth Token Exchange (OBO)' is selected and for no other auth type. Assert
hidden under plain OAuth, shown under token exchange, hidden again after
switching to API Key.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ge fields

The create form gates the whole Authentication section on non-stdio transport,
so selecting OAuth Token Exchange (OBO) and then switching to stdio removes the
token-exchange fields (and their required-credential rules, which antd does not
validate while unmounted). Pin that sequence so the section-level gate cannot
regress silently.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tin-berri
tin-berri force-pushed the litellm_mcp_te_fields_visibility_test branch from 134edcc to 7ececc3 Compare July 7, 2026 22:33
@tin-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@tin-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 7ececc3. Configure here.

@codspeed-hq

codspeed-hq Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 15.21%

⚡ 1 improved benchmark
✅ 29 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
test_completion_simple_message 4.8 ms 4.2 ms +15.21%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing litellm_mcp_te_fields_visibility_test (7ececc3) with litellm_internal_staging (ff6dc33)

Open in CodSpeed

@tin-berri
tin-berri merged commit 10c7be2 into litellm_internal_staging Jul 7, 2026
128 checks passed
@tin-berri
tin-berri deleted the litellm_mcp_te_fields_visibility_test branch July 7, 2026 23:33
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.

2 participants