mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-20 00:11:50 +00:00
* test(ui): pin the teams create and update payloads before the form migration The teams graph (Teams.tsx, TeamInfo.tsx and the MetadataKeyValueFields child they share) is next for the antd Form to react-hook-form migration, and its submit payload is a function of which collapsible sections the user happened to open. Nine sections across the two files use the shadcn Collapsible, none of them passes keepMounted, and Base UI unmounts the closed branch, so a closed section registers nothing and its keys never reach the request body. That matters beyond parity. /team/update reads the body with exclude_unset, so an omitted key is never written, while an explicitly null team member budget key reaches clear_team_member_budget_fields and nulls max_budget, budget_duration, rpm_limit and tpm_limit on the shared budget row. antd cannot reach that today because the field is unregistered rather than null. A port that seeds those fields or coalesces on the way into the payload would turn a save with the section never opened into a silent clear. The coverage that shipped with the team modal reached one of the four gating sections on the create side and asserted key sets rather than the request body, so a null where antd sent undefined would have passed. These cases assert both the raw payload and its JSON round trip with toStrictEqual, which is what separates absent from null from undefined, and they cover every gating section on both screens. Also pinned, because each is a live behaviour a port can quietly change: - the create path sends max_budget, tpm_limit and rpm_limit as strings, while team_member_budget arrives as a number through its normalize prop - an invalid secret manager config blocks the create with its rule message suppressed by the item's help prop, so nothing is shown to the user - the disable global guardrails switch is inert for a non premium user - a value typed into a section survives collapsing and re-expanding it Verified by adding keepMounted to all nine panels, which is the change a porter reaches for on noticing that fields go missing: 35 of 118 went red, including every one of these cases. The files were restored byte identical afterwards. No production file changes here. 145 tests pass across the three files. * refactor(ui): migrate the teams form graph off antd Form onto react-hook-form Teams.tsx and TeamInfo.tsx were the last large antd `Form` graph in the dashboard. Both now use `useZodForm` + `FormField`, with the shared `MetadataKeyValueFields` child converted to a `useFieldArray`. antd only returns the mounted registered fields from `onFinish`, so a closed collapsible contributed no keys at all. react-hook-form keeps unmounted values in the store (and `shouldUnregister: true` would lose them on re-expand), so both forms project the submitted values through the currently mounted section list before handing them to the existing payload builders. Closed sections therefore still produce absent keys rather than nulls, which matters at /team/update where an explicit null clears the shared budget row. Widgets that had no shadcn equivalent are replaced with the existing shared ones: SearchSelect for the organization pickers, MultiSelect for default member models, TagsInput for guardrails/policies, and a new GuardrailsSelect for the grouped global/other guardrail dropdown. * refactor(ui): forward the field ref to NumericalInput in the teams forms staging turned NumericalInput into a forwardRef, so the teams graph can stop dropping the react-hook-form ref on the floor. * test(ui): pin the capability gate, required rules and guardrail kill switch A mutation run over the ported teams forms found five survivors the payload cases did not reach: the viewPolicies gate on both forms, the team name rule on both forms, the guardrail kill switch resync, and the number coercion on a typed model rate limit. Six cases close them. |
||
|---|---|---|
| .. | ||
| ModelSelect.test.tsx | ||
| ModelSelect.tsx | ||
| modelUtils.test.ts | ||
| modelUtils.ts | ||