Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions ui/litellm-dashboard/src/components/router_settings/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
return {
...actual,
Select: Object.assign(
({ value, onChange, children }: any) => (

Check warning on line 11 in ui/litellm-dashboard/src/components/router_settings/index.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
<select data-testid="strategy-select" value={value ?? ""} onChange={(e) => onChange(e.target.value)}>
{children}
</select>
),
{
Option: ({ value, children }: any) => <option value={value}>{children}</option>,

Check warning on line 17 in ui/litellm-dashboard/src/components/router_settings/index.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
},
),
};
Expand All @@ -34,7 +34,6 @@
routing_strategy: "simple-shuffle",
num_retries: 3,
timeout: 30,
routing_groups: [],
},
};

Expand Down Expand Up @@ -135,34 +134,6 @@
);
});

it("should send routing_groups as a list when saving load balancing settings", async () => {
const user = userEvent.setup();
renderWithProviders(<RouterSettings {...defaultProps} />);

await waitFor(() => {
expect(screen.getByRole("textbox", { name: /routing_groups/i })).toBeInTheDocument();
});

await user.click(screen.getByRole("button", { name: /save changes/i }));

expect(setCallbacksCall).toHaveBeenCalledWith(
"test-token",
expect.objectContaining({
router_settings: expect.objectContaining({
routing_groups: [],
}),
}),
);
expect(setCallbacksCall).not.toHaveBeenCalledWith(
"test-token",
expect.objectContaining({
router_settings: expect.objectContaining({
routing_groups: "[]",
}),
}),
);
});

it("should show a success notification after saving", async () => {
const user = userEvent.setup();
renderWithProviders(<RouterSettings {...defaultProps} />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
accessToken: string | null;
userRole: string | null;
userID: string | null;
modelData: any;

Check warning on line 11 in ui/litellm-dashboard/src/components/router_settings/index.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
}

interface routingStrategyArgs {
Expand All @@ -23,7 +23,7 @@
enableTagFiltering: false,
});
const [availableRoutingStrategies, setAvailableRoutingStrategies] = useState<string[]>([]);
const [routerFieldsMetadata, setRouterFieldsMetadata] = useState<{ [key: string]: any }>({});

Check warning on line 26 in ui/litellm-dashboard/src/components/router_settings/index.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
const [routingStrategyDescriptions, setRoutingStrategyDescriptions] = useState<{ [key: string]: string }>({});

useEffect(() => {
Expand All @@ -48,8 +48,8 @@
console.log("router settings from API", data);
if (data.fields) {
// Build metadata map for easy lookup
const fieldsMap: { [key: string]: any } = {};

Check warning on line 51 in ui/litellm-dashboard/src/components/router_settings/index.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
data.fields.forEach((field: any) => {

Check warning on line 52 in ui/litellm-dashboard/src/components/router_settings/index.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
fieldsMap[field.field_name] = {
ui_field_name: field.ui_field_name,
field_description: field.field_description,
Expand All @@ -60,7 +60,7 @@
setRouterFieldsMetadata(fieldsMap);

// Extract routing strategies from the routing_strategy field's options
const routingStrategyField = data.fields.find((field: any) => field.field_name === "routing_strategy");

Check warning on line 63 in ui/litellm-dashboard/src/components/router_settings/index.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
if (routingStrategyField?.options) {
setAvailableRoutingStrategies(routingStrategyField.options);
}
Expand All @@ -71,7 +71,7 @@
}

// Set enable_tag_filtering value
const tagFilteringField = data.fields.find((field: any) => field.field_name === "enable_tag_filtering");

Check warning on line 74 in ui/litellm-dashboard/src/components/router_settings/index.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
if (tagFilteringField?.field_value !== null && tagFilteringField?.field_value !== undefined) {
setFormValue((prev) => ({
...prev,
Expand All @@ -91,7 +91,7 @@
console.log("router_settings", router_settings);

const numberKeys = new Set(["allowed_fails", "cooldown_time", "num_retries", "timeout", "retry_after"]);
const jsonKeys = new Set(["model_group_alias", "retry_policy", "routing_groups"]);
const jsonKeys = new Set(["model_group_alias", "retry_policy"]);

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.

P1 routing_groups re-introduced as a raw string instead of a list

By removing routing_groups from jsonKeys, the parseInputValue helper will now fall through to return v (the raw trimmed string), so whatever the user typed in the text box — e.g. "[]" or "[\"group1\"]" — is forwarded to the backend as a plain string. The backend expects a JSON list, not a string, so any configured routing groups will be silently ignored or cause a parse error server-side. This is exactly the regression that PR #29889 was written to fix.

Rule Used: What: Flag any modifications to existing tests and... (source)


const parseInputValue = (key: string, raw: string | undefined, fallback: unknown) => {
if (raw === undefined) return fallback;
Expand Down
Loading