Skip to content

feat(ui): add Delete to the guardrail detail page and share one delete flow with the table row - #45893

Merged
jesus-berri merged 5 commits into
mainfrom
litellm_guardrail_detail_delete
Oct 21, 2026
Merged

jesus-berri merged 5 commits into
mainfrom
litellm_guardrail_detail_delete

Conversation

@jesus-berri

@jesus-berri jesus-berri commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • DB guardrails can only be deleted from the table row menu
  • The guardrail detail page has no way to delete it
  • The row delete has no warning and no typed-name confirmation

How it solves it:

  • Adds a Delete button next to Edit Settings on the Settings card
  • Uses the shared delete modal with a typed-name confirmation
  • Warns that keys, teams, and policies listing it silently skip it, while a policy pipeline step using it blocks every request with a 400 unless the step's on_error (or on_fail when on_error is unset) is next or allow
  • The table row delete now uses the same GuardrailDeleteModal, so both paths share one delete flow
  • Config guardrails still get no Delete, same as they get no Edit

User Flow

Before: a proxy admin looking at a DB guardrail's detail page has no way to delete it there

  1. Open http://localhost:4000/ui/guardrails and click a DB guardrail's ID
  2. Open the Settings tab
  3. The card header only shows Edit Settings, so they go back to the table and use the row ... menu

Before, Settings card with only Edit Settings

After: the same admin deletes it from the detail page after typing its name

  1. Open http://localhost:4000/ui/guardrails and click a DB guardrail's ID
  2. Open the Settings tab, a red Delete button sits right of Edit Settings
  3. Click Delete, the modal warns about what happens to keys, teams, and pipeline policies that use it and keeps Delete disabled until the exact name is typed
  4. Type the name and confirm, a success toast shows and the table reloads without the guardrail

After, Settings card with Delete

Linear ticket

Resolves LIT-6927

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. 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
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Shared setup is a local proxy on :4000 with a fresh Postgres DB, a config guardrail config-word-block in config.yaml, and a DB guardrail db-word-block created with POST /guardrails. The dashboard dev server runs on :3000 (head) and :3001 (base), logged in as admin at http://localhost:4000/ui/login

Before (c5ac184)

  1. Open http://localhost:3001/guardrails/, click the db-word-block ID, open the Settings tab
  2. Only Edit Settings shows in the card header (first screenshot above). Playwright finds 0 buttons named Delete on the page

After (c651ebc)

DB guardrail

  1. Open http://localhost:3000/guardrails/, click the db-word-block ID, open the Settings tab, then click Delete (second screenshot above)
  2. The modal shows the warning, and its Delete stays disabled with nothing typed and with db-word-bloc typed. It enables only with db-word-block

Delete modal with typed name

  1. Confirming shows "Guardrail "db-word-block" deleted successfully" and returns to the table with only the config guardrail left

Table after delete

  1. curl localhost:4000/v2/guardrails/list -H "Authorization: Bearer $KEY" now lists only config-word-block config

Table row delete

  1. Create db-row-block with POST /guardrails, open http://localhost:3000/guardrails/, click the row ... menu, then Delete
  2. The row modal now shows the same warning, including the pipeline step 400 case, and Delete stays disabled with nothing typed and with db-row-bloc typed. It enables only with db-row-block

Row delete modal with typed name

  1. Confirming shows "Guardrail "db-row-block" deleted successfully" and the table reloads without it. /v2/guardrails/list lists only db-word-block and config-word-block

Table after row delete

Config guardrail

  1. Open the config-word-block detail page and the Settings tab
  2. The header shows only the config info icon, no Edit Settings and no Delete

Config guardrail Settings card

Type

🆕 New Feature

Caveats (if any)

Low

  • On a failed DELETE the modal closes and the error toast shows, on both paths
  • The row delete now needs the typed name, which is one extra step for admins used to the plain confirm
  • Edit Settings and Edit Code moved into GuardrailSettingsActions to keep guardrail_info.tsx under the 800-line lint cap

Link to Devin session: https://app.devin.ai/sessions/495e8b67ead44c66a287e9368a953dd5
Open in Devin Desktop: https://app.devin.ai/desktop/session/495e8b67ead44c66a287e9368a953dd5?variant=devin
Requested by: @jesus-berri

…rdrails

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

…ine-object lint budget

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@jesus-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@litereview

litereview Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

✅ code-review

5/5 · Ready for human review

Scope: full · Full PR review.

No correctness findings.

Checks and execution details
  • Passed · Real testing evidence (required): Not applicable: no LLM translation changes in the scoped paths. Every changed file is under ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/. Nothing under litellm/llms/** or litellm/litellm_core_utils/prompt_templates/** changed.
  • Passed · Targeted vitest run on changed and adjacent guardrail UI tests (optional): I installed dependencies with npm ci --engine-strict=false. Node 22 is available locally and package.json asks for Node 24 or later. I then ran npx vitest run on GuardrailDeleteModal.test.tsx, guardrail_info.test.tsx, GuardrailsPanel.test.tsx, guardrail_table.test.tsx, GuardrailsPanel.integration.test.tsx and guardrail_info.characterization.test.tsx. Results: 32 of 32 and 23 of 23 passed, with no type errors.
  • Passed · tsc --noEmit on the dashboard (optional): tsc reports errors in guardrail test files the PR does not touch (TeamGuardrailsTab*.test.tsx, guardrail_info_helpers.test.tsx, guardrail_provider_fields.test.tsx). Those errors predate this PR. It reports no errors in GuardrailDeleteModal.tsx, GuardrailSettingsActions.tsx, guardrail_info.tsx or GuardrailsPanel.tsx.
  • Passed · Delete flow wiring and warning accuracy (optional): Checked by reading the code. GuardrailsPanel passes onDeleted, which closes the detail view and then refetches the list. The row path calls GuardrailDeleteModal with onDeleted={fetchGuardrails}. GuardrailSettingsActions returns null for config guardrails and while editing, which matches the old Edit gating. DeleteResourceModal keeps Delete disabled until the user types the exact name. The modal warning matches _pipeline_action_for_outcome in litellm/proxy/policy_engine/pipeline_executor.py: when a guardrail is missing, the step outcome is error, which maps to on_error and falls back to on_fail when on_error is unset.

View review · Reviewed 59c6cbe228d6

…the detail page

The table-row delete now has the same dangling-reference warning and typed-name
confirmation as the detail page. Tests now assert the success and error toasts

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration devin-ai-integration Bot changed the title feat(ui): add Delete to the guardrail detail Settings card for DB guardrails feat(ui): add Delete to the guardrail detail page and share one delete flow with the table row Oct 13, 2026
…p blocks requests with a 400

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@jesus-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jesus-berri

Copy link
Copy Markdown
Contributor Author

@litereview code-review

@jesus-berri
jesus-berri enabled auto-merge (squash) October 21, 2026 02:14
@jesus-berri
jesus-berri merged commit 3985795 into main Oct 21, 2026
84 checks passed
@jesus-berri
jesus-berri deleted the litellm_guardrail_detail_delete branch October 21, 2026 02:52
@mateo-berri

Copy link
Copy Markdown
Contributor

Main CircleCI job e2e_ui_testing fails three guardrail delete specs since this merged, because Delete now waits for the typed name. Pipeline 91453 https://app.circleci.com/pipelines/github/BerriAI/litellm/91453

yuneng-berri added a commit that referenced this pull request Oct 28, 2026
…havior (#48665)

* test(integration): update stale expectations to intended provider behavior

Each expectation moved because a merged PR changed behavior on purpose.
- chatgpt string input is wrapped as one user message (#41522)
- Gemini 2.5 tool media sits beside function_response (#48428)
- sampling knobs move to Gemini 3.5 Flash, which keeps them (#47645)
- a body base_model is stripped without allow_client_pricing_override (#47639)
- ai_decide answers without usage return usage null (#48261)
- azure_ai forwards mapped client anthropic-beta values (#48033)
- the OpenCode scripted upstream mints a fresh id per request

* test(e2e-ui): type the guardrail name before deleting it

GuardrailDeleteModal requires the exact name before Delete enables since
#45893. All three guardrail delete flows now go through one helper.

* test(observability): accept any sampled traceresponse flags and expect a 400 for a non-object body

OpenTelemetry 1.45 (#48055) sets the W3C random trace id flag on new traces,
so the gateway's traceresponse now ends in -03. The producer copies the server
span's own trace flags, so the tests now accept any two-digit flags with the
sampled bit set instead of pinning -01

#48438 made a non-object JSON body a 400 "Invalid JSON payload: expected an
object" on purpose, so the [1] body case is renamed non_object_body and
expects that 400

* test(observability): stop waiting on OpenTelemetry's export log line in the langtrace outage test

The outage test waited for "Exception while exporting Span batch" in the proxy
log, which is OpenTelemetry's wording and no longer appears with 1.45. The test
keeps asserting what the gateway guarantees, callers unaffected during the
outage, a live gateway, and every span after recovery delivered once with no
outage span duplicated

* test(guardrails): count the Responses disconnect spend rows #47611 added

Since #47611 a streamed /v1/responses disconnect writes its own spend row, so
the concurrent disconnect test saw 20 rows where it counted 10 by model group.
It now reads each row's call type and expects ten acompletion rows with the
outage verdict and ten aresponses rows with success. /v1/messages disconnects
still write no row on main, so they are left out of the count rather than
pinned as absent

The responses-httpx case of the single disconnect test no longer needs its
LIT-8603 skip and passes

* test(observability): size K4's timeout from the harness boot budget

K4 boots three two-worker proxies in a row. On CircleCI each boot takes 43 to
58 seconds, so a passing run took 179.97s against its fixed 180s cap and 6 of
30 runs hit pytest-timeout. The cap and the restart gate wait now come from
readiness_seconds and graceful_stop_seconds, like other multi-boot tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants