Repository navigation
test(ui): settle the TeamSSOSettings save before the test returns - #41219
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Greptile SummaryThis PR removes a teardown race from the TeamSSOSettings unit test
Confidence Score: 5/5The test-only change appears safe to merge and resolves the pending asynchronous work without weakening the existing behavior check The deferred save is supported by the configured Node and TypeScript toolchain, and the final awaited UI state keeps the save continuation within the test lifecycle
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/TeamSSOSettings.test.tsx | Makes the save lifecycle deterministic and ensures the asynchronous component update finishes before test teardown |
Reviews (1): Last reviewed commit: "test(ui): settle the TeamSSOSettings sav..." | Re-trigger Greptile
|
bugbot run |
There was a problem hiding this comment.
✅ 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 3c92161. Configure here.
TLDR
Problem this solves:
TeamSSOSettings.test.tsxleft a 100ms save timer running past teardownReferenceError: window is not definedHow it solves it:
User Flow
Not applicable, this PR only changes a dashboard unit test
Relevant issues
Affected release
Linear ticket
Flake evidence, grouped by run date
2026-09-14
ui/litellm-dashboard/src/components/TeamSSOSettings.test.tsx, "should disable cancel button while saving", flaked once in the windowRun https://github.com/BerriAI/litellm/actions/runs/34869609876 (UI Unit Tests, head
9cd8829): attempt 1 failed in job https://github.com/BerriAI/litellm/actions/runs/34869609876/job/104061957175 with all 2582 tests passing and one unhandled error,ReferenceError: window is not definedatresolveUpdatePriority->dispatchSetState->handleSave src/components/TeamSSOSettings.tsx:162. Attempt 2 on the same SHA passedMechanism: async teardown race. The test mocked the save with
setTimeout(..., 100), asserted that Cancel was disabled, and returned. CI runs the suite with--pool forks --maxWorkers=14, so the fork stays alive for the next file while the previous file's jsdomwindowis already gone. When the timer fired,handleSavecontinued intosetValues/setIsEditing/setSavingand React's scheduler readwindow. A single-file local run does not reproduce this because the fork exits before the timer fires, so the fix rests on the CI stack trace plus the test structure (this is the only test in the file that returns with a pending timer)Fix:
Promise.withResolversgives the test the handle to settle the save. It asserts Cancel is disabled while pending, resolves the save, then awaits the Edit Settings button, which only reappears aftersetIsEditing(false)runs. Mutating the component by removingdisabled={saving}fails the first assertion, and removingsetIsEditing(false)fails the second, so the test still fails when either behavior breaksCandidates seen in the window but not fixed here
tests/proxy_behavior/auth/test_auth_object_prefetch.py::test_join_binds_the_membership_to_the_requested_teamfailed 87 times across runs 34901928062, 34911769309 and 34921376544 (all attempts), always on branch SHAs that predatef4e21430c0(frozen cache clock in the prefetch tests) onmain. Stale branch, the fix already landed upstreamtest_file_reference_non_image_not_counted_as_image,test_video_plus_audio_does_not_double_bill_text, the Vertex embedding and Claude config cases, andtest_ui_view_spend_logs_search_matches_any_idfailed on every attempt of the runs they appeared in, on branches whose code changed the behavior under test. Reported as real breakages on those branches, not touched herePre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Test-only change with no user-facing behavior, so there is no live proxy or UI run to show. The CI evidence above is the before, and the ui-unit-tests job on this PR is the after
Type
✅ Test
Caveats (if any)
Low
Final Attestation
Link to Devin session: https://app.devin.ai/sessions/08522e71689e42d9b9d5f25650594c5f
Open in Devin Desktop: https://app.devin.ai/desktop/session/08522e71689e42d9b9d5f25650594c5f?variant=devin
Note
Low Risk
Test-only change with no production code or runtime behavior impact.
Overview
Fixes a CI flake in
TeamSSOSettings.test.tsxwhere the “disable Cancel while saving” case could finish while a mocked save was still pending.The test no longer uses a
setTimeout(100)save mock that could fire after jsdom teardown under Vitest’s fork pool. It now drives the update API withPromise.withResolvers, keeps the Cancel-disabled assertion while the promise is open, then resolves the save and waits for “Edit Settings” so the async save path fully settles before the test ends.Reviewed by Cursor Bugbot for commit 3c92161. Bugbot is set up for automated code reviews on this repo. Configure here.