Repository navigation
fix(guardrails): Align inline validator types - #1269
Conversation
Takes app/api/openapi_docs.py from untested to 100% statement coverage: schema inference for every value kind, the component registry, and each branch of doc(). Two of the cases pin behaviour that is easy to regress: - infer_schema() checks bool before int, since bool subclasses int. Without that order every boolean example would be documented as an integer. - inject_component_schemas() lets a generated component win a name clash. A real Pydantic model always describes a route better than a hand-written stand-in. Also fixes doc(): called with request_examples and no request_schema, it inferred the body schema from the absent `request` and documented the body as nullable. It now infers from the first example instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Upstream dropped profanity_free from the tenant catalogue and uli_slur_match is the primary slur check, so InlineValidatorTypeEnum now matches GET /guardrails. EXPOSED_VALIDATOR_TYPES is derived from the enum so the two lists cannot drift again. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
OpenAPI changes ⚪ No API surface changesNote This PR does not modify the API contract.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.8.0-main.11 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Closes #1270
InlineValidatorTypeEnum: removeprofanity_free, adduli_slur_match— matches whatGET /guardrailsreturns on staging (gender_assumption_bias, uli_slur_match, pii_remover, topic_relevance_llm).EXPOSED_VALIDATOR_TYPESnow derived from the enum so the inline-spec allowlist and the catalogue filter are one source of truth.Test plan
uv run pytest app/tests/services/llm/test_guardrails.py app/tests/api/routes/test_guardrails.py— 114 passed🤖 Generated with Claude Code