Repository navigation
test(ui): give the integration vitest tier a wait ceiling matching its cost - #43437
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…s cost Integration cases render a whole component tree and legitimately take about a second per availability round trip under load, so testing-library's 1000ms asyncUtilTimeout default flakes them. The ceiling is raised to 5s for the integration project only via a dedicated setup file; unit and component tiers keep the default Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
|
TLDR
Problem this solves:
edit_auto_router_modal.integration.test.tsxthreshold cases flaked twice on main in the last 24hwaitFordefaultHow it solves it:
tests/setup.integration.tssets Testing LibraryasyncUtilTimeoutto 5sintegrationVitest project loads it; unit and component tiers keep the 1s defaultUser Flow
Before: a contributor's unrelated PR goes red on the UI integration shard and they have to re-run it
ui/litellm-dashboard/src/components/edit_auto_routerui-testsjob fails onEditAutoRouterModal keyword matching > hydrates the saved threshold and saves an edit to '0'withSave Changesstill disabled after 1000msAfter: the same commit gets a green UI integration shard on the first attempt
ui-testsjob waits up to 5s for the availability check to finish and the Save button to enable, which it does well inside that budgetFlake evidence (run date 2026-09-26)
Test ids:
src/components/edit_auto_router/edit_auto_router_modal.integration.test.tsx > EditAutoRouterModal keyword matching > hydrates the saved threshold and saves an edit to '0'and the''variant of the sameit.eachFailed on main, attempt 1, with no change to the component or the test:
https://github.com/BerriAI/litellm/actions/runs/36280397180 and https://github.com/BerriAI/litellm/actions/runs/36294321344
Passed on the neighboring main commits
829cba1b,491d4548,b831e9b4,4274bdda,8e6d99d7andf4308bc1, so the result changed without the code under test changingMechanism: wall-clock dependence.
fireEvent.changeon the threshold field changes the serialized router config, the availability hook marks the form as checking, waits a 300ms debounce, refetches the mocked/auto_router/availabilityendpoint through React Query, and only then does the modal enableSave Changes. On a contended runner that whole chain runs past Testing Library's 1000msasyncUtilTimeout, sowaitFor(() => expect(saveButton).toBeEnabled())gives up first. Locally the test never fails on an idle box, and fails 2 in 10 with 16 CPU busy loops alongside itWhy this is a timeout ceiling and not a longer sleep:
waitForpolls a condition and returns the moment it holds, so the 5s value is only how long a real hang takes to surface. The integration tier is the one tier that renders whole component trees and stubs only the network boundary, so its steps legitimately cost more than a unit render. Dropping the hook's debounce to 0 was tried and did not remove the flake, and the hook itself is not racy, so no production change is warrantedMutation check: forcing the hook to always report
Checking availabilitymakes both threshold cases fail after the change, so the test still catches a Save button that never enablesNot flakes in the window
Real breakage: a types refactor on main around
2101c860broke unit shards and the coverage job deterministically on every attempt until fixed upstream. Several PR failures matched files those PRs modified. Infra: one Prisma generation timeout and a run whose log blob was missing. None of these were touchedOther open deflake PRs
#42936 and #41219 both carry an approval from a human reviewer, so they are left untouched under the human-reviewed exception and this PR is the new rolling PR
Pre-Submission checklist
uv run pytest tests/unit/<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)Screenshots / Proof of Fix
There is no proxy or Admin UI surface for this change, so the proof is the flake reproduction itself: the same test file run under the same CPU contention at the merge base and at the tip, in
ui/litellm-dashboardBefore (f4308bc)
for i in $(seq 16); do (while :; do :; done) & done; for i in $(seq 10); do npx vitest run --project integration src/components/edit_auto_router/edit_auto_router_modal.integration.test.tsx -t "hydrates the saved threshold" 2>&1 | grep -E "Tests .*(passed|failed)"; done; kill $(jobs -p)Tests 2 passed, 2 runs reportTests 1 failed | 1 passedwithexpect(element).toBeEnabled()onSave Changestiming out after 1000msAfter (9887b2e)
Tests 2 passed, and the full file reportsTests 64 passedType
✅ Test
Caveats (if any)
Low
Final Attestation
Link to Devin session: https://app.devin.ai/sessions/a2edebd9f60d42e8baab982666464c52
Open in Devin Desktop: https://app.devin.ai/desktop/session/a2edebd9f60d42e8baab982666464c52?variant=devin