Features
Safety (Analysis)

Safety (advanced analysis)

Signed in: In the workbench, this capability is the Safety tab. The tab and POST /api/analyze require an authenticated session when your deployment enables auth.

The Safety tab runs server-side advanced analysis on your pattern and flags. It complements the Warnings tab:

  • Warnings (anonymous or signed in) — Fast, client-side heuristics you see while typing.
  • Safety — Aggregated risk score (0–100), complexity level (lowextreme), extra structured warnings, short notes, and safe rewrite suggestions where applicable.

What you see in the UI

  • Risk score gauge / summary
  • Complexity factors (e.g. nested quantifiers, alternation depth, lookarounds)
  • List of issues with severity, hints, and optional code-oriented suggestions
  • Sign-in prompt when the Safety tab needs an authenticated session

API

The same logic is exposed as POST /api/analyze with JSON body { "pattern": "...", "flags": "g" }. The response includes:

  • riskScore — number capped at 100
  • warnings — id, severity (info | warn | danger), title, message, optional hint / range
  • notes — short bullet strings
  • suggestions — optional { id, title, description, caveat? } entries
  • complexity{ level, factors[] }

See API Reference for status codes and auth. The Run Safety Analysis action in the UI calls this endpoint after you sign in.