* [OPIK-9017] [FE] feat: add the guardrail policies page
A workspace-level Guardrails page in the v2 UI to create, edit, duplicate
and delete guardrail policies, against the policies API on main: one
DELETE per policy, writes behind the workspace settings permission (the
page is read-only without it), the 11 PII classes the checks support, and
topic lists that box each topic typed with a comma after it.
Replaces the closed #9260, which sat on the old backend stack.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(guardrails): keep the topic being typed free of a leading space
Typed one key at a time, the space after a comma arrived as its own
change and stayed in front of the next topic. Spaces inside a topic are
kept, as before; the saved topics were already trimmed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(guardrails): give each policy panel its own form, title the table Policies
- A closed panel stays in the page, so a shared form id let one panel's
Save submit another panel's form; each panel now has its own id.
- The "+N" rule tooltip lists only the rule types hidden from the row.
- The topic lists say that Enter or a comma adds a topic.
- The page heading reads "Policies": the page is already Guardrails in
the sidebar and the breadcrumb.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(alerts): offer only topic, PII and prompt injection guardrails in alert triggers
LLM judge and custom guardrails are left out of the guardrail-triggered
alert's type list for now: the policies and checks cover the other three.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(guardrails): report every failed policy deletion, keep saved alert types visible
- Bulk delete waits for every call: the toast names how many failed and
why, and policies that were deleted leave the cache either way.
- An alert saved with a guardrail type the form no longer offers still
lists it, ticked, so it can be seen and unticked.
- The topic-limit tests use the limits written out, and check that a list
at exactly the limits passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(guardrails): keep the open policy and the page through refetches
- A failed background refetch of the toggles or the organization lookup
keeps the answer already given instead of replacing the page.
- The edit panel keeps the last copy of its policy while a refetch moves
it off the page, and a deep link to a policy on the page sends no
by-id request.
- Edit in the row menu opens the page's panel and puts the id in the
URL; Duplicate opens one page-level panel with the page's current names.
- Escape no longer closes a panel with unsaved changes.
- The select column needs the workspace settings permission, the docs
link no longer redirects, and the rename warning compares against the
name the form was seeded with.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(guardrails): cover the policies page's panels, lookup and permissions
Tests for the page-level fixes: the open policy's panel survives a
refetch that moves it off the page, a deep link waits for the list
before looking the policy up by id, Edit in the row menu puts the id in
the URL, Duplicate reads the page's current names, and the select column
needs the workspace settings permission. Each fails on the previous
page and row cell.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(guardrails): open a listed policy even after its lookup by id failed
A disabled query still reports the error of its last fetch, so after a
failed lookup by id (a deep link during an outage), opening the same
policy from its row closed it again with the "could not be opened" toast
until the cached error was collected. Only an error from a lookup that is
enabled and has finished now closes the policy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>