diff --git a/AGENTS.md b/AGENTS.md index 5a48049ef45..bfd44304d55 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -174,6 +174,8 @@ When opening issues or pull requests, follow these templates: 3. **Rate Limits**: Respect provider rate limits in tests 4. **Memory Usage**: Be mindful of memory usage in streaming scenarios 5. **Dependencies**: Keep dependencies minimal and well-justified +6. **UI/Backend Contract Mismatch**: When adding a new entity type to the UI, always check whether the backend endpoint accepts a single value or an array. Match the UI control accordingly (single-select vs. multi-select) to avoid silently dropping user selections +7. **Missing Tests for New Entity Types**: When adding a new entity type (e.g., in `EntityUsage`, `UsageViewSelect`), always add corresponding tests in the existing test files and update any icon/component mocks ## HELPFUL RESOURCES diff --git a/CLAUDE.md b/CLAUDE.md index 3cb67908076..3b597fb8a90 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -97,6 +97,10 @@ LiteLLM is a unified interface for 100+ LLM providers with two main components: - Integration tests for each provider in `tests/llm_translation/` - Proxy tests in `tests/proxy_unit_tests/` - Load tests in `tests/load_tests/` +- **Always add tests when adding new entity types or features** — if the existing test file covers other entity types, add corresponding tests for the new one + +### UI / Backend Consistency +- When wiring a new UI entity type to an existing backend endpoint, verify the backend API contract (single value vs. array, required vs. optional params) and ensure the UI controls match — e.g., use a single-select dropdown when the backend accepts a single value, not a multi-select ### Database Migrations - Prisma handles schema migrations diff --git a/ui/litellm-dashboard/src/components/EntityUsageExport/UsageExportHeader.tsx b/ui/litellm-dashboard/src/components/EntityUsageExport/UsageExportHeader.tsx index 989ff8703e8..3c9b695a7dd 100644 --- a/ui/litellm-dashboard/src/components/EntityUsageExport/UsageExportHeader.tsx +++ b/ui/litellm-dashboard/src/components/EntityUsageExport/UsageExportHeader.tsx @@ -17,6 +17,7 @@ interface UsageExportHeaderProps { selectedFilters?: string[]; onFiltersChange?: (filters: string[]) => void; filterOptions?: Array<{ label: string; value: string }>; + filterMode?: "multiple" | "single"; customTitle?: string; compactLayout?: boolean; teams?: Team[]; @@ -32,6 +33,7 @@ const UsageExportHeader: React.FC = ({ selectedFilters = [], onFiltersChange, filterOptions = [], + filterMode = "multiple", customTitle, compactLayout = false, teams = [], @@ -59,11 +61,17 @@ const UsageExportHeader: React.FC = ({
{filterLabel && {filterLabel}}