* feat(complexity_router): custom classifier plugins via classifier_type 'plugin'
Adds a third classification mode where an operator-supplied hook decides the
tier instead of the heuristic scorer or the LLM classifier. The hook implements
an async classify(context) returning a tier name (built-in value, tier_labels
label, or tier_definitions name) or None to decline; failures, timeouts, and
unknown tiers fall back exactly like a failed LLM classifier. The context
carries the request messages and metadata, including caller identity, so a
plugin can route by team, spend, or any business rule.
The plugin resolves from a dotted path at proxy startup with a load-time check
that classify is a coroutine function, and is closed off over HTTP like the
routing plugins list. Routing decisions record the new classifier_plugin cause.
tier_definitions now accepts classifier_type 'plugin' alongside 'llm'.
* fix(proxy): resolve plugin dotted paths in _delete_deployment before hashing ids
The db-sync reconcile re-reads the raw config and hashes litellm_params to
compute which ids the config wants served, but the router's ids were hashed
from the resolved params where plugin dotted paths are live instances. The
mismatched ids made the reconcile evict every plugin-bearing auto-router one
sync after startup, on any proxy with a database connected. This also affected
the existing routing plugins list, not just the new classifier plugin.
Resolving the plugins in _delete_deployment the same way load_config does makes
both sides hash the same canonical form. A plugin module broken on disk at
reconcile time skips cleanup instead of evicting valid deployments, matching
how a get_config failure is handled
* fix(complexity_router): treat non-string plugin verdicts as declines, centralize the empty-mapping sentinel
A hook returning a non-string raised inside resolve_classified_tier outside the
plugin exception boundary, failing the request instead of falling back. Also
moves the read-only empty mapping to constants.py per repo convention and moves
the classifier plugin product docs out of the package README for the docs repo
* refactor(complexity_router): rename the plugin classifier mode to classifier_type 'custom'
The mode value now names the operator's intent while classifier_plugin keeps
naming the mechanism; routing decisions keep the classifier_plugin cause
* refactor(proxy): pin plugin-bearing deployment ids from the raw params instead of resolving in the reconcile
Replaces the previous approach of re-running plugin resolution inside
_delete_deployment, which imported operator modules on every reconcile cycle
and skipped the whole cleanup pass when any one module was broken on disk.
load_config now stamps model_info.id from the raw litellm_params before
resolution swaps dotted paths for live instances, so the reconcile's raw-config
hash matches by construction and needs no resolution at all: a broken module
cannot stall cleanup for unrelated models, and any future param-transforming
resolution is covered by the same pin. _generate_model_id becomes a staticmethod
so the pin can run before the Router exists; its statically dead non-string key
branches are removed. Also documents candidate_models as an informational
snapshot for classifier plugins, unlike the narrowing surface RoutingPlugin
filters
* fix(router): restore _generate_model_id key handling, align classifier context with the routing-plugin pattern
The staticmethod conversion accidentally dropped the non-string-key branches
from _generate_model_id, a silent hash change for any params with non-string
keys; they are restored verbatim. The classifier plugin context now follows
the Router-level routing-plugin recipe exactly: structured messages come from
resolve_structured_messages over the raw messages, and the metadata key comes
from the shared get_metadata_variable_name_from_kwargs helper, which also
replaces the duplicated inline sniff in _pick_model_for_tier. This removes the
raw-or-resolved fallback where a plugin could silently receive resolved
messages when a call site forgot to pass the raw ones
* refactor(router): make generate_model_id public, guard classifier context construction
Two modules legitimately hash deployment ids with the same helper now (Router
and the proxy's config-load pin), so the private name was lying about its
audience and the cross-module call needed a pyright suppression; renaming it
public restores the static safety net. The classifier plugin's RoutingContext
construction moves inside the failure boundary, matching the LLM path where
litellm-side prompt building also falls back rather than failing the request,
and a prompt-only call with no message list is now covered by a test
E2E_FIXTURE_MODE selects the transport every e2e client is built on: live
(default, unchanged behavior), record (pass through to the live proxy while
writing every interaction to a fixture bundle), or replay (serve every
interaction from the bundle with no proxy and no provider spend). Both new
transports fulfil the existing Transport protocol, so no test changes shape.
A bundle is a directory with a manifest (record timestamp, harness version,
format version) and one JSON file per interaction, grouped per test in call
order. Replay against a manifest older than seven days hard-fails at
collection time naming the bundle age. Record always wipes and never reads
the previous bundle, refusing to wipe a directory that is not a bundle.
Auth header values are redacted on write; uploads store a sha256 digest.
unique_marker() becomes deterministic per test in record/replay modes so a
replay run regenerates exactly the requests the record run sent.
Content-based match keys, streaming chunk fidelity, and provider-scoping are
follow-ups (LIT-5741, LIT-5742, LIT-5745).
* refactor(ui): move the MCP server forms and detail tabs off tremor
Swaps the tremor Button, TextInput, Title, Text and Tab primitives in the six
MCP server components for the shadcn layer, and leaves the antd Modals, Forms
and Selects alone for the antd pass. In the two files that mix both input
libraries, antd's Input is imported as AntdInput so the shadcn Input keeps its
canonical name.
Two behaviours needed care. Base UI's Button forces type="button", so the
create button in CreateMCPServer now carries an explicit type="submit"; Cancel
and the OAuth authorize button stay non submitting, which also drops the
accidental implicit submit they inherited from tremor. Every TabsContent gets
keepMounted, because Base UI unmounts inactive panels while tremor only hid
them, and a save started from the Cost Configuration tab reads fields that live
in the Server Configuration panel. mcp_server_edit.test.tsx gains a regression
test for that: drop keepMounted and the pending edit never reaches the update
payload.
One affordance is gone: password fields no longer draw tremor's built in reveal
toggle, since the shadcn Input is a plain native input.
Prunes the six no-restricted-imports suppressions these files no longer need.
* fix(ui): keep the reveal toggle on the MCP secret fields
tremor's TextInput drew its own show/hide button whenever the type was
password, and the shadcn Input is a plain native input, so the straight
prop pass-through silently deleted that affordance from five fields: the
create modal's authentication value and the OAuth client id and secret in
both the M2M and the interactive flow.
Puts them on antd's Input.Password instead, which is what every sibling
secret field in this directory already uses (TokenExchangeFormFields,
IdJagFormFields, AwsSigV4Fields and the edit form), so the reveal survives
and the five fields now match their neighbours instead of behaving
differently inside the same form. Both files already import antd, so this
adds no import and no suppression.
* test(ui): pin the connect tab mount contract
mcp_connect's per-card "limit tools to specific MCP servers" toggle lives
in panel local state that feeds the rendered header block, so the panels
have to stay mounted across a tab switch. Base UI unmounts an inactive
panel unless keepMounted is set, and unlike the edit form there was no
test holding that down.
Toggles the header on from the LiteLLM Proxy panel, switches to Cursor and
back, and asserts both the switch and the x-mcp-servers line in the curl
example survived. Dropping keepMounted from that panel fails it.
* fix(ui): keep the MCP tab strips underlined instead of segmented
A bare tremor TabList is variant="line", so the connect strip and the
server settings strip both drew an underlined tab on a full width
divider. Converting them bare turned each into a filled segmented
control, because the shadcn TabsList defaults to the pill.
Both strips now use variant="line" with the divider recipe, and the
connect strip gets back the grey rounded box tremor drew around its four
tabs.
* refactor(ui): migrate the vector store creation form to shadcn
CreateVectorStore and S3VectorsConfig were the last antd Form.Item users on
the vector stores page. Both are now built from the shared Field primitives
and shadcn controls, so the page picks up the design tokens and dark mode.
CreateVectorStore's antd Form was inert: no Form.Item carried a name, there
was no onFinish, and the submit button sat outside the form element, so the
form store never held anything. Form.useForm is dropped rather than replaced
with react-hook-form, and the existing imperative validation is unchanged.
S3VectorsConfig's four Form.Item wrappers had no name either, so its inputs
were already prop-controlled and decoupled from the parent store. The
embedding model picker keeps its typeahead by moving to Combobox.
The submit payload is unchanged. A new characterization suite pins it: it was
written against the antd originals, proved green there first, and passes
unedited against the migration.
* test(ui): cover the S3 embedding model combobox end to end
The migration moved this control from an antd Select with showSearch to a
Combobox, and nothing exercised it: the suite pinned the payload but never
loaded the option list, filtered it, or selected from it.
The case drives the whole interaction. It stubs three models, one of which is
a chat model, opens the list and asserts the chat model is absent, types to
filter, selects the remaining embedding model and asserts it arrives in the
providerParams argument.
Proved green against the antd originals of both files first, then unedited
against the migration. It queries the control by role rather than by label,
because the antd original rendered a label with no control associated to it,
which the migration fixes.
Failure rows in the spend log only carried token counts when a broken
stream stashed recovered partial usage; non-stream requests that reached
the provider and then failed (timeouts, provider 4xx/5xx) logged
0/0/0 even though the provider billed the input tokens. Estimate the
input side in post_call_failure_hook with the same tokenizer fallback
interrupted streams use, gated to requests that were actually dispatched
(first_api_call_start_time set and no litellm_no_upstream_llm_call
marker), and pin response_cost to 0.0 so failed requests never bill
spend. Recovered partial-stream usage still wins over the estimate.
Moves six antd Form graphs onto react-hook-form + shadcn: the pass-through
create and edit forms with their two shared sections, the project create and
edit modals, and the access group edit modal.
Each form graph moved atomically. An antd Form.Item parent cannot host a
react-hook-form child, so a shared section that renders a Form.Item has to move
with every parent that mounts it or the field silently stops reaching the
payload. PassThroughSecuritySection holds Form.Item name="auth" and is imported
by both pass-through parents, so all four files move together.
Submit payloads are unchanged and pinned by characterization tests written
against the antd originals first. That includes the parts that look like bugs:
add_pass_through still sends timeout and cost_per_request as strings while
pass_through_info sends them as numbers, and both edit modals still omit fields
whose antd Form.Item never mounted.
One behaviour does change. Enter in the add pass-through form ran Cancel and
discarded the filled form, because HTML implicit submission activates the first
submit button in tree order and Tremor renders buttons with no type attribute,
making the footer Cancel that button. Cancel is now type="button" and Enter
submits.
* refactor(ui): migrate the caching, cost tracking, alerting and user detail forms to react-hook-form and shadcn
Moves the last of this lane's antd Form usage onto react-hook-form plus the
shadcn field kit, and takes the neutral greys in the files touched onto
semantic tokens so these screens are dark-mode ready.
Each unit is characterization-first: a payload-pinning test was written and
proven green against the antd original before any production code changed,
then re-run unedited against the migration. Every pre-existing test for these
files still passes without edits.
Two behaviour changes are deliberate and disclosed rather than buried.
Saving cache settings with the Advanced section collapsed used to drop
namespace, ttl, max_connections and the GCP fields from the payload, and to
send ssl as false even when the loaded value was true, because antd reports
only mounted fields at submit while its store keeps the rest. Keeping the
values in form state fixes that, and the payload no longer depends on whether
the section was expanded.
Adding a provider discount used to call the handler twice per click, because
the child submit button sat inside a Form carrying onFinish that called the
same function the button's onClick already called. Removing the leftover
wrapper collapses it to one request. Both calls read the same config and sent
the same body, so this changes request count rather than stored state.
* fix(ui): restore Enter submission on the provider discount form
Removing the antd Form wrapper from cost_tracking_settings also removed
native Enter submission from the Add Provider Discount modal, where the
original carried onFinish and AddProviderForm renders a type="submit"
button. Wrapping the fields in a native form whose onSubmit only calls
preventDefault restores it: implicit submission clicks the default
button, so Enter and a click each produce exactly one request rather
than the two the antd version fired on both paths.
The margin modal is deliberately left as a div. Its antd Form carried no
onFinish and AddMarginForm renders type="button", so Enter was already
inert there and a test now pins that alongside the working click path.
Also swaps five any[] mock forwarders for unknown[] in the user detail
test and asserts the role trigger renders its label rather than a blank
or raw value.
Image, file, video, and previous_response_id requests reserved the whole
project ITPM limit up front, so any window with existing usage rejected
them and one in-flight multimodal request blocked the entire project.
Reserve the token_counter estimate instead, like every other request;
post-call reconciliation already charges actual usage.
openai/responses/<model> deployments reached OpenAI as the literal model id
responses/<model> on /v1/responses and on /v1/messages (which rides the
Responses API for the openai provider) and 400ed with model_not_found, while
/v1/chat/completions already stripped the prefix. Strip a leading responses/
right after provider resolution so every Responses API entrypoint (HTTP,
websocket, compaction, the /v1/messages adapter) sends the real model id
* refactor(ui): retire the tremor date range picker in favour of the shared advanced picker
UsageDatePicker was the last tremor DateRangePicker surface. Its three call sites in the old usage page and the caching dashboard now render AdvancedDatePicker, which already had the same prop interface, preset list and idle-callback day-boundary adjustment. AdvancedDatePicker drops its own tremor Button and Text for the shadcn Button and a plain paragraph, and it now applies the className prop it already declared so the mb-4 the tag-based usage tab passes keeps landing on the picker root. usage_date_picker.tsx and its calendar-grid test are removed, and the two no-restricted-imports suppressions those files carried are pruned
* fix(ui): let the advanced date picker anchor its panel to the trigger's left edge
The picker's dropdown is 600px wide and right-anchored to a 300px trigger, which was fine while every caller sat at the right edge of its row. The two old usage tabs place it in the left column, so the preset column landed left of the main scroll container and was clipped. AdvancedDatePicker gains an align prop (default right, unchanged for existing callers) and the old usage call sites pass left. The caching dashboard grid gives the picker an auto track instead of a third equal share, so the fixed-width trigger no longer spills past the card at laptop widths
* fix(ui): give the advanced date picker a real focusable trigger
The picker's display was a click-only div, so tabbing through the usage,
old usage, caching, cost optimization and guardrails monitor pages skipped
the date range control entirely and its focus ring classes never fired. It
is now a type="button" element carrying aria-expanded, which restores the
keyboard and screen reader access the tremor picker had. The panel also
reports its anchoring as data-align so the test can assert intent instead
of a Tailwind class
* fix(ui): make date picker relative-range presets keyboard-operable
The presets were non-focusable divs with click handlers, so a keyboard-only admin tabbed past Today / Last 7 days / Last 30 days / MTD / YTD and had to type both dates by hand. They are now buttons carrying aria-pressed.
* feat(ui): plan-mode override tier in the auto-router create and edit forms
The backend plan_mode_min_tier field (#37230) was API-only. Both forms now
carry an Advanced: Plan-Mode Override panel in the shared complexity config
component: a toggle derived from field presence, so on writes the highest
tier that has models and off deletes the key, and a tier select limited to
tiers with models because the backend rejects a floor at an empty tier. The
edit modal manages the key on every save, so clearing it actually clears the
stored config instead of the preserved copy resurrecting it, while unmanaged
keys like plan_mode_patterns still round-trip untouched
* refactor(ui): hoist the eligible plan-mode tier list out of the panel JSX
* refactor(ui): move tierOptions into complexity_router_tiers, the shared tier-utility module
* refactor(ui): migrate login, onboarding and search tool forms to react-hook-form and shadcn
Moves four forms off antd Form and Tremor widgets onto react-hook-form plus
the shadcn kit, and onto semantic colour tokens so the screens are dark-mode
ready. antd Modal and Alert stay as the shells.
The submit payload is unchanged in all four. Each unit is pinned by a
characterization test that was proven green against the antd original before
any production code changed, and the pre-existing test files pass unedited.
Extracts the search tool payload builder, which was duplicated verbatim
between the create and edit forms, into searchToolPayload.ts with unit tests,
and adds a shared PasswordInput so the four reveal toggles antd and Tremor
gave for free are preserved on one component.
* refactor(ui): keep the search tool Test Connection button an implicit submit
Tremor's Button renders no type attribute, so inside a form it defaults to
submit. The Test Connection button therefore fires both its own onClick and
the form's onFinish today, which creates the search tool as a side effect of
testing the connection. shadcn's Button renders type="button", so the naive
swap silently dropped that second path.
Restores parity with an explicit type="submit" and pins it with a test, so
the double submit is recorded rather than quietly changed. Fixing it belongs
in its own change.
Also prunes the two now-stale eslint suppression counts for the migrated
search tool files, scoped to those keys only.
* refactor(ui): announce the login button spinner the way antd did
antd's Button renders its loading indicator as role="img" with aria-label
"loading", so a screen reader announces the request in flight. The shadcn
spinner is a bare svg, which drops that. Labels it on the login button to
match, as already done on the onboarding submit button.
* fix(ui): drop noValidate from the migrated login, onboarding and search-tool forms
antd's Form renders no novalidate attribute and its required rules emit
aria-required rather than the native required attribute, so nothing in
these four forms was ever gated by native constraint validation. The only
type="email" input is disabled and readOnly, which bars it from validation
in every browser. Measured in jsdom and again in Chrome against a live
proxy: form.checkValidity() is true with the fields empty, a native submit
reaches react-hook-form, and zod blocks it with the same messages.
Removing the attribute keeps the rendered form faithful to antd, and keeps
a constraint added later behaving the way antd would have behaved instead
of being silently suppressed.
* fix(ui): accept a null api_key when seeding the search tool edit form
The list endpoint declares api_key as str | None and search_tool_info as
dict | None, and the masking helper returns non-string values untouched, so
a tool stored without an API key comes back as "api_key": null. zod's
optional() accepts undefined and rejects null, so the edit form for any
such tool failed with "expected string, received null" and could never be
submitted. antd carried no schema and forwarded whatever the server sent.
nullish() restores that, and the payload still forwards the null rather
than coercing it to an empty string. The new case seeds both null vectors
and fails without this change.
* chore(ui): drop the narration comments from the search tool forms
These restate the state change or the JSX block directly below them, which
the repo's comment policy rules out, and both files are rewritten by this
change rather than merely touched.
Keeps an explicit empty messages list on the pre-existing path (default
model, provider validation error) instead of dropping the routing
decision and surfacing a misleading tags 401.
EditUserModal was rendered by the users dashboard but nothing could ever
open it. Its two pieces of state, editModalVisible and selectedUser, were
only ever set to false and null, so the modal short-circuited to null on
every render.
The edit path users actually reach goes through the row actions menu,
which routes to the user detail view and its edit form, so removing this
leaves no capability behind. The submit handler that fed the dead modal
goes with it, along with the imports it was the last consumer of.
Auto-router strategy hook returned None whenever the request carried
input instead of messages, so tagged /v1/responses requests (Codex CLI)
never picked a tier and tag filtering left nothing to route to. Resolve
input through the shared prompt-template helper before matching routes.
* refactor(ui): migrate prompt, UI access, plugin and MCP filter forms to react-hook-form and shadcn
Moves four more admin dashboard forms off antd Form onto react-hook-form with the
shared shadcn form kit, keeping the submitted payload byte-identical in every case.
Each form was pinned with a characterization test proven green against the antd
original before any production code changed, then re-run unedited afterwards.
Behaviours that needed reproducing by hand rather than falling out of the port:
- antd onFinish reports only mounted fields, so UIAccessControlForm blanks a seeded
but hidden restricted_sso_group at submit time instead of sending it
- antd InputNumber returns null on empty and clamps on blur, so MCPSemanticFilterSettings
keeps top_k as null when cleared and clamps to [1, 100] rather than sending "" or NaN
- PluginSettings seeds plugin_key blank on edit so an untouched save preserves the
stored credential instead of overwriting it with the redacted placeholder
- antd's url rule and zod's .url() disagree in both directions, so the async-validator
pattern is ported verbatim to avoid silently changing which URLs are accepted
Forms with no onFinish keep preventDefault so no Enter-to-submit is introduced, and
the plugin key regains a reveal toggle built on InputGroup.
* chore(ui): prune stale eslint suppressions left by concurrent form-migration PRs
* Revert "chore(ui): prune stale eslint suppressions left by concurrent form-migration PRs"
This reverts commit e36bcc5862.
* fix(ui): keep the embedding model unclearable, matching the antd Select
The antd Select for embedding_model had no allowClear, so an admin could never
empty it. SearchSelect renders a clear button whenever a value is set and emits
an empty string, so the migration silently added a way to persist an empty
embedding_model and break semantic filtering.
Adds an opt-out to SearchSelect that defaults to the current behaviour, leaving
the other twenty callers unaffected, and opts this one field out. Pinned with a
test that fails when the opt-out is removed.
* refactor(ui): migrate guardrail and vector store forms to react-hook-form and shadcn
Ports four antd forms in the guardrails and vector stores pages onto
react-hook-form with zod resolvers and the shadcn field kit, and takes the
files they live in off light-only Tailwind colors
VectorStoreForm and vector_store_info now build their payloads from typed
form values instead of an antd FormInstance, seeding the edit view through an
explicit mapper rather than spreading the whole server record. The submit
modal in TeamGuardrailsTab moves to the same shape, and its URL rule is
reproduced exactly: src/lib/forms/antdUrl.ts compiles the pattern
async-validator uses for `type: "url"`, with a test asserting the compiled
source and flags match, so a protocol-less www host keeps passing and a bare
domain keeps failing
CompetitorIntentConfiguration had no FormInstance at all: its antd Form was a
layout wrapper with no named items and no onFinish, so it moves onto the field
primitives directly rather than gaining form state it never had. Its tag and
threshold controls are replaced by local TagsInput and ThresholdInput
components that reproduce what antd did, comma token separators plus commit on
blur for tags, and clamp-on-blur with step-precision display for the
thresholds, without introducing the native number constraints that would
newly block the surrounding guardrail form
Every payload is pinned by a characterization test that was proven green
against the antd original before the swap and then re-run unedited
* fix(ui): keep the vector store edit form saving when the server sends null
The proxy returns null for an unset vector_store_name or
vector_store_description rather than omitting the key, and both columns are
nullable. z.string().optional() accepts undefined but rejects null, so
loading any store whose name or description was never set left the edit form
stuck on "Invalid input: expected string, received null" and it could not
submit at all. nullish() accepts both and forwards null unchanged, which is
what the antd version did
Pinned by an untouched-save case that seeds both fields null and clicks Save
without typing anything. It fails against the optional() schema with zero
requests sent, and passes against both the fix and the antd original, sending
vector_store_name and vector_store_description as null
Also drops the deep import into @rc-component/async-validator, an undeclared
transitive dependency that failed the knip gate. The URL parity assertion now
compares against a checked-in snapshot of the pattern async-validator 5.1.0
compiles, so it stays an exact-equality check, and removes a comment that only
restated the networking layer's error handling
* refactor(ui): migrate auto router and credential forms to react-hook-form and shadcn
Moves four antd Form surfaces onto useZodForm plus the shared FormField and
FieldGroup primitives: the routing group modal, the auto router edit modal, the
add auto router tab, and the reuse credentials modal. Field labels that carried
an antd tooltip= keep it as a hover Tooltip on a help icon, and hardcoded greys
give way to semantic color tokens.
Two Base UI combobox wrappers come out of the two auto router surfaces that
shared the same antd controls: AccessGroupTagsCombobox replaces mode="tags" for
model access groups, and ModelChoiceCombobox replaces the searchable single
select for default and embedding models.
Payload building for the routing group modal moves to routingGroupPayload.ts so
the JSON args parsing and the four bound fields can be asserted directly
instead of through a render.
handle_add_auto_router_submit now takes a resetForm callback rather than an antd
form instance, which drops one any from its signature.
No change to what any of these forms submit. The reuse credentials payload keeps
the same key set, with the stored credential values rendered read-only and
merged back in at submit rather than copied into form state.
* refactor(ui): type the auto router create payload boundary
handleAddAutoRouterSubmit took its values as any, so a change to either side
of the auto router create payload passed static checking. It now takes an
exported AddAutoRouterValues, and add_auto_router_tab annotates the object it
builds with that same type, so the producer and the consumer cannot drift.
Its model_info is built in one shot rather than assigned into after the fact,
which drops the second any and keeps the two conditional keys exactly as they
were.
Adds a routing group case that saves an untouched edit of a group whose stored
arguments are null, which is the shape the proxy returns for an unset field.
* refactor(ui): migrate CloudZero and cost tracking forms to react-hook-form and shadcn
Moves four forms off antd Form onto react-hook-form with the shadcn field
primitives, keeping the request payloads byte identical.
The two CloudZero modals were near duplicates, so the payload builder and the
API key input now live in shared modules next to them. The Update modal keeps
its redaction behaviour: the key field arrives empty with a "leave empty to
keep existing" hint, and an untouched save omits api_key from the request so
the stored secret survives. There is a test that fails if that regresses.
add_provider_form had no Form instance of its own, and its Form.Item wrappers
carried no name, so nothing was registered in the parent store. The parent in
cost_tracking_settings still owns an antd Form element, which stays for now,
and the migrated button keeps type="submit" so the parent's onFinish path
behaves exactly as before.
Each unit got characterization tests written against the antd version first,
then re-run unedited against the migration. Payload parity was also checked
side by side with toStrictEqual across seven scenarios.
* test(ui): guard the CloudZero null connection id against a zod type error
The proxy returns connection_id as null rather than omitting it, and a plain
z.string() rejects null. The seeding coalesces it to "" so an untouched save
reports the friendly required message instead of "expected string, received
null". Dropping that coalesce fails this test.
* refactor(ui): migrate the regenerate key and team member forms to react-hook-form and shadcn
Moves RegenerateKeyModal and EditMembership off antd Form onto react-hook-form
plus the shadcn field kit, and onto semantic color tokens so both are dark-mode
ready. The antd Modal shell and Alert stay as they are.
The submitted payload is unchanged on both. Payload construction is extracted
into regenerateKeyPayload.ts and memberFormValues.ts and unit tested there, and
each component keeps an integration test that was written against the antd
original and proven green before any source changed.
RegenerateKeyModal keeps antd InputNumber's precision=2 rounding of max_budget.
The rounding is string-exact rather than float based, so 1.005 still submits as
1.01 the way antd did. Submission stays on the modal footer button, so Enter
still does nothing.
EditMembership omits noValidate. Its numeric fields are already native number
inputs carrying min and step, so browser constraint validation blocks a bad
submit today and continues to. That is pinned by tests.
* fix(ui): accept null-valued fields the proxy returns for keys and members
The proxy returns null rather than omitting the key for an unset
key_alias, user_email or user_id. antd had no schema and forwarded
whatever came back, but z.string().optional() accepts undefined and
rejects null, so regenerating an alias-less key or editing a member
with no email failed validation and silently never submitted.
Widen those three fields to nullish() and pin each with a test that
seeds null and submits without touching the field. Each test passes
against the pre-migration antd component and failed against the
migration before this commit, and the payloads it asserts are the
ones antd put on the wire.
* refactor(ui): migrate user, policy, and margin forms to shadcn
Move four dashboard forms off antd Form and Tremor onto the shadcn field
kit, with react-hook-form where the form owns its own submit. Submit
payloads are unchanged: edit_user still emits exactly six keys with spend
as a number and max_budget as a string, policy_test_panel still omits
empty context keys, and add_attachment_form still builds the same
attachment body.
add_margin_form had no Form of its own and no bound field names, so its
Form.Item rules were inert; it keeps its parent-owned state props and
only swaps the presentation.
Adds characterization tests for edit_user and policy_test_panel, both
proven green against the antd originals before the migration, plus a case
pinning the provider value add_margin_form reports upward. The existing
add_attachment_form and add_margin_form suites pass unedited.
Extracts TokenSelect for the tag and alias inputs shared across the
policy forms, keeping antd's token separators and blur-commit behavior.
* refactor(ui): seed the user edit form by remount instead of an effect
Key the form on the edited user so react-hook-form seeds from its
defaults on each user, replacing the effect that reset the form and the
exhaustive-deps suppression that came with it. Cancel and submit still
reset, so reopening the same user shows stored values.
* test(ui): pin that the user edit form forwards null fields unchanged
The proxy returns null rather than omitting unset fields, and antd
forwarded whatever it received. The only fixture seeded every field, so
nothing proved the migrated form still emits null instead of an empty
string. Proven against the antd original first, and it fails if
toFormValues coerces.
* fix(ui): stop the policy modal cancelling its own save
The Create Policy and Update Policy buttons are Tremor buttons rendered
inside an antd Form. Tremor does not set a type, so both default to
type="submit" and a click ran two things at once: handleSubmit's own
form.validateFields(), and rc-field-form's onSubmit, which calls
formInstance.submit() and validates a second time.
rc-field-form keeps only the newest validation promise, so the first one
resolved as outOfDate and rejected with an empty errorFields list.
handleSubmit read that as a failure, so it never called createPolicy or
updatePolicy and instead reported "Failed to save policy". Creating and
editing a simple policy from the UI could not succeed.
Marking both footer buttons type="button" leaves the submit path solely
with handleSubmit. The new test file pins the request bodies for create
and update, and fails without this change.
* refactor(ui): migrate user, logging and policy forms to react-hook-form and shadcn
Moves four antd Form units onto react-hook-form plus the shadcn kit and
semantic color tokens, keeping every submit payload byte-identical.
- Settings/AdminSettings/LoggingSettings
- CreateUserButton
- users/_components/user_edit_view
- policies/_components/add_policy_form
* chore(ui): drop the eslint suppressions the migrated forms no longer need
* fix(ui): keep users with null optional fields editable
The proxy returns null rather than omitting user_alias, user_role,
budget_duration and metadata, and the new zod shape only allowed
undefined, so opening any such user and saving failed validation.
* feat(proxy): add /team/daily/activity/aggregated and use it in the Usage UI
The Team Usage tab drained row-paginated pages client side, which painted
newest days first and drew duplicate bars when a day's rows straddled a
page boundary. Serve the whole range in one SQL GROUPING SETS pass instead:
the aggregated query gains optional per-entity rollup levels (entity as the
most-significant GROUPING bit) so breakdown.entities keeps per-team spend,
aliases, and per-key splits. The endpoint shares the paginated route's
scoping via _resolve_team_daily_activity_scope, accepts the timezone the UI
already sends, and the api_key filter now takes a list so non-admin member
scoping works. The dashboard tries the aggregated endpoint first and falls
back to page draining on failure.
* chore: ratchet B008 budget down by the endpoint converted to Annotated Depends
* chore: keep mutable-ok suppressions on their annotation lines after formatting
* fix(proxy): reject malformed or over-wide ranges on team aggregated activity
The aggregated endpoint has no pagination bounding its work, so validate
start_date and end_date as real dates and cap the span at 400 days. The
dashboard's widest presets fit well inside the cap, and an over-cap range
falls back to the paginated flow. Also trim implementation comments that
restated the grouping-set code.
* fix(proxy): parse aggregated range bounds as UTC to satisfy DTZ007
* refactor(proxy): fetch entity rollups with a companion query instead of extending the main one
The entity-as-extra-GROUPING-bit approach made the bitmask layout
mode-dependent: the same constant meant (date) for normal rows and
(date, entity) for entity rows, disambiguated by masking. Split it out:
the shared WHERE builder feeds both the untouched main query and a small
per-entity rollup query keyed by GROUPING(api_key), run concurrently, and
a fold writes breakdown.entities onto the built response.
* refactor(proxy): share the daily-activity error and entity-metadata shapes
The type-discipline ceiling for LIT002 ratcheted down on staging, so the new
aggregated endpoint had to stop hand-rolling collections the codebase already
builds elsewhere. Funnel the `{"error": ...}` detail through one construction
site, turn the range validator into an error-as-value, reuse a single
entity-metadata lookup for both breakdown paths, and widen
get_api_key_metadata to any set so callers stop copying frozensets.
MessageManager and NotificationManager were thin facades over lib/toast since #37207. This
rewrites their ~750 call sites (226 files) to import { toast } from @/lib/toast directly:
success/info/warning/error keep their names, fromBackend becomes fromError, destroy/clear
become dismiss. The one config-object caller (CreateMCPServer's admin-review branch) becomes
an explicit toast.success(message, { description }). Behaviour is unchanged: no production
caller passed a duration, so every toast keeps the same kind, title and default duration.
Tests: the global vitest mock now targets @/lib/toast (toast.test.ts opts back out with
vi.unmock), so the per-file vi.mock boilerplate for the facades is deleted and assertions read
toast.success / toast.fromError. The two facade files, their test and their filename-case
suppressions are removed, along with the commented-out facade calls left in networking.tsx